aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetContext.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-08-09 13:31:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-09 18:11:34 +0000
commitb681a0f1b0acebe36130fd463d14016d48295b97 (patch)
treeb069332fad7ccacb29ed0c080c4d423824ae7e0f /src/gpu/GrRenderTargetContext.cpp
parentc270423de16f54af26147280c406b8b74ab07046 (diff)
Store discard request on the opList and remove GrDiscardOp
Change-Id: Ic1f76bb91c16b23df1fe71c07a4d5ad5abf1dc26 Reviewed-on: https://skia-review.googlesource.com/32640 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index e76b5ff26e..48cea29d71 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -31,7 +31,6 @@
#include "ops/GrClearOp.h"
#include "ops/GrClearStencilClipOp.h"
#include "ops/GrDebugMarkerOp.h"
-#include "ops/GrDiscardOp.h"
#include "ops/GrDrawAtlasOp.h"
#include "ops/GrDrawOp.h"
#include "ops/GrDrawVerticesOp.h"
@@ -216,18 +215,22 @@ void GrRenderTargetContext::discard() {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "discard", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "discard", fContext);
AutoCheckFlush acf(this->drawingManager());
- // 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(fRenderTargetProxy.get()));
- if (!op) {
- return;
+ // Discard calls to in-progress opLists are ignored. Calls at the start update the
+ // opLists' color & stencil load ops.
+ if (this->getRTOpList()->isEmpty()) {
+ if (this->caps()->discardRenderTargetSupport()) {
+ this->getRTOpList()->setColorLoadOp(GrLoadOp::kDiscard);
+ this->getRTOpList()->setStencilLoadOp(GrLoadOp::kDiscard);
+ } else {
+ // Surely, if a discard was requested, a clear should be acceptable
+ this->getRTOpList()->setColorLoadOp(GrLoadOp::kClear);
+ this->getRTOpList()->setLoadClearColor(0x0);
+ this->getRTOpList()->setStencilLoadOp(GrLoadOp::kClear);
}
- this->getRTOpList()->addOp(std::move(op), *this->caps());
}
}
@@ -1761,7 +1764,7 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr
if (fixedFunctionFlags & GrDrawOp::FixedFunctionFlags::kUsesStencil ||
appliedClip.hasStencilClip()) {
- this->getOpList()->setRequiresStencil();
+ this->getOpList()->setStencilLoadOp(GrLoadOp::kClear);
// This forces instantiation of the render target.
GrRenderTarget* rt = this->accessRenderTarget();