Use texture barriers to read directly from the RT

Updates GrXferProcessor to read directly from the RT texture when
texture barriers are supported and it needs to know the dst color.
Also adds the notion of an Xfer barrier and uses it to issue texture
barriers when the XP will read the RT.

BUG=skia:

Review URL: https://codereview.chromium.org/1040303002
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index de08ef0..42ac153 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -32,6 +32,19 @@
     this->onGetGLProcessorKey(caps, b);
 }
 
+bool GrXferProcessor::willNeedXferBarrier(const GrRenderTarget* rt,
+                                          const GrDrawTargetCaps& caps,
+                                          GrXferBarrierType* outBarrierType) const {
+    if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) {
+        // Texture barriers are required when a shader reads and renders to the same texture.
+        SkASSERT(rt);
+        SkASSERT(caps.textureBarrierSupport());
+        *outBarrierType = kTexture_GrXferBarrierType;
+        return true;
+    }
+    return false;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,