[graphite] Standardize RenderStep naming
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite Bug: skia:12703 Change-Id: I8c2809aeddf50a7b77bc3e7583b22475fce15330 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522920 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
c88d96f890
commit
3e34e5e9d3
@ -20,6 +20,8 @@
|
||||
|
||||
#include <array>
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
struct SkIRect;
|
||||
@ -61,7 +63,9 @@ public:
|
||||
const Transform&,
|
||||
const Shape&) const = 0;
|
||||
|
||||
virtual const char* name() const = 0;
|
||||
// Returns a name formatted as "Subclass[variant]", where "Subclass" matches the C++ class name
|
||||
// and variant is a unique term describing instance's specific configuration.
|
||||
const char* name() const { return fName.c_str(); }
|
||||
|
||||
// TODO: This is only temporary. Eventually the RenderStep will define its logic in SkSL and
|
||||
// be able to have code operate in both the vertex and fragment shaders. Ideally the RenderStep
|
||||
@ -124,7 +128,9 @@ protected:
|
||||
// While RenderStep does not define the full program that's run for a draw, it defines the
|
||||
// entire vertex layout of the pipeline. This is not allowed to change, so can be provided to
|
||||
// the RenderStep constructor by subclasses.
|
||||
RenderStep(Mask<Flags> flags,
|
||||
RenderStep(std::string_view className,
|
||||
std::string_view variantName,
|
||||
Mask<Flags> flags,
|
||||
std::initializer_list<SkUniform> uniforms,
|
||||
PrimitiveType primitiveType,
|
||||
DepthStencilSettings depthStencilSettings,
|
||||
@ -137,13 +143,19 @@ protected:
|
||||
, fVertexAttrs(vertexAttrs)
|
||||
, fInstanceAttrs(instanceAttrs)
|
||||
, fVertexStride(0)
|
||||
, fInstanceStride(0) {
|
||||
, fInstanceStride(0)
|
||||
, fName(className) {
|
||||
for (auto v : this->vertexAttributes()) {
|
||||
fVertexStride += v.sizeAlign4();
|
||||
}
|
||||
for (auto i : this->instanceAttributes()) {
|
||||
fInstanceStride += i.sizeAlign4();
|
||||
}
|
||||
if (variantName.size() > 0) {
|
||||
fName += "[";
|
||||
fName += variantName;
|
||||
fName += "]";
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -168,6 +180,8 @@ private:
|
||||
|
||||
size_t fVertexStride; // derived from vertex attribute set
|
||||
size_t fInstanceStride; // derived from instance attribute set
|
||||
|
||||
std::string fName;
|
||||
};
|
||||
SKGPU_MAKE_MASK_OPS(RenderStep::Flags);
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
namespace skgpu {
|
||||
|
||||
CoverBoundsRenderStep::CoverBoundsRenderStep(bool inverseFill)
|
||||
: RenderStep(Flags::kPerformsShading,
|
||||
: RenderStep("CoverBoundsRenderStep",
|
||||
inverseFill ? "inverse" : "regular",
|
||||
Flags::kPerformsShading,
|
||||
/*uniforms=*/{},
|
||||
PrimitiveType::kTriangles,
|
||||
inverseFill ? kInverseCoverPass : kRegularCoverPass,
|
||||
|
@ -18,8 +18,6 @@ public:
|
||||
|
||||
~CoverBoundsRenderStep() override;
|
||||
|
||||
const char* name() const override { return "CoverBoundsRenderStep"; }
|
||||
|
||||
const char* vertexSkSL() const override;
|
||||
void writeVertices(DrawWriter*,
|
||||
const SkIRect&,
|
||||
|
@ -18,7 +18,9 @@
|
||||
namespace skgpu {
|
||||
|
||||
MiddleOutFanRenderStep::MiddleOutFanRenderStep(bool evenOdd)
|
||||
: RenderStep(Flags::kRequiresMSAA,
|
||||
: RenderStep("MiddleOutFanRenderStep",
|
||||
evenOdd ? "even-odd" : "winding",
|
||||
Flags::kRequiresMSAA,
|
||||
/*uniforms=*/{},
|
||||
PrimitiveType::kTriangles,
|
||||
evenOdd ? kEvenOddStencilPass : kWindingStencilPass,
|
||||
|
@ -21,8 +21,6 @@ public:
|
||||
|
||||
~MiddleOutFanRenderStep() override;
|
||||
|
||||
const char* name() const override { return "MiddleOutFanRenderStep"; }
|
||||
|
||||
const char* vertexSkSL() const override;
|
||||
void writeVertices(DrawWriter*,
|
||||
const SkIRect&,
|
||||
|
@ -69,7 +69,9 @@ size_t fixed_index_buffer_size() {
|
||||
} // namespace
|
||||
|
||||
TessellateCurvesRenderStep::TessellateCurvesRenderStep(bool evenOdd)
|
||||
: RenderStep(Flags::kRequiresMSAA,
|
||||
: RenderStep("TessellateCurvesRenderStep",
|
||||
evenOdd ? "even-odd" : "winding",
|
||||
Flags::kRequiresMSAA,
|
||||
/*uniforms=*/{},
|
||||
PrimitiveType::kTriangles,
|
||||
evenOdd ? kEvenOddStencilPass : kWindingStencilPass,
|
||||
|
@ -21,8 +21,6 @@ public:
|
||||
|
||||
~TessellateCurvesRenderStep() override;
|
||||
|
||||
const char* name() const override { return "TessellateCurvesRenderStep"; }
|
||||
|
||||
const char* vertexSkSL() const override;
|
||||
void writeVertices(DrawWriter*,
|
||||
const SkIRect&,
|
||||
|
@ -68,7 +68,9 @@ size_t fixed_index_buffer_size() {
|
||||
} // namespace
|
||||
|
||||
TessellateWedgesRenderStep::TessellateWedgesRenderStep(bool evenOdd)
|
||||
: RenderStep(Flags::kRequiresMSAA,
|
||||
: RenderStep("TessellateWedgesRenderStep",
|
||||
evenOdd ? "even-odd" : "winding",
|
||||
Flags::kRequiresMSAA,
|
||||
/*uniforms=*/{},
|
||||
PrimitiveType::kTriangles,
|
||||
evenOdd ? kEvenOddStencilPass : kWindingStencilPass,
|
||||
|
@ -21,8 +21,6 @@ public:
|
||||
|
||||
~TessellateWedgesRenderStep() override;
|
||||
|
||||
const char* name() const override { return "TessellateWedgesRenderStep"; }
|
||||
|
||||
const char* vertexSkSL() const override;
|
||||
void writeVertices(DrawWriter*,
|
||||
const SkIRect&,
|
||||
|
@ -63,8 +63,6 @@ public:
|
||||
return &kSingleton;
|
||||
}
|
||||
|
||||
const char* name() const override { return "uniform-rect"; }
|
||||
|
||||
const char* vertexSkSL() const override {
|
||||
return "float2 tmpPosition = float2(float(sk_VertexID >> 1), float(sk_VertexID & 1));\n"
|
||||
"float4 devPosition = float4(tmpPosition * scale + translate, 0.0, 1.0);\n";
|
||||
@ -94,7 +92,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
UniformRectDraw() : RenderStep(Flags::kPerformsShading,
|
||||
UniformRectDraw() : RenderStep("UniformRectDraw", "test-only",
|
||||
Flags::kPerformsShading,
|
||||
/*uniforms=*/{{"scale", SkSLType::kFloat2},
|
||||
{"translate", SkSLType::kFloat2}},
|
||||
PrimitiveType::kTriangleStrip,
|
||||
@ -118,8 +117,6 @@ public:
|
||||
return &kSingleton;
|
||||
}
|
||||
|
||||
const char* name() const override { return "triangle-rect"; }
|
||||
|
||||
const char* vertexSkSL() const override {
|
||||
return "float4 devPosition = float4(position * scale + translate, 0.0, 1.0);\n";
|
||||
}
|
||||
@ -155,7 +152,8 @@ public:
|
||||
|
||||
private:
|
||||
TriangleRectDraw()
|
||||
: RenderStep(Flags::kPerformsShading,
|
||||
: RenderStep("TriangleRectDraw", "test-only",
|
||||
Flags::kPerformsShading,
|
||||
/*uniforms=*/{{"scale", SkSLType::kFloat2},
|
||||
{"translate", SkSLType::kFloat2}},
|
||||
PrimitiveType::kTriangles,
|
||||
@ -175,8 +173,6 @@ public:
|
||||
return &kSingleton;
|
||||
}
|
||||
|
||||
const char* name() const override { return "instance-rect"; }
|
||||
|
||||
const char* vertexSkSL() const override {
|
||||
return "float2 tmpPosition = float2(float(sk_VertexID >> 1), float(sk_VertexID & 1));\n"
|
||||
"float4 devPosition = float4(tmpPosition * dims + position, 0.0, 1.0);\n";
|
||||
@ -209,7 +205,8 @@ public:
|
||||
|
||||
private:
|
||||
InstanceRectDraw()
|
||||
: RenderStep(Flags::kPerformsShading,
|
||||
: RenderStep("InstanceRectDraw", "test-only",
|
||||
Flags::kPerformsShading,
|
||||
/*uniforms=*/{},
|
||||
PrimitiveType::kTriangles,
|
||||
kTestDepthStencilSettings,
|
||||
|
Loading…
Reference in New Issue
Block a user