aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-05-18 14:38:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-18 19:43:55 +0000
commit7f1ce29c9bb9be8b2d8dbf9a99f14f74d5dc6d80 (patch)
treed27215fedb9dd88f0742a3171448870979d959ad /src/gpu/ops
parent72f4891bf8e11fed52cb4e524a537f8c8625f093 (diff)
Update clearOp for split-OpList world
It would reduce a lot of noise if the GrRenderTargetOpList kept a pointer to the GrCaps but, for now, I'm trying to shrink the GrRTOpList, not expand it. Change-Id: Ieed56fa2a41a3fb20234e26552ae2d301147e4f2 Reviewed-on: https://skia-review.googlesource.com/17323 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrClearOp.h57
1 files changed, 13 insertions, 44 deletions
diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h
index b18332fa21..dca7afc04d 100644
--- a/src/gpu/ops/GrClearOp.h
+++ b/src/gpu/ops/GrClearOp.h
@@ -9,49 +9,30 @@
#define GrClearOp_DEFINED
#include "GrFixedClip.h"
-#include "GrGpu.h"
#include "GrGpuCommandBuffer.h"
#include "GrOp.h"
#include "GrOpFlushState.h"
-#include "GrRenderTarget.h"
-#include "GrRenderTargetContext.h"
#include "GrResourceProvider.h"
class GrClearOp final : public GrOp {
public:
DEFINE_OP_CLASS_ID
- // MDB TODO: replace the renderTargetContext with just the renderTargetProxy.
- // For now, we need the renderTargetContext for its accessRenderTarget powers.
static std::unique_ptr<GrClearOp> Make(const GrFixedClip& clip, GrColor color,
- GrRenderTargetContext* rtc) {
- const SkIRect rtRect = SkIRect::MakeWH(rtc->width(), rtc->height());
- if (clip.scissorEnabled() && !SkIRect::Intersects(clip.scissorRect(), rtRect)) {
+ GrSurfaceProxy* dstProxy) {
+ const SkIRect rect = SkIRect::MakeWH(dstProxy->width(), dstProxy->height());
+ if (clip.scissorEnabled() && !SkIRect::Intersects(clip.scissorRect(), rect)) {
return nullptr;
}
- // 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<GrClearOp>(new GrClearOp(clip, color, rtc));
+ return std::unique_ptr<GrClearOp>(new GrClearOp(clip, color, dstProxy));
}
- // MDB TODO: replace the renderTargetContext with just the renderTargetProxy.
static std::unique_ptr<GrClearOp> Make(const SkIRect& rect, GrColor color,
- GrRenderTargetContext* rtc,
bool fullScreen) {
SkASSERT(fullScreen || !rect.isEmpty());
- // MDB TODO: remove this. See above comment.
- if (!rtc->accessRenderTarget()) {
- return nullptr;
- }
-
- return std::unique_ptr<GrClearOp>(new GrClearOp(rect, color, rtc, fullScreen));
+ return std::unique_ptr<GrClearOp>(new GrClearOp(rect, color, fullScreen));
}
const char* name() const override { return "Clear"; }
@@ -59,9 +40,7 @@ public:
SkString dumpInfo() const override {
SkString string;
string.append(INHERITED::dumpInfo());
- string.appendf("rtID: %d proxyID: %d Scissor [",
- fRenderTarget.get()->uniqueID().asUInt(),
- fProxyUniqueID.asUInt());
+ string.appendf("Scissor [ ");
if (fClip.scissorEnabled()) {
const SkIRect& r = fClip.scissorRect();
string.appendf("L: %d, T: %d, R: %d, B: %d", r.fLeft, r.fTop, r.fRight, r.fBottom);
@@ -76,13 +55,11 @@ public:
void setColor(GrColor color) { fColor = color; }
private:
- GrClearOp(const GrFixedClip& clip, GrColor color, GrRenderTargetContext* rtc)
+ GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* proxy)
: INHERITED(ClassID())
, fClip(clip)
- , fColor(color)
- , fProxyUniqueID(rtc->asSurfaceProxy()->uniqueID()) {
+ , fColor(color) {
- GrSurfaceProxy* proxy = rtc->asSurfaceProxy();
const SkIRect rtRect = SkIRect::MakeWH(proxy->width(), proxy->height());
if (fClip.scissorEnabled()) {
// Don't let scissors extend outside the RT. This may improve op combining.
@@ -97,20 +74,17 @@ private:
}
this->setBounds(SkRect::Make(fClip.scissorEnabled() ? fClip.scissorRect() : rtRect),
HasAABloat::kNo, IsZeroArea::kNo);
- fRenderTarget.reset(rtc->accessRenderTarget());
}
- GrClearOp(const SkIRect& rect, GrColor color, GrRenderTargetContext* rtc, bool fullScreen)
+ GrClearOp(const SkIRect& rect, GrColor color, bool fullScreen)
: INHERITED(ClassID())
, fClip(GrFixedClip(rect))
- , fColor(color)
- , fProxyUniqueID(rtc->asSurfaceProxy()->uniqueID()) {
+ , fColor(color) {
if (fullScreen) {
fClip.disableScissor();
}
this->setBounds(SkRect::Make(rect), HasAABloat::kNo, IsZeroArea::kNo);
- fRenderTarget.reset(rtc->accessRenderTarget());
}
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
@@ -118,8 +92,6 @@ private:
// contains the old clear, or when the new clear is a subset of the old clear and is the
// same color.
GrClearOp* cb = t->cast<GrClearOp>();
- SkASSERT(cb->fRenderTarget == fRenderTarget);
- SkASSERT(cb->fProxyUniqueID == fProxyUniqueID);
if (fClip.windowRectsState() != cb->fClip.windowRectsState()) {
return false;
}
@@ -144,17 +116,14 @@ private:
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
- // MDB TODO: instantiate the renderTarget from the proxy in here
- state->commandBuffer()->clear(fRenderTarget.get(), fClip, fColor);
+ SkASSERT(state->drawOpArgs().fRenderTarget);
+
+ state->commandBuffer()->clear(state->drawOpArgs().fRenderTarget, fClip, fColor);
}
GrFixedClip fClip;
GrColor fColor;
- // 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;
};