Implement NV_path_rendering on OpenGL ES

Implement support for NV_path_rendering on OpenGL ES. Use
glProgramPathFragmentInputGenNV function call instead of glPathTexGenNV to
communicate transforms to fragment shader.

The intention is that the NVPR paths will be drawn with the same shader program
as non-NVPR geometry. For NVPR calls, the GPU will skip the vertex shader and
just run the fragment shader.

After program is linked, query the locations of the fragment shader inputs with
glGetResourceLocation. The location will be used to set the transforms with
glProgramPathFragmentInputGenNV.

The functions and their workings are documented in:

glProgramPathFragmentInputGenNV
https://www.opengl.org/registry/specs/NV/path_rendering.txt
(note: addition as of API version 1.3)

glGetResourceLocation
https://www.opengl.org/registry/specs/ARB/program_interface_query.txt
http://www.opengl.org/registry/doc/glspec44.core.pdf
(function is in core Open GL 4.4)

Note: glProgramPathFragmentInputGenNV could be used also for OpenGL. However,
using seems to trigger a bug in the driver. Disable this feature on OpenGL at
least until the driver is fixed and released. The bug manifests in shadertext
test, where the lower-left text pair is missing. Valgrind catches a bad read
for the test and causes the context to OOM reproducibly.

R=bsalomon@google.com, cdalton@nvidia.com, joshualitt@google.com, joshualitt@chromium.org

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/367643004
diff --git a/src/gpu/gl/GrGLProgramEffects.h b/src/gpu/gl/GrGLProgramEffects.h
index e4d84a0..0eaff53 100644
--- a/src/gpu/gl/GrGLProgramEffects.h
+++ b/src/gpu/gl/GrGLProgramEffects.h
@@ -10,6 +10,7 @@
 
 #include "GrBackendEffectFactory.h"
 #include "GrGLProgramDataManager.h"
+#include "GrGpu.h"
 #include "GrTexture.h"
 #include "GrTextureAccess.h"
 
@@ -28,6 +29,7 @@
 class GrGLProgramEffects : public SkRefCnt {
 public:
     typedef GrGLProgramDataManager::UniformHandle UniformHandle;
+    typedef GrGLProgramDataManager::VaryingHandle VaryingHandle;
 
     /**
      * This class emits some of the code inserted into the shaders for an effect. The code it
@@ -51,6 +53,7 @@
      * Calls setData() on each effect, and sets their transformation matrices and texture bindings.
      */
     virtual void setData(GrGpuGL*,
+                         GrGpu::DrawType,
                          const GrGLProgramDataManager&,
                          const GrEffectStage* effectStages[]) = 0;
 
@@ -165,6 +168,7 @@
 class GrGLVertexProgramEffects : public GrGLProgramEffects {
 public:
     virtual void setData(GrGpuGL*,
+                         GrGpu::DrawType,
                          const GrGLProgramDataManager&,
                          const GrEffectStage* effectStages[]) SK_OVERRIDE;
 
@@ -205,7 +209,9 @@
     /**
      * Helper for setData(). Sets all the transform matrices for an effect.
      */
-    void setTransformData(const GrGLProgramDataManager&, const GrDrawEffect&, int effectIdx);
+    void setTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrDrawEffect&, int effectIdx);
+    void setPathTransformData(GrGpuGL* gpu, const GrGLProgramDataManager&, const GrDrawEffect&,
+                              int effectIdx);
 
     struct Transform {
         Transform() { fCurrentValue = SkMatrix::InvalidMatrix(); }
@@ -213,7 +219,15 @@
         SkMatrix      fCurrentValue;
     };
 
+    struct PathTransform {
+        PathTransform() { fCurrentValue = SkMatrix::InvalidMatrix(); }
+        VaryingHandle fHandle;
+        SkMatrix fCurrentValue;
+        GrSLType fType;
+    };
+
     SkTArray<SkSTArray<2, Transform, true> > fTransforms;
+    SkTArray<SkTArray<PathTransform, true> > fPathTransforms;
     bool                                     fHasExplicitLocalCoords;
 
     friend class GrGLVertexProgramEffectsBuilder;
@@ -253,6 +267,7 @@
 class GrGLPathTexGenProgramEffects : public GrGLProgramEffects {
 public:
     virtual void setData(GrGpuGL*,
+                         GrGpu::DrawType,
                          const GrGLProgramDataManager&,
                          const GrEffectStage* effectStages[]) SK_OVERRIDE;