• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
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 skgpu_graphite_MtlGraphiteTypes_DEFINED
9 #define skgpu_graphite_MtlGraphiteTypes_DEFINED
10 
11 #if __OBJC__  // <Metal/Metal.h> only works when compiled for Objective C
12 
13 #include "include/core/SkTypes.h"
14 
15 #include "include/gpu/graphite/GraphiteTypes.h"
16 #include "include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h"
17 #include "include/private/base/SkAPI.h"
18 
19 #import <CoreFoundation/CoreFoundation.h>
20 #import <Metal/Metal.h>
21 #import <TargetConditionals.h>
22 
23 namespace skgpu::graphite {
24 struct SK_API MtlTextureInfo {
25     uint32_t fSampleCount = 1;
26     skgpu::Mipmapped fMipmapped = skgpu::Mipmapped::kNo;
27 
28     MTLPixelFormat fFormat = MTLPixelFormatInvalid;
29     MTLTextureUsage fUsage = MTLTextureUsageUnknown;
30     MTLStorageMode fStorageMode = MTLStorageModeShared;
31     bool fFramebufferOnly = false;
32 
33     MtlTextureInfo() = default;
34     MtlTextureInfo(CFTypeRef mtlTexture);
MtlTextureInfoMtlTextureInfo35     MtlTextureInfo(uint32_t sampleCount,
36                    skgpu::Mipmapped mipmapped,
37                    MTLPixelFormat format,
38                    MTLTextureUsage usage,
39                    MTLStorageMode storageMode,
40                    bool framebufferOnly)
41             : fSampleCount(sampleCount)
42             , fMipmapped(mipmapped)
43             , fFormat(format)
44             , fUsage(usage)
45             , fStorageMode(storageMode)
46             , fFramebufferOnly(framebufferOnly) {}
47 };
48 }  // namespace skgpu::graphite
49 
50 #endif  // __OBJC__
51 
52 #endif // skgpu_graphite_MtlGraphiteTypes_DEFINED
53