Remove uniform view matrix from GrGLPrimitiveProcessor base class

BUG=skia:

Review URL: https://codereview.chromium.org/1151693005
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 6e2ea06..a72c880 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -55,7 +55,7 @@
     class GLProcessor : public GrGLGeometryProcessor {
     public:
         GLProcessor(const GrGeometryProcessor& gp, const GrBatchTracker&)
-            : fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
+            : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverage(0xff) {}
 
         void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
             const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
@@ -76,7 +76,8 @@
             }
 
             // Setup position
-            this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
+            this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(),
+                                &fViewMatrixUniform);
 
             if (gp.inLocalCoords()) {
                 // emit transforms with explicit local coords
@@ -128,7 +129,13 @@
                              const GrPrimitiveProcessor& gp,
                              const GrBatchTracker& bt) override {
             const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
-            this->setUniformViewMatrix(pdman, dgp.viewMatrix());
+
+            if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
+                fViewMatrix = dgp.viewMatrix();
+                GrGLfloat viewMatrix[3 * 3];
+                GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+                pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+            }
 
             if (dgp.color() != fColor && !dgp.hasVertexColor()) {
                 GrGLfloat c[4];
@@ -151,8 +158,10 @@
         }
 
     private:
+        SkMatrix fViewMatrix;
         GrColor fColor;
         uint8_t fCoverage;
+        UniformHandle fViewMatrixUniform;
         UniformHandle fColorUniform;
         UniformHandle fCoverageUniform;
 
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 5c231bd..112c344 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -434,7 +434,7 @@
     public:
         GLProcessor(const GrGeometryProcessor&,
                     const GrBatchTracker&)
-            : fColor(GrColor_ILLEGAL) {}
+            : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {}
 
         void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
             const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>();
@@ -460,7 +460,8 @@
             }
 
             // Setup position
-            this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatrix());
+            this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatrix(),
+                                &fViewMatrixUniform);
 
             // emit transforms
             this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition()->fName,
@@ -522,7 +523,13 @@
                              const GrPrimitiveProcessor& gp,
                              const GrBatchTracker& bt) override {
             const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
-            this->setUniformViewMatrix(pdman, dee.viewMatrix());
+
+            if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee.viewMatrix())) {
+                fViewMatrix = dee.viewMatrix();
+                GrGLfloat viewMatrix[3 * 3];
+                GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+                pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+            }
 
             if (dee.color() != fColor) {
                 GrGLfloat c[4];
@@ -533,8 +540,10 @@
         }
 
     private:
+        SkMatrix fViewMatrix;
         GrColor fColor;
         UniformHandle fColorUniform;
+        UniformHandle fViewMatrixUniform;
 
         typedef GrGLGeometryProcessor INHERITED;
     };
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 840645e..078bc00 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -28,7 +28,13 @@
                          const GrPrimitiveProcessor& primProc,
                          const GrBatchTracker& bt) override {
         const GrConicEffect& ce = primProc.cast<GrConicEffect>();
-        this->setUniformViewMatrix(pdman, ce.viewMatrix());
+
+        if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
+            fViewMatrix = ce.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
         if (ce.color() != fColor) {
             GrGLfloat c[4];
@@ -51,18 +57,20 @@
     }
 
 private:
+    SkMatrix fViewMatrix;
     GrColor fColor;
     uint8_t fCoverageScale;
     GrPrimitiveEdgeType fEdgeType;
     UniformHandle fColorUniform;
     UniformHandle fCoverageScaleUniform;
+    UniformHandle fViewMatrixUniform;
 
     typedef GrGLGeometryProcessor INHERITED;
 };
 
 GrGLConicEffect::GrGLConicEffect(const GrGeometryProcessor& processor,
                                  const GrBatchTracker& bt)
-    : fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
+    : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
     const GrConicEffect& ce = processor.cast<GrConicEffect>();
     fEdgeType = ce.getEdgeType();
 }
@@ -85,7 +93,7 @@
     }
 
     // Setup position
-    this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
+    this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fViewMatrixUniform);
 
     // emit transforms with position
     this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
