8#ifndef skgpu_graphite_DawnCaps_DEFINED
9#define skgpu_graphite_DawnCaps_DEFINED
15#include "webgpu/webgpu_cpp.h"
20struct DawnBackendContext;
32 return fSupportedResolveTextureLoadOp;
51 const SkISize colorAttachmentDimensions)
const override;
69 bool onIsTexturable(
const TextureInfo&)
const override;
70 bool supportsWritePixels(
const TextureInfo& textureInfo)
const override;
71 bool supportsReadPixels(
const TextureInfo& textureInfo)
const override;
72 std::pair<
SkColorType,
bool > supportedWritePixelsColorType(
76 std::pair<
SkColorType,
bool > supportedReadPixelsColorType(
82 void initShaderCaps(
const wgpu::Device&
device);
83 void initFormatTable(
const wgpu::Device&
device);
87 return fColorTypeToFormatTable[idx];
90 uint32_t maxRenderTargetSampleCount(wgpu::TextureFormat
format)
const;
91 bool isTexturable(wgpu::TextureFormat
format)
const;
96 for (
int i = 0;
i < fColorTypeInfoCount; ++
i) {
98 return fColorTypeInfos[
i].fFlags;
105 kTexturable_Flag = 0x01,
106 kRenderable_Flag = 0x02,
108 kResolve_Flag = 0x08,
109 kStorage_Flag = 0x10,
111 static const uint16_t kAllFlags =
112 kTexturable_Flag | kRenderable_Flag | kMSAA_Flag | kResolve_Flag | kStorage_Flag;
116 std::unique_ptr<ColorTypeInfo[]> fColorTypeInfos;
117 int fColorTypeInfoCount = 0;
120 std::array<FormatInfo, kFormatCnt> fFormatTable;
122 static size_t GetFormatIndex(wgpu::TextureFormat
format);
123 const FormatInfo& getFormatInfo(wgpu::TextureFormat
format)
const {
124 size_t index = GetFormatIndex(
format);
125 return fFormatTable[index];
129 void setColorType(
SkColorType, std::initializer_list<wgpu::TextureFormat> formats);
135 std::optional<wgpu::LoadOp> fSupportedResolveTextureLoadOp;
137 bool fUseAsyncPipelineCreation =
true;
138 bool fAllowScopedErrorChecks =
true;
static constexpr int kSkColorTypeCnt
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static constexpr size_t kFormatCnt
void buildKeyForTexture(SkISize dimensions, const TextureInfo &, ResourceType, Shareable, GraphiteResourceKey *) const override
TextureInfo getDefaultStorageTextureInfo(SkColorType) const override
bool allowScopedErrorChecks() const
bool isStorage(const TextureInfo &) const override
bool useAsyncPipelineCreation() const
bool isRenderable(const 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
DawnCaps(const DawnBackendContext &, const ContextOptions &)
UniqueKey makeGraphicsPipelineKey(const GraphicsPipelineDesc &, const RenderPassDesc &) const override
TextureInfo getTextureInfoForSampledCopy(const TextureInfo &textureInfo, Mipmapped mipmapped) const override
uint64_t getRenderPassDescKeyForPipeline(const RenderPassDesc &renderPassDesc) const
TextureInfo getDefaultCompressedTextureInfo(SkTextureCompressionType, Mipmapped mipmapped, Protected) const override
std::optional< wgpu::LoadOp > resolveTextureLoadOp() const
TextureInfo getDefaultMSAATextureInfo(const TextureInfo &singleSampledInfo, Discardable discardable) const override
uint32_t uint32_t * format