xref: /aosp_15_r20/external/skia/tools/graphite/UniqueKeyUtils.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2024 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 #ifndef UniqueKeyUtils_DEFINED
9 #define UniqueKeyUtils_DEFINED
10 
11 #include "include/core/SkTypes.h"
12 
13 #include <vector>
14 
15 namespace skgpu {
16     class UniqueKey;
17 }
18 
19 namespace skgpu::graphite {
20     class Context;
21     class GlobalCache;
22     class GraphicsPipelineDesc;
23     class PrecompileContext;
24     struct RenderPassDesc;
25     class RendererProvider;
26     class ShaderCodeDictionary;
27 }
28 
29 namespace UniqueKeyUtils {
30 
31 void FetchUniqueKeys(skgpu::graphite::PrecompileContext*,
32                      std::vector<skgpu::UniqueKey>* keys);
33 
34 #ifdef SK_DEBUG
35 void DumpDescs(skgpu::graphite::PrecompileContext*,
36                const skgpu::graphite::GraphicsPipelineDesc&,
37                const skgpu::graphite::RenderPassDesc&);
38 #endif
39 
40 // This helper breaks a UniqueKey down into its GraphicsPipelineDesc
41 // and a RenderPassDesc and checks that the reassembled pieces match the
42 // original.
43 bool ExtractKeyDescs(skgpu::graphite::PrecompileContext*,
44                      const skgpu::UniqueKey&,
45                      skgpu::graphite::GraphicsPipelineDesc*,
46                      skgpu::graphite::RenderPassDesc*);
47 
48 }  // namespace UniqueKeyUtils
49 
50 #endif  // UniqueKeyUtils_DEFINED
51