Flutter Engine
The Flutter Engine
MtlGraphiteTypes.mm
Go to the documentation of this file.
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
9
10#import <Metal/Metal.h>
11
12namespace skgpu::graphite {
13
16 id<MTLTexture> mtlTex = (id<MTLTexture>)texture;
17
18 fSampleCount = mtlTex.sampleCount;
19 fMipmapped = mtlTex.mipmapLevelCount > 1 ? Mipmapped::kYes : Mipmapped::kNo;
20
21 fFormat = mtlTex.pixelFormat;
22 fUsage = mtlTex.usage;
23 fStorageMode = mtlTex.storageMode;
24 fFramebufferOnly = mtlTex.framebufferOnly;
25}
26
28 uint32_t sampleCount,
29 Mipmapped mipmapped) {
31 // Shared info
32 info.fSampleCount = sampleCount;
33 info.fMipmapped = mipmapped;
34
35 // Mtl info
36 info.fFormat = mtlSpec.fFormat;
37 info.fUsage = mtlSpec.fUsage;
38 info.fStorageMode = mtlSpec.fStorageMode;
39 info.fFramebufferOnly = mtlSpec.fFramebufferOnly;
40
41 return info;
42}
43
44} // namespace skgpu::graphite
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
FlTexture * texture
MtlTextureInfo MtlTextureSpecToTextureInfo(const MtlTextureSpec &mtlSpec, uint32_t sampleCount, Mipmapped mipmapped)
Mipmapped
Definition: GpuTypes.h:53