• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrMtlCppUtil_DEFINED
9 #define GrMtlCppUtil_DEFINED
10 
11 #include "include/core/SkImage.h"
12 #include "include/gpu/mtl/GrMtlTypes.h"
13 
14 class GrBackendFormat;
15 
16 // Utilities that can be used from cpp files (rather than .mm).
17 
18 GrMTLPixelFormat GrGetMTLPixelFormatFromMtlTextureInfo(const GrMtlTextureInfo&);
19 
20 size_t GrMtlBackendFormatBytesPerBlock(const GrBackendFormat& format);
21 
22 int GrMtlBackendFormatStencilBits(const GrBackendFormat& format);
23 
24 uint32_t GrMtlFormatChannels(GrMTLPixelFormat);
25 
26 SkImage::CompressionType GrMtlBackendFormatToCompressionType(const GrBackendFormat& format);
27 
28 /**
29  * Gets the sample count of a texture held by GrMtlTextureInfo or zero if the texture is nil.
30  */
31 int GrMtlTextureInfoSampleCount(const GrMtlTextureInfo&);
32 
33 #if defined(SK_DEBUG) || GR_TEST_UTILS
34 const char* GrMtlFormatToStr(GrMTLPixelFormat mtlFormat);
35 bool GrMtlFormatIsBGRA8(GrMTLPixelFormat mtlFormat);
36 #endif
37 
38 #endif
39