Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
DawnTypesPriv.h
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
8#ifndef skgpu_graphite_DawnTypesPriv_DEFINED
9#define skgpu_graphite_DawnTypesPriv_DEFINED
10
13
14namespace skgpu::graphite {
15
17 DawnTextureSpec() = default;
24
25 bool operator==(const DawnTextureSpec& that) const {
26 return fUsage == that.fUsage && fFormat == that.fFormat &&
27 fViewFormat == that.fViewFormat && fAspect == that.fAspect &&
28 fSlice == that.fSlice;
29 }
30
31 bool isCompatible(const DawnTextureSpec& that) const {
32 // The usages may match or the usage passed in may be a superset of the usage stored within.
33 // The aspect should either match the plane aspect or should be All.
34 return getViewFormat() == that.getViewFormat() && (fUsage & that.fUsage) == fUsage &&
35 (fAspect == that.fAspect || fAspect == wgpu::TextureAspect::All);
36 }
37
38 wgpu::TextureFormat getViewFormat() const {
39 return fViewFormat != wgpu::TextureFormat::Undefined ? fViewFormat : fFormat;
40 }
41
42 SkString toString() const;
43
44 wgpu::TextureFormat fFormat = wgpu::TextureFormat::Undefined;
45 // `fViewFormat` is always single plane format or plane view format for a multiplanar
46 // wgpu::Texture.
47 wgpu::TextureFormat fViewFormat = wgpu::TextureFormat::Undefined;
48 wgpu::TextureUsage fUsage = wgpu::TextureUsage::None;
49 wgpu::TextureAspect fAspect = wgpu::TextureAspect::All;
50 uint32_t fSlice = 0;
51};
52
54 uint32_t sampleCount,
55 Mipmapped mipmapped);
56
58
59} // namespace skgpu::graphite
60
61#endif // skgpu_graphite_DawnTypesPriv_DEFINED
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
FlTexture * texture
DawnTextureInfo DawnTextureInfoFromWGPUTexture(WGPUTexture texture)
DawnTextureInfo DawnTextureSpecToTextureInfo(const DawnTextureSpec &dawnSpec, uint32_t sampleCount, Mipmapped mipmapped)
Mipmapped
Definition GpuTypes.h:53
bool operator==(const DawnTextureSpec &that) const
DawnTextureSpec(const DawnTextureInfo &info)
wgpu::TextureFormat getViewFormat() const
bool isCompatible(const DawnTextureSpec &that) const
wgpu::TextureFormat fViewFormat