xref: /aosp_15_r20/external/skia/src/gpu/graphite/render/VerticesRenderStep.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 skgpu_graphite_render_VerticesRenderStep_DEFINED
9 #define skgpu_graphite_render_VerticesRenderStep_DEFINED
10 
11 #include "src/base/SkVx.h"
12 #include "src/gpu/graphite/Renderer.h"
13 
14 #include <cstdint>
15 #include <string>
16 
17 namespace skgpu::graphite {
18 
19 class DrawParams;
20 class DrawWriter;
21 class PipelineDataGatherer;
22 enum class PrimitiveType : uint8_t;
23 
24 class VerticesRenderStep final : public RenderStep {
25 public:
26     explicit VerticesRenderStep(PrimitiveType, bool hasColor, bool hasTexCoords);
27 
28     ~VerticesRenderStep() override;
29 
30     std::string vertexSkSL() const override;
31     void writeVertices(DrawWriter* writer,
32                        const DrawParams& params,
33                        skvx::uint2 ssboIndices) const override;
34     void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
35     const char* fragmentColorSkSL() const override;
36 
37 private:
38     const bool fHasColor;
39     const bool fHasTexCoords;
40 };
41 
42 }  // namespace skgpu::graphite
43 
44 #endif // skgpu_graphite_render_VerticesRenderStep_DEFINED
45