Don't compare coord change matrices to determine effect compatibility when using...
authorbsalomon <bsalomon@google.com>
Mon, 4 Aug 2014 17:56:39 +0000 (10:56 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 4 Aug 2014 17:56:40 +0000 (10:56 -0700)
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/438053002

expectations/gm/ignored-tests.txt
include/gpu/GrEffectStage.h
src/gpu/GrDrawState.h
src/gpu/gl/GrGLProgramEffects.cpp

index 5c8817cd6c2c894b3c0cebfa24e6fbfe7a5d6bab..90514b22a0503f5682d81eb7b2867e18830fd244 100644 (file)
@@ -33,3 +33,7 @@
 ## epoger will rebaseline by 25 Dec 2013
 #gradtext
 
+#bsalomon: Slight AA changes to a rect in GPU configs after change that increases
+#batching
+bleed
+
index fb0620d6e6df097ca1f15ef7f1961b1c22373aef..65c7bebdc7056f7da58960ea61e489fd5c2cd73d 100644 (file)
@@ -40,28 +40,33 @@ public:
         memcpy(fVertexAttribIndices, other.fVertexAttribIndices, sizeof(fVertexAttribIndices));
         return *this;
     }
+    
+    static bool AreCompatible(const GrEffectStage& a, const GrEffectStage& b,
+                              bool usingExplicitLocalCoords) {
+        SkASSERT(NULL != a.fEffect.get());
+        SkASSERT(NULL != b.fEffect.get());
 
-    bool operator== (const GrEffectStage& other) const {
-        SkASSERT(NULL != fEffect.get());
-        SkASSERT(NULL != other.fEffect.get());
-
-        if (!this->getEffect()->isEqual(*other.getEffect())) {
+        if (!a.getEffect()->isEqual(*b.getEffect())) {
             return false;
         }
 
-        if (fCoordChangeMatrixSet != other.fCoordChangeMatrixSet) {
+        // We always track the coord change matrix, but it has no effect when explicit local coords
+        // are used.
+        if (usingExplicitLocalCoords) {
+            return true;
+        }
+
+        if (a.fCoordChangeMatrixSet != b.fCoordChangeMatrixSet) {
             return false;
         }
 
-        if (!fCoordChangeMatrixSet) {
+        if (!a.fCoordChangeMatrixSet) {
             return true;
         }
 
-        return fCoordChangeMatrix == other.fCoordChangeMatrix;
+        return a.fCoordChangeMatrix == b.fCoordChangeMatrix;
     }
 
-    bool operator!= (const GrEffectStage& s) const { return !(*this == s); }
-
     /**
      * This is called when the coordinate system in which the geometry is specified will change.
      *
index d1b7a66f5ca454c464d6252c3788bafa2a5630e3..b894cb5a2922a9c21e766efb019ccc41789ba6b8 100644 (file)
@@ -893,13 +893,17 @@ public:
             fDrawFace != that.fDrawFace) {
             return false;
         }
+
+        bool explicitLocalCoords = this->hasLocalCoordAttribute();
         for (int i = 0; i < fColorStages.count(); i++) {
-            if (fColorStages[i] != that.fColorStages[i]) {
+            if (!GrEffectStage::AreCompatible(fColorStages[i], that.fColorStages[i],
+                explicitLocalCoords)) {
                 return false;
             }
         }
         for (int i = 0; i < fCoverageStages.count(); i++) {
-            if (fCoverageStages[i] != that.fCoverageStages[i]) {
+            if (!GrEffectStage::AreCompatible(fCoverageStages[i], that.fCoverageStages[i],
+                explicitLocalCoords)) {
                 return false;
             }
         }
index cff31e29c26e6ebbbea1c3c49425378fe38ed383..3fa4f15ac80f13fe55de0be6b18155f3b607f3ad 100644 (file)
@@ -90,8 +90,11 @@ GrCoordSet get_source_coords(uint32_t transformKey, int transformIdx) {
 SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx) {
     const GrCoordTransform& coordTransform = drawEffect.effect()->coordTransform(transformIdx);
     SkMatrix combined;
-    if (kLocal_GrCoordSet == coordTransform.sourceCoords() &&
-        !drawEffect.programHasExplicitLocalCoords()) {
+
+    if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
+        // If we have explicit local coords then we shouldn't need a coord change.
+        SkASSERT(!drawEffect.programHasExplicitLocalCoords() ||
+                 drawEffect.getCoordChangeMatrix().isIdentity());
         combined.setConcat(coordTransform.getMatrix(), drawEffect.getCoordChangeMatrix());
     } else {
         combined = coordTransform.getMatrix();