[graphite] Fix shader dictionary's map key equality check.

Change-Id: I3d1433fba70d5283cb76c960c2e5e7aab0b53ef5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510816
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2022-02-18 14:43:10 -05:00 committed by SkCQ
parent fae2cc3b80
commit 7af43100d5
2 changed files with 10 additions and 6 deletions

View File

@ -106,13 +106,21 @@ private:
size_t operator()(const SkPaintParamsKey*) const;
};
struct KeyEqual {
bool operator()(const SkPaintParamsKey* k1, const SkPaintParamsKey* k2) const {
return k1->operator==(*k2);
}
};
std::array<SkShaderInfo::SnippetEntry, kBuiltInCodeSnippetIDCount> fBuiltInCodeSnippets;
std::vector<SkShaderInfo::SnippetEntry> fUserDefinedCodeSnippets;
// TODO: can we do something better given this should have write-seldom/read-often behavior?
mutable SkSpinlock fSpinLock;
std::unordered_map<const SkPaintParamsKey*, Entry*, Hash> fHash SK_GUARDED_BY(fSpinLock);
using PaintHashMap = std::unordered_map<const SkPaintParamsKey*, Entry*, Hash, KeyEqual>;
PaintHashMap fHash SK_GUARDED_BY(fSpinLock);
std::vector<Entry*> fEntryVector SK_GUARDED_BY(fSpinLock);
SkArenaAlloc fArena{256};

View File

@ -65,9 +65,7 @@ void GraphiteMetalWindowContext::initializeContext() {
void GraphiteMetalWindowContext::destroyContext() {
if (fGraphiteContext) {
// TODO?
// in case we have outstanding refs to this (lua?)
// fGraphiteContext->abandonContext();
fGraphiteRecorder.reset();
fGraphiteContext.reset();
}
@ -84,8 +82,6 @@ sk_sp<SkSurface> GraphiteMetalWindowContext::getBackbufferSurface() {
sk_sp<SkSurface> surface;
id<CAMetalDrawable> currentDrawable = [fMetalLayer nextDrawable];
skgpu::mtl::TextureInfo mtlInfo((skgpu::mtl::Handle)currentDrawable.texture);
skgpu::BackendTexture backendTex(this->dimensions(),
(skgpu::mtl::Handle)currentDrawable.texture);