8#ifndef skgpu_graphite_ShaderCodeDictionary_DEFINED
9#define skgpu_graphite_ShaderCodeDictionary_DEFINED
46class RuntimeEffectDictionary;
53 const char*
name()
const {
return fName; }
94 const char* functionName,
146 , fRequiredFlags(snippet->fSnippetRequirementFlags)
199 return fRuntimeEffectDictionary;
207 std::string toSkSL(
const Caps* caps,
209 bool useStorageBuffers,
210 int* numTexturesAndSamplersUsed,
211 int* numPaintUniforms,
212 int* renderStepUniformTotalBytes,
213 int* paintUniformsTotalBytes,
214 bool* hasGradientBuffer,
227 const RuntimeEffectDictionary* fRuntimeEffectDictionary;
228 const char* fSsboIndex;
261 return fBuiltInCodeSnippets[(
int)
id].fSnippetRequirementFlags;
265 bool isValidID(
int snippetID)
const SK_EXCLUDES(fSpinLock);
273 return this->
getEntry(SkTo<int>(codeSnippetID));
278#if defined(GRAPHITE_TEST_UTILS)
283 const char* addTextToArena(std::string_view
text);
287 std::array<ShaderSnippet, kBuiltInCodeSnippetIDCount> fBuiltInCodeSnippets;
289 using KnownRuntimeEffectArray = std::array<ShaderSnippet, SkKnownRuntimeEffects::kStableKeyCnt>;
290 KnownRuntimeEffectArray fKnownRuntimeEffectCodeSnippets SK_GUARDED_BY(fSpinLock);
295 RuntimeEffectArray fUserDefinedCodeSnippets SK_GUARDED_BY(fSpinLock);
298 mutable SkSpinlock fSpinLock;
304 PaintIDMap fPaintKeyToID SK_GUARDED_BY(fSpinLock);
308 struct RuntimeEffectKey {
310 uint32_t fUniformSize;
313 return fHash == rhs.fHash && fUniformSize == rhs.fUniformSize;
325 RuntimeEffectMap fRuntimeEffectMap SK_GUARDED_BY(fSpinLock);
static int step(int x, SkScalar min, SkScalar max)
#define SK_BEGIN_REQUIRE_DENSE
#define SK_END_REQUIRE_DENSE
static constexpr bool SkToBool(const T &x)
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
constexpr bool empty() const
SkString toString(const ShaderCodeDictionary *dict, bool includeData) const
PaintParamsKey lookup(UniquePaintParamsID) const SK_EXCLUDES(fSpinLock)
SkEnumBitMask< SnippetRequirementFlags > getSnippetRequirementFlags(BuiltInCodeSnippetID id) const
UniquePaintParamsID findOrCreate(PaintParamsKeyBuilder *) SK_EXCLUDES(fSpinLock)
const ShaderSnippet * getEntry(BuiltInCodeSnippetID codeSnippetID) const SK_EXCLUDES(fSpinLock)
int findOrCreateRuntimeEffectSnippet(const SkRuntimeEffect *effect)
SkSpan< const Uniform > getUniforms(BuiltInCodeSnippetID) const
const ShaderSnippet * getEntry(int codeSnippetID) const SK_EXCLUDES(fSpinLock)
SkString idToString(UniquePaintParamsID id) const
const char * ssboIndex() const
bool needsLocalCoords() const
ShaderInfo(UniquePaintParamsID id, const ShaderCodeDictionary *dict, const RuntimeEffectDictionary *rteDict, const char *ssboIndex)
const skgpu::BlendInfo & blendInfo() const
bool needsSurfaceColor() const
const skia_private::TArray< uint32_t > & data() const
const RuntimeEffectDictionary * runtimeEffectDictionary() const
ShaderNode(const ShaderSnippet *snippet, SkSpan< const ShaderNode * > children, int codeID, int keyIndex, SkSpan< const uint32_t > data)
const ShaderNode * child(int childIndex) const
const ShaderSnippet * entry() const
SkSpan< const ShaderNode * > children() const
SkEnumBitMask< SnippetRequirementFlags > requiredFlags() const
int32_t codeSnippetId() const
SkSpan< const uint32_t > data() const
const char * name() const
constexpr TextureAndSampler(const char *name)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DEF_SWITCHES_START aot vmservice shared library name
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
SK_MAKE_BITMASK_OPS(DawnErrorType)
std::string fPriorStageOutput
std::string fBlenderDstColor
std::string(*)(const ShaderInfo &shaderInfo, const ShaderNode *) GeneratePreambleForSnippetFn
const char * fStaticFunctionName
SkEnumBitMask< SnippetRequirementFlags > fSnippetRequirementFlags
GeneratePreambleForSnippetFn fPreambleGenerator
SkSpan< const Uniform > fUniforms
bool needsPriorStageOutput() const
bool needsBlenderDstColor() const
bool needsLocalCoords() const
std::string(*)(const ShaderInfo &shaderInfo, const ShaderNode *, const Args &args) GenerateExpressionForSnippetFn
GenerateExpressionForSnippetFn fExpressionGenerator
SkSpan< const TextureAndSampler > fTexturesAndSamplers
ShaderSnippet(const char *name, SkSpan< const Uniform > uniforms, SkEnumBitMask< SnippetRequirementFlags > snippetRequirementFlags, SkSpan< const TextureAndSampler > texturesAndSamplers, const char *functionName, GenerateExpressionForSnippetFn expressionGenerator, GeneratePreambleForSnippetFn preambleGenerator, int numChildren)