aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-12-22 15:27:05 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-22 15:27:05 -0800
commit8fc6c2d82c1f30ff82274334c01f0799def6a609 (patch)
tree6499d32fd02b524167a690704d855e804f66c8a3 /src/gpu/gl/builders
parent16c8f14cd481b78673a33450a1395958e3e10e62 (diff)
This CL cleans up the last remaining users of localCoordChange on paint
NOTREECHECKS=True BUG=skia: Review URL: https://codereview.chromium.org/817853002
Diffstat (limited to 'src/gpu/gl/builders')
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index cfb1d38b61..13a14534cf 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -378,8 +378,22 @@ void GrGLProgramBuilder::emitTransforms(const GrPendingFragmentStage& stage,
for (int t = 0; t < numTransforms; t++) {
const char* uniName = "StageMatrix";
- GrSLType varyingType = stage.isPerspectiveCoordTransform(t) ? kVec3f_GrSLType :
- kVec2f_GrSLType;
+ GrSLType varyingType;
+
+ // TODO when we have deleted the coord change matrices we can get rid of the below check
+ GrCoordSet coordType = processor->coordTransform(t).sourceCoords();
+ const SkMatrix& localMatrix = fOptState.getPrimitiveProcessor()->localMatrix();
+ if (localMatrix.isIdentity()) {
+ varyingType = stage.isPerspectiveCoordTransform(t) ? kVec3f_GrSLType :
+ kVec2f_GrSLType;
+ } else {
+ uint32_t type = processor->coordTransform(t).getMatrix().getType();
+ if (kLocal_GrCoordSet == coordType) {
+ type |= localMatrix.getType();
+ }
+ varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kVec3f_GrSLType :
+ kVec2f_GrSLType;
+ }
GrSLPrecision precision = processor->coordTransform(t).precision();
SkString suffixedUniName;
@@ -401,7 +415,6 @@ void GrGLProgramBuilder::emitTransforms(const GrPendingFragmentStage& stage,
varyingName = suffixedVaryingName.c_str();
}
- GrCoordSet coordType = processor->coordTransform(t).sourceCoords();
GrGLVertToFrag v(varyingType);
this->addVarying(varyingName, &v, precision);
fCoordVaryings.push_back(TransformVarying(v, uniName, coordType));