8#ifndef skgpu_graphite_DawnCaps_DEFINED
9#define skgpu_graphite_DawnCaps_DEFINED
15#include "webgpu/webgpu_cpp.h"
20struct DawnBackendContext;
46 const SkISize colorAttachmentDimensions)
const override;
77 void initShaderCaps(
const wgpu::Device&
device);
78 void initFormatTable(
const wgpu::Device&
device);
82 return fColorTypeToFormatTable[idx];
85 uint32_t maxRenderTargetSampleCount(wgpu::TextureFormat
format)
const;
86 bool isTexturable(wgpu::TextureFormat
format)
const;
91 for (
int i = 0; i < fColorTypeInfoCount; ++i) {
93 return fColorTypeInfos[i].fFlags;
100 kTexturable_Flag = 0x01,
101 kRenderable_Flag = 0x02,
103 kResolve_Flag = 0x08,
104 kStorage_Flag = 0x10,
106 static const uint16_t kAllFlags =
107 kTexturable_Flag | kRenderable_Flag | kMSAA_Flag | kResolve_Flag | kStorage_Flag;
111 std::unique_ptr<ColorTypeInfo[]> fColorTypeInfos;
112 int fColorTypeInfoCount = 0;
115 std::array<FormatInfo, kFormatCnt> fFormatTable;
117 static size_t GetFormatIndex(wgpu::TextureFormat
format);
118 const FormatInfo& getFormatInfo(wgpu::TextureFormat
format)
const {
119 size_t index = GetFormatIndex(
format);
120 return fFormatTable[index];
124 void setColorType(
SkColorType, std::initializer_list<wgpu::TextureFormat> formats);
126#if !defined(__EMSCRIPTEN__)
127 bool fTransientAttachmentSupport =
false;
130 bool fUseAsyncPipelineCreation =
true;
131 bool fAllowScopedErrorChecks =
true;
static constexpr int kSkColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr size_t kFormatCnt
uint64_t getRenderPassDescKey(const RenderPassDesc &renderPassDesc) const
void buildKeyForTexture(SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const override
TextureInfo getDefaultStorageTextureInfo(SkColorType) const override
bool onIsTexturable(const TextureInfo &) const override
std::pair< SkColorType, bool > supportedWritePixelsColorType(SkColorType dstColorType, const TextureInfo &dstTextureInfo, SkColorType srcColorType) const override
bool allowScopedErrorChecks() const
bool isStorage(const TextureInfo &) const override
bool useAsyncPipelineCreation() const
std::pair< SkColorType, bool > supportedReadPixelsColorType(SkColorType srcColorType, const TextureInfo &srcTextureInfo, SkColorType dstColorType) const override
const ColorTypeInfo * getColorTypeInfo(SkColorType, const TextureInfo &) const override
bool isRenderable(const TextureInfo &) const override
bool supportsWritePixels(const TextureInfo &textureInfo) const override
TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const override
SkISize getDepthAttachmentDimensions(const TextureInfo &, const SkISize colorAttachmentDimensions) const override
TextureInfo getDefaultDepthStencilTextureInfo(SkEnumBitMask< DepthStencilFlags >, uint32_t sampleCount, Protected) const override
uint32_t channelMask(const TextureInfo &) const override
UniqueKey makeComputePipelineKey(const ComputePipelineDesc &) const override
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc &, const RenderPassDesc &) const override
TextureInfo getTextureInfoForSampledCopy(const TextureInfo &textureInfo, Mipmapped mipmapped) const override
TextureInfo getDefaultCompressedTextureInfo(SkTextureCompressionType, Mipmapped mipmapped, Protected) const override
bool supportsReadPixels(const TextureInfo &textureInfo) const override
TextureInfo getDefaultMSAATextureInfo(const TextureInfo &singleSampledInfo, Discardable discardable) const override
uint32_t uint32_t * format