aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrDiscardOp.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-04-11 12:54:57 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-11 19:38:18 +0000
commit1119dc366e15ef737d05d3a087410ea40c508101 (patch)
tree0b1363476a28c6df8baf79a46dbee8a74eac48af /src/gpu/ops/GrDiscardOp.h
parentfafe135349bd34961a12bfd8185733709cd0e45e (diff)
Remove discard from GrRenderTarget & force it to always go through a RenderTargetContext
This is a bit sloppy in that it ignores some instances where discards were being issued before. The creation of the temp RTContext in the RenderTarget's discard method was causing an extra split in the opLists. This is split out of: https://skia-review.googlesource.com/c/10284/ (Omnibus: Remove GrSurface-derived classes from ops) Change-Id: Ic366d303280635763b0fae238c4df37c04fb8503 Reviewed-on: https://skia-review.googlesource.com/11125 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ops/GrDiscardOp.h')
-rw-r--r--src/gpu/ops/GrDiscardOp.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/gpu/ops/GrDiscardOp.h b/src/gpu/ops/GrDiscardOp.h
index 098df63e7a..ca7f0007de 100644
--- a/src/gpu/ops/GrDiscardOp.h
+++ b/src/gpu/ops/GrDiscardOp.h
@@ -16,23 +16,39 @@
class GrDiscardOp final : public GrOp {
public:
DEFINE_OP_CLASS_ID
- static std::unique_ptr<GrOp> Make(GrRenderTarget* rt) {
- return std::unique_ptr<GrOp>(new GrDiscardOp(rt));
+
+ // MDB TODO: replace the renderTargetContext with just the renderTargetProxy.
+ // For now, we need the renderTargetContext for its accessRenderTarget powers.
+ static std::unique_ptr<GrOp> Make(GrRenderTargetContext* rtc) {
+
+ // MDB TODO: remove this. In this hybrid state we need to be sure the RT is instantiable
+ // so it can carry the IO refs. In the future we will just get the proxy and
+ // it carry the IO refs.
+ if (!rtc->accessRenderTarget()) {
+ return nullptr;
+ }
+
+ return std::unique_ptr<GrOp>(new GrDiscardOp(rtc));
}
const char* name() const override { return "Discard"; }
SkString dumpInfo() const override {
SkString string;
- string.printf("RT: %d", fRenderTarget.get()->uniqueID().asUInt());
+ string.printf("rtID: %d proxyID: %d ", fRenderTarget.get()->uniqueID().asUInt(),
+ fProxyUniqueID.asUInt());
string.append(INHERITED::dumpInfo());
return string;
}
private:
- GrDiscardOp(GrRenderTarget* rt) : INHERITED(ClassID()), fRenderTarget(rt) {
- this->setBounds(SkRect::MakeIWH(rt->width(), rt->height()), HasAABloat::kNo,
+ GrDiscardOp(GrRenderTargetContext* rtc)
+ : INHERITED(ClassID())
+ , fProxyUniqueID(rtc->asSurfaceProxy()->uniqueID()) {
+ this->setBounds(SkRect::MakeIWH(rtc->width(), rtc->height()), HasAABloat::kNo,
IsZeroArea::kNo);
+
+ fRenderTarget.reset(rtc->accessRenderTarget());
}
bool onCombineIfPossible(GrOp* that, const GrCaps& caps) override {
@@ -42,9 +58,12 @@ private:
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
+ // MDB TODO: instantiate the renderTarget from the proxy in here
state->commandBuffer()->discard(fRenderTarget.get());
}
+ // MDB TODO: remove this. When the renderTargetProxy carries the refs this will be redundant.
+ GrSurfaceProxy::UniqueID fProxyUniqueID;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
typedef GrOp INHERITED;