xref: /aosp_15_r20/external/skia/src/sksl/codegen/SkSLRasterPipelineCodeGenerator.h (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 #ifndef SKSL_RASTERPIPELINECODEGENERATOR
9 #define SKSL_RASTERPIPELINECODEGENERATOR
10 
11 #include "include/core/SkTypes.h"
12 #include <memory>
13 
14 namespace SkSL {
15 
16 class FunctionDefinition;
17 struct Program;
18 class DebugTracePriv;
19 namespace RP { class Program; }
20 
21 /**
22  * Convert 'function' to Raster Pipeline stages, for use by blends, shaders, and color filters.
23  * The arguments to the function are passed in registers:
24  *   -- coordinates in src.rg for shaders
25  *   -- color in src.rgba for color filters
26  *   -- src/dst in src.rgba and dst.rgba for blenders
27  *
28  * Design docs for SkSL in Raster Pipeline: go/sksl-rp
29  * https://docs.google.com/document/d/1GCQeAGVGHubOCbmULVdXUkNiXdw9J4umai_M5X3JGS4/edit?usp=sharing
30  */
31 std::unique_ptr<RP::Program> MakeRasterPipelineProgram(const Program& program,
32                                                        const FunctionDefinition& function,
33                                                        DebugTracePriv* debugTrace = nullptr,
34                                                        bool writeTraceOps = false);
35 
36 }  // namespace SkSL
37 
38 #endif
39