| 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_PrecompileShadersPriv_DEFINED |
| 9 |
#define skgpu_graphite_precompile_PrecompileShadersPriv_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkRefCnt.h" |
| 12 |
#include "src/base/SkEnumBitMask.h" |
| 13 |
#include "src/gpu/graphite/precompile/PaintOptionsPriv.h" |
| 14 |
|
| 15 |
namespace skgpu::graphite { |
| 16 |
|
| 17 |
class PrecompileShader; |
| 18 |
|
| 19 |
//-------------------------------------------------------------------------------------------------- |
| 20 |
namespace PrecompileShadersPriv { |
| 21 |
// -- The first 6 factories are used to implement ImageFilters |
| 22 |
sk_sp<PrecompileShader> Blur(sk_sp<PrecompileShader> wrapped); |
| 23 |
|
| 24 |
sk_sp<PrecompileShader> Displacement(sk_sp<PrecompileShader> displacement, |
| 25 |
sk_sp<PrecompileShader> color); |
| 26 |
|
| 27 |
sk_sp<PrecompileShader> Lighting(sk_sp<PrecompileShader> wrapped); |
| 28 |
|
| 29 |
sk_sp<PrecompileShader> MatrixConvolution(sk_sp<PrecompileShader> wrapped); |
| 30 |
|
| 31 |
sk_sp<PrecompileShader> LinearMorphology(sk_sp<PrecompileShader> wrapped); |
| 32 |
|
| 33 |
sk_sp<PrecompileShader> SparseMorphology(sk_sp<PrecompileShader> wrapped); |
| 34 |
|
| 35 |
// TODO: This, technically, doesn't need to take an SkSpan since it is only called from |
| 36 |
// PaintOptions::setClipShaders with a single PrecompileShader. Leaving it be for now in case |
| 37 |
// the usage is revised. |
| 38 |
sk_sp<PrecompileShader> CTM(SkSpan<const sk_sp<PrecompileShader>> wrapped); |
| 39 |
|
| 40 |
// This factory variant should be used when the existence or non-existence of the local matrix |
| 41 |
// is known. If 'withLM' is true only the LMShader-wrapped shader will be created while, when |
| 42 |
// 'withLM' is false, no LMShader will wrap the base shader. |
| 43 |
sk_sp<PrecompileShader> Picture(bool withLM); |
| 44 |
|
| 45 |
// TODO: this factory function should go away (it is only used by the PrecompileShaders::Picture |
| 46 |
// entry point now). |
| 47 |
sk_sp<PrecompileShader> LocalMatrixBothVariants(SkSpan<const sk_sp<PrecompileShader>> wrapped); |
| 48 |
|
| 49 |
} // namespace PrecompileShadersPriv |
| 50 |
|
| 51 |
} // namespace skgpu::graphite |
| 52 |
|
| 53 |
#endif // skgpu_graphite_precompile_PrecompileShadersPriv_DEFINED |