Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
DawnTypes.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_DawnTypes_DEFINED
9#define skgpu_graphite_DawnTypes_DEFINED
10
12#include "webgpu/webgpu_cpp.h" // NO_G3_REWRITE
13
14namespace skgpu::graphite {
15
17 uint32_t fSampleCount = 1;
18 Mipmapped fMipmapped = Mipmapped::kNo;
19
20 // wgpu::TextureDescriptor properties
21 wgpu::TextureFormat fFormat = wgpu::TextureFormat::Undefined;
22 // `fViewFormat` for multiplanar formats corresponds to the plane TextureView's format.
23 wgpu::TextureFormat fViewFormat = wgpu::TextureFormat::Undefined;
24 wgpu::TextureUsage fUsage = wgpu::TextureUsage::None;
25 // TODO(b/308944094): Migrate aspect information to BackendTextureViews.
26 wgpu::TextureAspect fAspect = wgpu::TextureAspect::All;
27 uint32_t fSlice = 0;
28
29 wgpu::TextureFormat getViewFormat() const {
30 return fViewFormat != wgpu::TextureFormat::Undefined ? fViewFormat : fFormat;
31 }
32
33 DawnTextureInfo() = default;
34 DawnTextureInfo(uint32_t sampleCount,
35 Mipmapped mipmapped,
36 wgpu::TextureFormat format,
37 wgpu::TextureUsage usage,
38 wgpu::TextureAspect aspect)
39 : DawnTextureInfo(sampleCount,
40 mipmapped,
41 /*format=*/format,
42 /*viewFormat=*/format,
43 usage,
44 aspect,
45 /*slice=*/0) {}
46 DawnTextureInfo(uint32_t sampleCount,
47 Mipmapped mipmapped,
48 wgpu::TextureFormat format,
49 wgpu::TextureFormat viewFormat,
50 wgpu::TextureUsage usage,
51 wgpu::TextureAspect aspect,
52 uint32_t slice)
53 : fSampleCount(sampleCount)
54 , fMipmapped(mipmapped)
56 , fViewFormat(viewFormat)
57 , fUsage(usage)
58 , fAspect(aspect)
59 , fSlice(slice) {}
60};
61
62} // namespace skgpu::graphite
63
64#endif // skgpu_graphite_DawnTypes_DEFINED
65
66
uint32_t uint32_t * format
Mipmapped
Definition GpuTypes.h:53
static void usage(char *argv0)
wgpu::TextureFormat fViewFormat
Definition DawnTypes.h:23
wgpu::TextureFormat getViewFormat() const
Definition DawnTypes.h:29
wgpu::TextureFormat fFormat
Definition DawnTypes.h:21
DawnTextureInfo(uint32_t sampleCount, Mipmapped mipmapped, wgpu::TextureFormat format, wgpu::TextureFormat viewFormat, wgpu::TextureUsage usage, wgpu::TextureAspect aspect, uint32_t slice)
Definition DawnTypes.h:46
wgpu::TextureAspect fAspect
Definition DawnTypes.h:26
wgpu::TextureUsage fUsage
Definition DawnTypes.h:24
DawnTextureInfo(uint32_t sampleCount, Mipmapped mipmapped, wgpu::TextureFormat format, wgpu::TextureUsage usage, wgpu::TextureAspect aspect)
Definition DawnTypes.h:34