xref: /aosp_15_r20/external/skia/src/gpu/graphite/render/TessellateCurvesRenderStep.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_TessellateCurvesRenderStep_DEFINED
9 #define skgpu_graphite_render_TessellateCurvesRenderStep_DEFINED
10 
11 #include "src/base/SkVx.h"
12 #include "src/gpu/graphite/Renderer.h"
13 #include "src/gpu/graphite/ResourceTypes.h"
14 #include <string>
15 
16 namespace skgpu::graphite {
17 
18 class DrawParams;
19 class DrawWriter;
20 class PipelineDataGatherer;
21 class StaticBufferManager;
22 
23 class TessellateCurvesRenderStep final : public RenderStep {
24 public:
25     // TODO: If this takes DepthStencilSettings directly and a way to adjust the flags to specify
26     // that it performs shading, this RenderStep definition can be shared between the stencil and
27     // the convex rendering variants.
28     TessellateCurvesRenderStep(bool evenOdd,
29                                bool infinitySupport,
30                                StaticBufferManager* bufferManager);
31 
32     ~TessellateCurvesRenderStep() override;
33 
34     std::string vertexSkSL() const override;
35     void writeVertices(DrawWriter*, const DrawParams&, skvx::uint2 ssboIndices) const override;
36     void writeUniformsAndTextures(const DrawParams&, PipelineDataGatherer*) const override;
37 
38 private:
39     // Points to the static buffers holding the fixed indexed vertex template for drawing instances.
40     BindBufferInfo fVertexBuffer;
41     BindBufferInfo fIndexBuffer;
42     bool fInfinitySupport;
43 };
44 
45 }  // namespace skgpu::graphite
46 
47 #endif // skgpu_graphite_render_TessellateCurvesRenderStep_DEFINED
48