[graphite] Add shell for TessellateStrokeRenderStep

Bug: skia:12703
Change-Id: I9cc44db555a7bb03e4afeaedac4052c796349c5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540621
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Michael Ludwig 2022-05-20 20:05:42 -04:00 committed by SkCQ
parent 193c16380f
commit 86323276b2
4 changed files with 113 additions and 0 deletions

View File

@ -122,6 +122,8 @@ skia_graphite_sources = [
"$_src/render/StencilAndFillPathRenderer.cpp",
"$_src/render/TessellateCurvesRenderStep.cpp",
"$_src/render/TessellateCurvesRenderStep.h",
"$_src/render/TessellateStrokesRenderStep.cpp",
"$_src/render/TessellateStrokesRenderStep.h",
"$_src/render/TessellateWedgesRenderStep.cpp",
"$_src/render/TessellateWedgesRenderStep.h",
]

View File

@ -122,3 +122,22 @@ generated_cc_atom(
"//src/gpu/tessellate:LinearTolerances_hdr",
],
)
generated_cc_atom(
name = "TessellateStrokesRenderStep_hdr",
hdrs = ["TessellateStrokesRenderStep.h"],
visibility = ["//:__subpackages__"],
deps = ["//src/gpu/graphite:Renderer_hdr"],
)
generated_cc_atom(
name = "TessellateStrokesRenderStep_src",
srcs = ["TessellateStrokesRenderStep.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":TessellateStrokesRenderStep_hdr",
"//src/gpu/graphite:DrawGeometry_hdr",
"//src/gpu/graphite:DrawTypes_hdr",
"//src/gpu/graphite:DrawWriter_hdr",
],
)

View File

@ -0,0 +1,61 @@
/*
* Copyright 2022 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/gpu/graphite/render/TessellateStrokesRenderStep.h"
#include "src/gpu/graphite/DrawGeometry.h"
#include "src/gpu/graphite/DrawTypes.h"
#include "src/gpu/graphite/DrawWriter.h"
namespace skgpu::graphite {
namespace {
// TODO: De-duplicate with the same settings that's currently used for convex path rendering
// in StencilAndFillPathRenderer.cpp
static constexpr DepthStencilSettings kDirectShadingPass = {
/*frontStencil=*/{},
/*backStencil=*/ {},
/*refValue=*/ 0,
/*stencilTest=*/ false,
/*depthCompare=*/CompareOp::kGreater,
/*depthTest=*/ true,
/*depthWrite=*/ true
};
} // namespace
// TODO: specify attributes and uniforms
TessellateStrokesRenderStep::TessellateStrokesRenderStep()
: RenderStep("TessellateStrokeRenderStep",
"",
Flags::kRequiresMSAA,
/*uniforms=*/{},
PrimitiveType::kTriangleStrip,
kDirectShadingPass,
/*vertexAttrs=*/ {},
/*instanceAttrs=*/{}) {}
TessellateStrokesRenderStep::~TessellateStrokesRenderStep() {}
const char* TessellateStrokesRenderStep::vertexSkSL() const {
SkASSERT(false);
return ""; // TODO: implement this
}
void TessellateStrokesRenderStep::writeVertices(DrawWriter* dw, const DrawGeometry& geom) const {
// TODO: implement this
}
void TessellateStrokesRenderStep::writeUniforms(const DrawGeometry&,
SkPipelineDataGatherer*) const {
// TODO: implement this
}
} // namespace skgpu::graphite

View File

@ -0,0 +1,31 @@
/*
* Copyright 2022 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef skgpu_graphite_render_TessellateStrokesRenderStep_DEFINED
#define skgpu_graphite_render_TessellateStrokesRenderStep_DEFINED
#include "src/gpu/graphite/Renderer.h"
namespace skgpu::graphite {
class TessellateStrokesRenderStep final : public RenderStep {
public:
// TODO: If this takes DepthStencilSettings directly and a way to adjust the flags to specify
// that it performs shading, this RenderStep definition could be used to handle inverse-filled
// stroke draws.
TessellateStrokesRenderStep();
~TessellateStrokesRenderStep() override;
const char* vertexSkSL() const override;
void writeVertices(DrawWriter*, const DrawGeometry&) const override;
void writeUniforms(const DrawGeometry&, SkPipelineDataGatherer*) const override;
};
} // namespace skgpu::graphite
#endif // skgpu_graphite_render_TessellateStrokesRenderStep_DEFINED