xref: /aosp_15_r20/external/skia/src/gpu/graphite/RuntimeEffectDictionary.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "src/gpu/graphite/RuntimeEffectDictionary.h"
9 
10 #include "src/core/SkRuntimeEffectPriv.h"
11 
12 namespace skgpu::graphite {
13 
set(int codeSnippetID,sk_sp<const SkRuntimeEffect> effect)14 void RuntimeEffectDictionary::set(int codeSnippetID, sk_sp<const SkRuntimeEffect> effect) {
15     // The same code-snippet ID should never refer to two different effects.
16     SkASSERT(!fDict.find(codeSnippetID) || (SkRuntimeEffectPriv::Hash(*fDict[codeSnippetID]) ==
17                                             SkRuntimeEffectPriv::Hash(*effect)));
18     fDict.set(codeSnippetID, std::move(effect));
19 }
20 
21 } // namespace skgpu::graphite
22