Remove GrRenderTargetOpList::discard & move functionality to GrRenderTargetContext

Change-Id: If84ffb7b01543a44179837d683c0a4c004e52f63
Reviewed-on: https://skia-review.googlesource.com/13335
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 38bd4ac..40ccbea 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -26,6 +26,7 @@
 #include "instanced/InstancedRendering.h"
 #include "ops/GrClearOp.h"
 #include "ops/GrClearStencilClipOp.h"
+#include "ops/GrDiscardOp.h"
 #include "ops/GrDrawOp.h"
 #include "ops/GrDrawAtlasOp.h"
 #include "ops/GrDrawVerticesOp.h"
@@ -192,7 +193,15 @@
 
     AutoCheckFlush acf(this->drawingManager());
 
-    this->getOpList()->discard(this);
+    // Currently this just inserts a discard op. However, once in MDB this can remove all the
+    // previously recorded ops and change the load op to discard.
+    if (this->caps()->discardRenderTargetSupport()) {
+        std::unique_ptr<GrOp> op(GrDiscardOp::Make(this));
+        if (!op) {
+            return;
+        }
+        this->getOpList()->addOp(std::move(op), this);
+    }
 }
 
 void GrRenderTargetContext::clear(const SkIRect* rect,