@@ -245,7 +253,13 @@
                          const GrPrimitiveProcessor& primProc,
                          const GrBatchTracker& bt) override {
         const GrQuadEffect& qe = primProc.cast<GrQuadEffect>();
-        this->setUniformViewMatrix(pdman, qe.viewMatrix());
+
+        if (!qe.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(qe.viewMatrix())) {
+            fViewMatrix = qe.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
         if (qe.color() != fColor) {
             GrGLfloat c[4];
@@ -268,18 +282,20 @@
     }
 
 private:
+    SkMatrix fViewMatrix;
     GrColor fColor;
     uint8_t fCoverageScale;
     GrPrimitiveEdgeType fEdgeType;
     UniformHandle fColorUniform;
     UniformHandle fCoverageScaleUniform;
+    UniformHandle fViewMatrixUniform;
 
     typedef GrGLGeometryProcessor INHERITED;
 };
 
 GrGLQuadEffect::GrGLQuadEffect(const GrGeometryProcessor& processor,
                                const GrBatchTracker& bt)
-    : fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
+    : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL), fCoverageScale(0xff) {
     const GrQuadEffect& ce = processor.cast<GrQuadEffect>();
     fEdgeType = ce.getEdgeType();
 }
@@ -302,7 +318,7 @@
     }
 
     // Setup position
-    this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
+    this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(), &fViewMatrixUniform);
 
     // emit transforms with position
     this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
@@ -449,7 +465,13 @@
                          const GrPrimitiveProcessor& primProc,
                          const GrBatchTracker& bt) override {
         const GrCubicEffect& ce = primProc.cast<GrCubicEffect>();
-        this->setUniformViewMatrix(pdman, ce.viewMatrix());
+
+        if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
+            fViewMatrix = ce.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
         if (ce.color() != fColor) {
             GrGLfloat c[4];
@@ -460,16 +482,18 @@
     }
 
 private:
+    SkMatrix fViewMatrix;
     GrColor fColor;
     GrPrimitiveEdgeType fEdgeType;
     UniformHandle fColorUniform;
+    UniformHandle fViewMatrixUniform;
 
     typedef GrGLGeometryProcessor INHERITED;
 };
 
 GrGLCubicEffect::GrGLCubicEffect(const GrGeometryProcessor& processor,
                                  const GrBatchTracker&)
-    : fColor(GrColor_ILLEGAL) {
+    : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
     const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
     fEdgeType = ce.getEdgeType();
 }
@@ -491,7 +515,8 @@
     }
 
     // Setup position
-    this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix());
+    this->setupPosition(args.fPB, gpArgs, gp.inPosition()->fName, gp.viewMatrix(),
+                        &fViewMatrixUniform);
 
     // emit transforms with position
     this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, args.fTransformsIn,
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 92fe0a4..2bb929b 100755
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -25,7 +25,8 @@
 public:
     GrGLDistanceFieldA8TextGeoProc(const GrGeometryProcessor&,
                                    const GrBatchTracker&)
-        : fColor(GrColor_ILLEGAL)
+        : fViewMatrix(SkMatrix::InvalidMatrix())
+        , fColor(GrColor_ILLEGAL)
 #ifdef SK_GAMMA_APPLY_TO_A8
         , fDistanceAdjust(-1.0f)
 #endif
@@ -63,7 +64,8 @@
         }
 
         // Setup position
-        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix());
+        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix(),
+                            &fViewMatrixUniform);
 
         // emit transforms
         this->emitTransforms(args.fPB, gpArgs->fPositionVar, dfTexEffect.inPosition()->fName,
@@ -148,9 +150,14 @@
             fDistanceAdjust = distanceAdjust;
         }
 #endif
-
         const GrDistanceFieldA8TextGeoProc& dfa8gp = proc.cast<GrDistanceFieldA8TextGeoProc>();
-        this->setUniformViewMatrix(pdman, dfa8gp.viewMatrix());
+
+        if (!dfa8gp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfa8gp.viewMatrix())) {
+            fViewMatrix = dfa8gp.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
         if (dfa8gp.color() != fColor && !dfa8gp.hasVertexColor()) {
             GrGLfloat c[4];
@@ -173,8 +180,10 @@
     }
 
 private:
+    SkMatrix      fViewMatrix;
     GrColor       fColor;
     UniformHandle fColorUniform;
+    UniformHandle fViewMatrixUniform;
 #ifdef SK_GAMMA_APPLY_TO_A8
     float         fDistanceAdjust;
     UniformHandle fDistanceAdjustUni;
@@ -266,7 +275,9 @@
 public:
     GrGLDistanceFieldPathGeoProc(const GrGeometryProcessor&,
                                           const GrBatchTracker&)
-        : fColor(GrColor_ILLEGAL), fTextureSize(SkISize::Make(-1, -1)) {}
+        : fViewMatrix(SkMatrix::InvalidMatrix())
+        , fColor(GrColor_ILLEGAL)
+        , fTextureSize(SkISize::Make(-1, -1)) {}
 
     void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
         const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistanceFieldPathGeoProc>();
@@ -295,7 +306,8 @@
         vsBuilder->codeAppendf("%s = %s;", v.vsOut(), dfTexEffect.inTextureCoords()->fName);
 
         // Setup position
-        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix());
+        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix(),
+                            &fViewMatrixUniform);
 
         // emit transforms
         this->emitTransforms(args.fPB, gpArgs->fPositionVar, dfTexEffect.inPosition()->fName,
@@ -372,7 +384,13 @@
         }
 
         const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathGeoProc>();
