Flutter Engine
The Flutter Engine
DawnTypesPriv.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2022 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
10namespace skgpu::graphite {
11
13 return SkStringPrintf("format=0x%08X,viewFormat=0x%08X,usage=0x%08X,aspect=0x%08X,slice=%u",
14 static_cast<unsigned int>(fFormat),
15 static_cast<unsigned int>(fViewFormat),
16 static_cast<unsigned int>(fUsage),
17 static_cast<unsigned int>(fAspect),
18 fSlice);
19}
20
23 return DawnTextureInfo(
24 wgpuTextureGetSampleCount(texture),
25 wgpuTextureGetMipLevelCount(texture) > 1 ? Mipmapped::kYes : Mipmapped::kNo,
26 /*format=*/static_cast<wgpu::TextureFormat>(wgpuTextureGetFormat(texture)),
27 /*viewFormat=*/static_cast<wgpu::TextureFormat>(wgpuTextureGetFormat(texture)),
28 static_cast<wgpu::TextureUsage>(wgpuTextureGetUsage(texture)),
29 wgpu::TextureAspect::All, /*slice=*/0);
30}
31
33 uint32_t sampleCount,
34 Mipmapped mipmapped) {
36 // Shared info
37 info.fSampleCount = sampleCount;
38 info.fMipmapped = mipmapped;
39
40 // Dawn info
41 info.fFormat = dawnSpec.fFormat;
42 info.fViewFormat = dawnSpec.fViewFormat;
43 info.fUsage = dawnSpec.fUsage;
44 info.fAspect = dawnSpec.fAspect;
45#if !defined(__EMSCRIPTEN__)
46 info.fYcbcrVkDescriptor = dawnSpec.fYcbcrVkDescriptor;
47#endif
48
49 return info;
50}
51
52} // namespace skgpu::graphite
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
FlTexture * texture
TextureUsage
Definition: formats.h:300
DawnTextureInfo DawnTextureInfoFromWGPUTexture(WGPUTexture texture)
DawnTextureInfo DawnTextureSpecToTextureInfo(const DawnTextureSpec &dawnSpec, uint32_t sampleCount, Mipmapped mipmapped)
Mipmapped
Definition: GpuTypes.h:53
wgpu::YCbCrVkDescriptor fYcbcrVkDescriptor
Definition: DawnTypesPriv.h:62
wgpu::TextureFormat fViewFormat
Definition: DawnTypesPriv.h:58