Add support for reading the dst pixel value in an effect. Use in a new effect for the kDarken xfer mode.

The current implementation is to always make a copy of the entire dst before the draw.
It will only succeed if the RT is also a texture.
Obviously, there is lots of room for improvement.
Review URL: https://codereview.chromium.org/13314002

git-svn-id: http://skia.googlecode.com/svn/trunk@8449 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h
index 135d46c..b1660d8 100644
--- a/src/gpu/gl/GrGLProgramDesc.h
+++ b/src/gpu/gl/GrGLProgramDesc.h
@@ -10,6 +10,7 @@
 
 #include "GrGLEffect.h"
 #include "GrDrawState.h"
+#include "GrGLShaderBuilder.h"
 
 class GrGpuGL;
 
@@ -18,9 +19,10 @@
 #define GR_GL_EXPERIMENTAL_GS GR_DEBUG
 
 
-/** This class describes a program to generate. It also serves as a program cache key. The only
-    thing GL-specific about this is the generation of GrGLEffect::EffectKeys. With some refactoring
-    it could be made backend-neutral. */
+/** This class describes a program to generate. It also serves as a program cache key. Very little
+    of this is GL-specific. There is the generation of GrGLEffect::EffectKeys and the dst-read part
+    of the key set by GrGLShaderBuilder. If the interfaces that set those portions were abstracted
+    to be API-neutral then so could this class. */
 class GrGLProgramDesc {
 public:
     GrGLProgramDesc() {
@@ -48,6 +50,7 @@
                       GrBlendCoeff srcCoeff,
                       GrBlendCoeff dstCoeff,
                       const GrGpuGL* gpu,
+                      const GrDeviceCoordTexture* dstCopy,
                       GrGLProgramDesc* outDesc);
 
 private:
@@ -86,6 +89,10 @@
 #if GR_GL_EXPERIMENTAL_GS
     bool                        fExperimentalGS;
 #endif
+    GrGLShaderBuilder::DstReadKey fDstRead;             // set by GrGLShaderBuilder if there
+                                                        // are effects that must read the dst.
+                                                        // Otherwise, 0.
+
     uint8_t                     fColorInput;            // casts to enum ColorInput
     uint8_t                     fCoverageInput;         // casts to enum ColorInput
     uint8_t                     fDualSrcOutput;         // casts to enum DualSrcOutput
@@ -98,8 +105,10 @@
     int8_t                      fCoverageAttributeIndex;
     int8_t                      fLocalCoordsAttributeIndex;
 
-    // GrGLProgram reads the private fields to generate code.
+    // GrGLProgram and GrGLShaderBuilder read the private fields to generate code. TODO: Move all
+    // code generation to GrGLShaderBuilder (and maybe add getters rather than friending).
     friend class GrGLProgram;
+    friend class GrGLShaderBuilder;
 };
 
 #endif