-        this->setUniformViewMatrix(pdman, dfpgp.viewMatrix());
+
+        if (!dfpgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfpgp.viewMatrix())) {
+            fViewMatrix = dfpgp.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
         if (dfpgp.color() != fColor) {
             GrGLfloat c[4];
@@ -398,6 +416,8 @@
 private:
     UniformHandle fColorUniform;
     UniformHandle fTextureSizeUni;
+    UniformHandle fViewMatrixUniform;
+    SkMatrix      fViewMatrix;
     GrColor       fColor;
     SkISize       fTextureSize;
 
@@ -478,7 +498,7 @@
 class GrGLDistanceFieldLCDTextGeoProc : public GrGLGeometryProcessor {
 public:
     GrGLDistanceFieldLCDTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&)
-        : fColor(GrColor_ILLEGAL) {
+        : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {
         fDistanceAdjust = GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(1.0f, 1.0f, 1.0f);
     }
 
@@ -498,7 +518,8 @@
         }
 
         // Setup position
-        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix());
+        this->setupPosition(pb, gpArgs, dfTexEffect.inPosition()->fName, dfTexEffect.viewMatrix(),
+                            &fViewMatrixUniform);
 
         // emit transforms
         this->emitTransforms(args.fPB, gpArgs->fPositionVar, dfTexEffect.inPosition()->fName,
@@ -619,9 +640,8 @@
                          const GrBatchTracker& bt) override {
         SkASSERT(fDistanceAdjustUni.isValid());
 
-        const GrDistanceFieldLCDTextGeoProc& dfTexEffect =
-                processor.cast<GrDistanceFieldLCDTextGeoProc>();
-        GrDistanceFieldLCDTextGeoProc::DistanceAdjust wa = dfTexEffect.getDistanceAdjust();
+        const GrDistanceFieldLCDTextGeoProc& dflcd = processor.cast<GrDistanceFieldLCDTextGeoProc>();
+        GrDistanceFieldLCDTextGeoProc::DistanceAdjust wa = dflcd.getDistanceAdjust();
         if (wa != fDistanceAdjust) {
             pdman.set3f(fDistanceAdjustUni,
                         wa.fR,
@@ -630,13 +650,18 @@
             fDistanceAdjust = wa;
         }
 
-        this->setUniformViewMatrix(pdman, dfTexEffect.viewMatrix());
+        if (!dflcd.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dflcd.viewMatrix())) {
+            fViewMatrix = dflcd.viewMatrix();
+            GrGLfloat viewMatrix[3 * 3];
+            GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+            pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+        }
 
-        if (dfTexEffect.color() != fColor) {
+        if (dflcd.color() != fColor) {
             GrGLfloat c[4];
-            GrColorToRGBAFloat(dfTexEffect.color(), c);
+            GrColorToRGBAFloat(dflcd.color(), c);
             pdman.set4fv(fColorUniform, 1, c);
-            fColor = dfTexEffect.color();
+            fColor = dflcd.color();
         }
     }
 
@@ -653,7 +678,9 @@
     }
 
 private:
+    SkMatrix                                     fViewMatrix;
     GrColor                                      fColor;
+    UniformHandle                                fViewMatrixUniform;
     UniformHandle                                fColorUniform;
     GrDistanceFieldLCDTextGeoProc::DistanceAdjust fDistanceAdjust;
     UniformHandle                                fDistanceAdjustUni;
diff --git a/src/gpu/gl/GrGLGeometryProcessor.cpp b/src/gpu/gl/GrGLGeometryProcessor.cpp
index 60c0043..dc4518f 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.cpp
+++ b/src/gpu/gl/GrGLGeometryProcessor.cpp
@@ -91,24 +91,35 @@
 
 void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
                                           GrGPArgs* gpArgs,
+                                          const char* posName) {
+    GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+    gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
+    vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
+}
+
+void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
+                                          GrGPArgs* gpArgs,
                                           const char* posName,
