[graphite] Pass builder into SkShaderCodeDictionary::findOrCreate rather than the key

Just a minor cleanup to hide some cruft.

Bug: skia:12701
Change-Id: I70e9c8ba89a5b7d100a3d3f9b9dd084ad0a70715
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548418
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Robert Phillips 2022-06-10 09:43:17 -04:00 committed by SkCQ
parent 8481c5fca7
commit 29b7c629b5
4 changed files with 7 additions and 23 deletions

View File

@ -650,16 +650,9 @@ SkUniquePaintParamsID CreateKey(const SkKeyContext& keyContext,
BlendModeBlock::BeginBlock(keyContext, builder, /* pipelineData*/ nullptr, bm); // 'bm' is used
builder->endBlock();
SkPaintParamsKey key = builder->lockAsKey();
auto dict = keyContext.dict();
auto entry = dict->findOrCreate(
key
#ifdef SK_GRAPHITE_ENABLED
, builder->blendInfo()
#endif
);
auto entry = dict->findOrCreate(builder);
return entry->uniqueID();
}

View File

@ -207,11 +207,9 @@ size_t SkShaderCodeDictionary::Hash::operator()(const SkPaintParamsKey* key) con
}
const SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::findOrCreate(
const SkPaintParamsKey& key
#ifdef SK_GRAPHITE_ENABLED
, const skgpu::BlendInfo& blendInfo
#endif
) {
SkPaintParamsKeyBuilder* builder) {
const SkPaintParamsKey& key = builder->lockAsKey();
SkAutoSpinlock lock{fSpinLock};
auto iter = fHash.find(&key);
@ -221,7 +219,7 @@ const SkShaderCodeDictionary::Entry* SkShaderCodeDictionary::findOrCreate(
}
#ifdef SK_GRAPHITE_ENABLED
Entry* newEntry = this->makeEntry(key, blendInfo);
Entry* newEntry = this->makeEntry(key, builder->blendInfo());
#else
Entry* newEntry = this->makeEntry(key);
#endif

View File

@ -176,12 +176,7 @@ public:
#endif
};
#ifdef SK_GRAPHITE_ENABLED
const Entry* findOrCreate(const SkPaintParamsKey&,
const skgpu::BlendInfo&) SK_EXCLUDES(fSpinLock);
#else
const Entry* findOrCreate(const SkPaintParamsKey&) SK_EXCLUDES(fSpinLock);
#endif
const Entry* findOrCreate(SkPaintParamsKeyBuilder*) SK_EXCLUDES(fSpinLock);
const Entry* lookup(SkUniquePaintParamsID) const SK_EXCLUDES(fSpinLock);

View File

@ -35,13 +35,11 @@ ExtractPaintData(Recorder* recorder,
p.toKey(keyContext, builder, gatherer);
SkPaintParamsKey key = builder->lockAsKey();
auto dict = recorder->priv().resourceProvider()->shaderCodeDictionary();
UniformDataCache* uniformDataCache = recorder->priv().uniformDataCache();
TextureDataCache* textureDataCache = recorder->priv().textureDataCache();
auto entry = dict->findOrCreate(key, builder->blendInfo());
auto entry = dict->findOrCreate(builder);
UniformDataCache::Index uniformIndex;
if (gatherer->hasUniforms()) {
uniformIndex = uniformDataCache->insert(gatherer->peekUniformData());