CCPR: Fix Intel crash and un-blacklist

Bug: skia:
Change-Id: I6dca83426fb1199033a0871f965ec622b7f318a0
Reviewed-on: https://skia-review.googlesource.com/88903
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index 2f0c023..acadc11 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -140,13 +140,17 @@
     varyingHandler->addFlatPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
                                                 args.fOutputColor);
 
-    // Vertex shader.
+    // The vertex shader bloats and intersects the devBounds and devBounds45 rectangles, in order to
+    // find an octagon that circumscribes the (bloated) path.
     GrGLSLVertexBuilder* v = args.fVertBuilder;
 
-    // Find the intersections of (bloated) devBounds and devBounds45 in order to come up with an
-    // octagon that circumscribes the (bloated) path. A vertex is the intersection of two lines:
-    // one edge from the path's bounding box and one edge from its 45-degree bounding box.
-    v->codeAppendf("float2x2 N = float2x2(%s);", proc.getEdgeNormsAttrib().fName);
+    // Each vertex is the intersection of one edge from devBounds and one from devBounds45.
+    // 'N' holds the normals to these edges as column vectors.
+    //
+    // NOTE: "float2x2(float4)" is valid and equivalent to "float2x2(float4.xy, float4.zw)",
+    // however Intel compilers crash when we use the former syntax in this shader.
+    v->codeAppendf("float2x2 N = float2x2(%s.xy, %s.zw);",
+                   proc.getEdgeNormsAttrib().fName, proc.getEdgeNormsAttrib().fName);
 
     // N[0] is the normal for the edge we are intersecting from the regular bounding box, pointing
     // out of the octagon.
@@ -179,9 +183,11 @@
                        texcoord.vsOut(), atlasAdjust, atlasAdjust);
     }
 
-    // Convert to (local) path cordinates.
-    v->codeAppendf("float2 pathcoord = inverse(float2x2(%s)) * (octocoord - %s);",
+    // Convert to path/local cordinates.
+    v->codeAppendf("float2x2 viewmatrix = float2x2(%s.xy, %s.zw);", // float2x2(float4) busts Intel.
                    proc.getInstanceAttrib(InstanceAttribs::kViewMatrix).fName,
+                   proc.getInstanceAttrib(InstanceAttribs::kViewMatrix).fName);
+    v->codeAppendf("float2 pathcoord = inverse(viewmatrix) * (octocoord - %s);",
                    proc.getInstanceAttrib(InstanceAttribs::kViewTranslate).fName);
 
     this->emitTransforms(v, varyingHandler, uniHandler, GrShaderVar("pathcoord", kFloat2_GrSLType),
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index d9c2eb6..038a1b1 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -405,14 +405,6 @@
         fBlacklistCoverageCounting = true;
     }
 
-#ifndef SK_BUILD_FOR_MAC
-    if (kIntel_GrGLVendor == ctxInfo.vendor()) {
-        // Non-Mac Intel bots across the board either crash with CCPR or do not draw properly.
-        // Hopefully this issue resolves itself when we move away from geometry shaders.
-        fBlacklistCoverageCounting = true;
-    }
-#endif
-
     if (!contextOptions.fAvoidStencilBuffers) {
         // To reduce surface area, if we avoid stencil buffers, we also disable MSAA.
         this->initFSAASupport(contextOptions, ctxInfo, gli);