-                                          const SkMatrix& mat) {
+                                          const SkMatrix& mat,
+                                          UniformHandle* viewMatrixUniform) {
     GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
     if (mat.isIdentity()) {
         gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
-
         vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
-    } else if (!mat.hasPerspective()) {
-        this->addUniformViewMatrix(pb);
-        gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
-
-        vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
-                               gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
     } else {
-        this->addUniformViewMatrix(pb);
-        gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
-
-        vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
-                               gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
+        const char* viewMatrixName;
+        *viewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
+                                            kMat33f_GrSLType, kHigh_GrSLPrecision,
+                                            "uViewM",
+                                            &viewMatrixName);
+        if (!mat.hasPerspective()) {
+            gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
+            vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
+                                   gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
+        } else {
+            gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
+            vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
+                                   gpArgs->fPositionVar.c_str(), viewMatrixName, posName);
+        }
     }
 }
diff --git a/src/gpu/gl/GrGLGeometryProcessor.h b/src/gpu/gl/GrGLGeometryProcessor.h
index dfb2b90..747d82a 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.h
+++ b/src/gpu/gl/GrGLGeometryProcessor.h
@@ -64,10 +64,9 @@
     };
 
     // Create the correct type of position variable given the CTM
-    void setupPosition(GrGLGPBuilder* pb,
-                       GrGPArgs* gpArgs,
-                       const char* posName,
-                       const SkMatrix& mat = SkMatrix::I());
+    void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName);
+    void setupPosition(GrGLGPBuilder*, GrGPArgs*, const char* posName, const SkMatrix& mat,
+                       UniformHandle* viewMatrixUniform);
 
     static uint32_t ComputePosKey(const SkMatrix& mat) {
         if (mat.isIdentity()) {
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.cpp b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
index 893e556..6dd112c 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.cpp
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
@@ -44,22 +44,3 @@
                                    &stagedLocalVarName);
     fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
 }
-
-void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
-    fViewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
-                                        kMat33f_GrSLType, kHigh_GrSLPrecision,
-                                        "uViewM",
-                                        &fViewMatrixName);
-}
-
-void GrGLPrimitiveProcessor::setUniformViewMatrix(const GrGLProgramDataManager& pdman,
-                                                  const SkMatrix& viewMatrix) {
-    if (!viewMatrix.isIdentity() && !fViewMatrix.cheapEqualTo(viewMatrix)) {
-        SkASSERT(fViewMatrixUniform.isValid());
-        fViewMatrix = viewMatrix;
-
-        GrGLfloat viewMatrix[3 * 3];
-        GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
-        pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
-    }
-}
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.h b/src/gpu/gl/GrGLPrimitiveProcessor.h
index 90ee203..7345eae 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.h
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.h
@@ -17,7 +17,6 @@
 
 class GrGLPrimitiveProcessor {
 public:
-    GrGLPrimitiveProcessor() : fViewMatrixName(NULL) { fViewMatrix = SkMatrix::InvalidMatrix(); }
     virtual ~GrGLPrimitiveProcessor() {}
 
     typedef GrGLProgramDataManager::UniformHandle UniformHandle;
@@ -76,18 +75,6 @@
 protected:
     void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHandle* colorUniform);
 
-    const char* uViewM() const { return fViewMatrixName; }
-
-    /** a helper function to setup the uniform handle for the uniform view matrix */
-    void addUniformViewMatrix(GrGLGPBuilder*);
-
-
-    /** a helper function to upload a uniform viewmatrix.
-     * TODO we can remove this function when we have deferred geometry in place
-     */
-    void setUniformViewMatrix(const GrGLProgramDataManager&,
-                              const SkMatrix& viewMatrix);
-
     class ShaderVarHandle {
     public:
         bool isValid() const { return fHandle > -1; }
@@ -111,11 +98,6 @@
     };
 
     SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms;
-
-private:
-    UniformHandle fViewMatrixUniform;
-    SkMatrix fViewMatrix;
-    const char* fViewMatrixName;
 };
 
 #endif