/src/skia/src/gpu/graphite/precompile/PrecompileBaseComplete.h
Line | Count | Source (jump to first uncovered line) |
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 skgpu_graphite_precompile_PrecompileBaseComplete_DEFINED |
9 | | #define skgpu_graphite_precompile_PrecompileBaseComplete_DEFINED |
10 | | |
11 | | #include "include/gpu/graphite/precompile/PrecompileBase.h" |
12 | | |
13 | | // This file simply provides the missing implementations of SelectOption and AddToKey. |
14 | | // In practice PrecompileBase.h should never be used internally and this header should be |
15 | | // used in its place. |
16 | | namespace skgpu::graphite { |
17 | | |
18 | | template<typename T> |
19 | | std::pair<sk_sp<T>, int> PrecompileBase::SelectOption(SkSpan<const sk_sp<T>> options, |
20 | 0 | int desiredOption) { |
21 | 0 | for (const sk_sp<T>& option : options) { |
22 | 0 | if (desiredOption < (option ? option->numCombinations() : 1)) { |
23 | 0 | return { option, desiredOption }; |
24 | 0 | } |
25 | 0 | desiredOption -= option ? option->numCombinations() : 1; |
26 | 0 | } |
27 | 0 | return { nullptr, 0 }; |
28 | 0 | } Unexecuted instantiation: std::__1::pair<sk_sp<skgpu::graphite::PrecompileShader>, int> skgpu::graphite::PrecompileBase::SelectOption<skgpu::graphite::PrecompileShader>(SkSpan<sk_sp<skgpu::graphite::PrecompileShader> const>, int) Unexecuted instantiation: std::__1::pair<sk_sp<skgpu::graphite::PrecompileBlender>, int> skgpu::graphite::PrecompileBase::SelectOption<skgpu::graphite::PrecompileBlender>(SkSpan<sk_sp<skgpu::graphite::PrecompileBlender> const>, int) Unexecuted instantiation: std::__1::pair<sk_sp<skgpu::graphite::PrecompileColorFilter>, int> skgpu::graphite::PrecompileBase::SelectOption<skgpu::graphite::PrecompileColorFilter>(SkSpan<sk_sp<skgpu::graphite::PrecompileColorFilter> const>, int) Unexecuted instantiation: std::__1::pair<sk_sp<skgpu::graphite::PrecompileBase>, int> skgpu::graphite::PrecompileBase::SelectOption<skgpu::graphite::PrecompileBase>(SkSpan<sk_sp<skgpu::graphite::PrecompileBase> const>, int) |
29 | | |
30 | | template<typename T> |
31 | | void PrecompileBase::AddToKey(const KeyContext& keyContext, |
32 | | PaintParamsKeyBuilder* builder, |
33 | | PipelineDataGatherer* gatherer, |
34 | | SkSpan<const sk_sp<T>> options, |
35 | 0 | int desiredOption) { |
36 | 0 | auto [option, childOptions] = SelectOption(options, desiredOption); |
37 | 0 | if (option) { |
38 | 0 | option->priv().addToKey(keyContext, builder, gatherer, childOptions); |
39 | 0 | } |
40 | 0 | } Unexecuted instantiation: void skgpu::graphite::PrecompileBase::AddToKey<skgpu::graphite::PrecompileColorFilter>(skgpu::graphite::KeyContext const&, skgpu::graphite::PaintParamsKeyBuilder*, skgpu::graphite::PipelineDataGatherer*, SkSpan<sk_sp<skgpu::graphite::PrecompileColorFilter> const>, int) Unexecuted instantiation: void skgpu::graphite::PrecompileBase::AddToKey<skgpu::graphite::PrecompileShader>(skgpu::graphite::KeyContext const&, skgpu::graphite::PaintParamsKeyBuilder*, skgpu::graphite::PipelineDataGatherer*, SkSpan<sk_sp<skgpu::graphite::PrecompileShader> const>, int) |
41 | | |
42 | | } // namespace skgpu::graphite |
43 | | |
44 | | #endif // skgpu_graphite_precompile_PrecompileBaseComplete_DEFINED |