Make GrGLSLPrimitiveProcessor::emitTransforms take local coords as GrShaderVar.
Also remove unused position variable parameter.
Change-Id: I37f98a03ac1ca750810de13b08e3ffa11e41828c
Reviewed-on: https://skia-review.googlesource.com/81320
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index 8ee9bbd..01322ed 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -43,10 +43,12 @@
void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb,
GrGLSLVaryingHandler* varyingHandler,
GrGLSLUniformHandler* uniformHandler,
- const GrShaderVar& posVar,
- const char* localCoords,
+ const GrShaderVar& localCoordsVar,
const SkMatrix& localMatrix,
FPCoordTransformHandler* handler) {
+ SkASSERT(GrSLTypeIsFloatType(localCoordsVar.getType()));
+ SkASSERT(2 == GrSLTypeVecLength(localCoordsVar.getType()));
+
int i = 0;
while (const GrCoordTransform* coordTransform = handler->nextCoordTransform()) {
SkString strUniName;
@@ -75,9 +77,10 @@
handler->specifyCoordsForCurrCoordTransform(SkString(v.fsIn()), varyingType);
if (kFloat2_GrSLType == varyingType) {
- vb->codeAppendf("%s = (%s * float3(%s, 1)).xy;", v.vsOut(), uniName, localCoords);
+ vb->codeAppendf("%s = (%s * float3(%s, 1)).xy;", v.vsOut(), uniName,
+ localCoordsVar.c_str());
} else {
- vb->codeAppendf("%s = %s * float3(%s, 1);", v.vsOut(), uniName, localCoords);
+ vb->codeAppendf("%s = %s * float3(%s, 1);", v.vsOut(), uniName, localCoordsVar.c_str());
}
++i;
}