Revert "Centralize geometry processor vertex shader transform code"
This reverts commit 0426947243e1d6b470830c4d3b1c5704ed1f23e1.
Reason for revert: unblock chrome roller
Original change's description:
> Centralize geometry processor vertex shader transform code
>
> GrGLSLGeometryProcessors no longer have to call emitTransforms() in
> their onEmitCode() function. Instead, the GpArgs struct allows them to
> set a GrShaderVar that holds the computed or explicitly provided local
> coordinates in the vertex shader.
>
> The base GrGLSLGeometryProcessor now automatically uses that to collect
> all of the transforms that can then be lifted out of FPs to the vertex
> shader, and base their computation on the GP provided local coordinate.
>
> As part of this, there is no more built-in magic concatenation of a
> local matrix / inverse view matrix to these coordinate transforms. GP
> implementations that relied on this now manage their own uniform for this
> matrix and compute the local coordinate before assigning to GpArgs.
>
> The base GrGLSLGeometryProcessor is updated to provide helpers for this
> pattern.
>
> Bug: skia:10396
> Change-Id: I56afb3fff4b806f6015ab13626ac1afde9ef5c2b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297027
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
Change-Id: I203b7c72591d39b159e0405716fe8cdc28b083af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297917
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/tools/gpu/TestOps.cpp b/tools/gpu/TestOps.cpp
index 1ef7420..ff5201a 100644
--- a/tools/gpu/TestOps.cpp
+++ b/tools/gpu/TestOps.cpp
@@ -32,29 +32,26 @@
const char* name() const override { return "TestRectOp::GP"; }
- GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override {
- return new GLSLGP();
- }
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
- void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
- GLSLGP::GenKey(*this, b);
- }
+ void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
bool wideColor() const { return fInColor.cpuType() != kUByte4_norm_GrVertexAttribType; }
private:
+ Attribute fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
+ Attribute fInLocalCoords = {"inLocalCoords", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
+ Attribute fInColor;
+ SkMatrix fLocalMatrix;
+};
+
+GrGLSLPrimitiveProcessor* GP::createGLSLInstance(const GrShaderCaps& caps) const {
class GLSLGP : public GrGLSLGeometryProcessor {
- public:
void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& pp,
const CoordTransformRange& transformRange) override {
const auto& gp = pp.cast<GP>();
- this->setTransformDataHelper(pdman, transformRange);
- this->setTransform(pdman, fLocalMatrixUni, gp.fLocalMatrix);
- }
-
- static void GenKey(const GP& gp, GrProcessorKeyBuilder* b) {
- b->add32(ComputeMatrixKey(gp.fLocalMatrix));
+ this->setTransformDataHelper(gp.fLocalMatrix, pdman, transformRange);
}
private:
@@ -68,19 +65,13 @@
args.fFragBuilder->codeAppendf("%s = %s;", args.fOutputColor, colorVarying.fsIn());
args.fFragBuilder->codeAppendf("%s = half4(1);", args.fOutputCoverage);
this->writeOutputPosition(args.fVertBuilder, gpArgs, gp.fInPosition.name());
- this->writeLocalCoord(args.fVertBuilder, args.fUniformHandler, gpArgs,
- gp.fInLocalCoords.asShaderVar(), gp.fLocalMatrix,
- &fLocalMatrixUni);
+ this->emitTransforms(args.fVertBuilder, args.fVaryingHandler, args.fUniformHandler,
+ gp.fInLocalCoords.asShaderVar(), gp.fLocalMatrix,
+ args.fFPCoordTransformHandler);
}
-
- UniformHandle fLocalMatrixUni;
};
-
- Attribute fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
- Attribute fInLocalCoords = {"inLocalCoords", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
- Attribute fInColor;
- SkMatrix fLocalMatrix;
-};
+ return new GLSLGP();
+}
class TestRectOp final : public GrMeshDrawOp {
public: