Flutter Engine
The Flutter Engine
PrecompileShaderPriv.h
Go to the documentation of this file.
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_PrecompileShaderPriv_DEFINED
9#define skgpu_graphite_PrecompileShaderPriv_DEFINED
10
12
13namespace skgpu::graphite {
14
15/** Class that exposes methods in PrecompileShader that are only intended for use internal to Skia.
16 This class is purely a privileged window into PrecompileShader. It should never have additional
17 data members or virtual methods. */
19public:
20 bool isConstant(int desiredCombination) const {
21 return fPrecompileShader->isConstant(desiredCombination);
22 }
23
24 bool isALocalMatrixShader() const {
25 return fPrecompileShader->isALocalMatrixShader();
26 }
27
28 // The remaining methods make this a viable standin for PrecompileBasePriv
29 int numChildCombinations() const { return fPrecompileShader->numChildCombinations(); }
30
31 int numCombinations() const { return fPrecompileShader->numCombinations(); }
32
33 void addToKey(const KeyContext& keyContext,
35 PipelineDataGatherer* gatherer,
36 int desiredCombination) const {
37 fPrecompileShader->addToKey(keyContext, builder, gatherer, desiredCombination);
38 }
39
40private:
41 friend class PrecompileShader; // to construct/copy this type.
42
43 explicit PrecompileShaderPriv(PrecompileShader* precompileShader)
44 : fPrecompileShader(precompileShader) {}
45
46 PrecompileShaderPriv& operator=(const PrecompileShaderPriv&) = delete;
47
48 // No taking addresses of this type.
49 const PrecompileShaderPriv* operator&() const;
51
52 PrecompileShader* fPrecompileShader;
53};
54
56
57// NOLINTNEXTLINE(readability-const-return-type)
59 return PrecompileShaderPriv(const_cast<PrecompileShader *>(this));
60}
61
62} // namespace skgpu::graphite
63
64#endif // skgpu_graphite_PrecompileShaderPriv_DEFINED
virtual int numChildCombinations() const
virtual void addToKey(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, int desiredCombination) const =0
void addToKey(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, int desiredCombination) const
bool isConstant(int desiredCombination) const
virtual bool isALocalMatrixShader() const
virtual bool isConstant(int) const
constexpr Mask< EnumType > operator&(const EnumType &lhs, const EnumType &rhs)
Definition: mask.h:139