Update more GrOps to split-opList world

Change-Id: I568e52f58372597abc2920aaee346a9731452d18
Reviewed-on: https://skia-review.googlesource.com/17324
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2017-06-01 08:48:19 -04:00 committed by Skia Commit-Bot
parent baf41bd1c8
commit 2f4ddf6964
4 changed files with 30 additions and 78 deletions

View File

@ -605,8 +605,9 @@ void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool i
AutoCheckFlush acf(fRenderTargetContext->drawingManager());
std::unique_ptr<GrOp> op(GrClearStencilClipOp::Make(clip, insideStencilMask,
fRenderTargetContext));
std::unique_ptr<GrOp> op(GrClearStencilClipOp::Make(
clip, insideStencilMask,
fRenderTargetContext->fRenderTargetProxy.get()));
if (!op) {
return;
}
@ -662,7 +663,6 @@ void GrRenderTargetContextPriv::stencilPath(const GrClip& clip,
appliedClip.hasStencilClip(),
stencilAttachment->bits(),
appliedClip.scissorState(),
fRenderTargetContext,
path);
if (!op) {
return;

View File

@ -9,30 +9,17 @@
#define GrClearStencilClipOp_DEFINED
#include "GrFixedClip.h"
#include "GrGpu.h"
#include "GrGpuCommandBuffer.h"
#include "GrOp.h"
#include "GrOpFlushState.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetContext.h"
class GrClearStencilClipOp 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<GrOp> Make(const GrFixedClip& clip, bool insideStencilMask,
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 GrClearStencilClipOp(clip, insideStencilMask, rtc));
GrRenderTargetProxy* proxy) {
return std::unique_ptr<GrOp>(new GrClearStencilClipOp(clip, insideStencilMask, proxy));
}
const char* name() const override { return "ClearStencilClip"; }
@ -42,28 +29,24 @@ public:
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);
} else {
string.append("disabled");
}
string.appendf("], IC: %d, rtID: %d proxyID: %d",
fInsideStencilMask,
fRenderTarget.get()->uniqueID().asUInt(),
fProxyUniqueID.asUInt());
string.appendf("], insideMask: %s\n", fInsideStencilMask ? "true" : "false");
string.append(INHERITED::dumpInfo());
return string;
}
private:
GrClearStencilClipOp(const GrFixedClip& clip, bool insideStencilMask,
GrRenderTargetContext* rtc)
GrRenderTargetProxy* proxy)
: INHERITED(ClassID())
, fClip(clip)
, fInsideStencilMask(insideStencilMask)
, fProxyUniqueID(rtc->asSurfaceProxy()->uniqueID()) {
, fInsideStencilMask(insideStencilMask) {
const SkRect& bounds = fClip.scissorEnabled()
? SkRect::Make(fClip.scissorRect())
: SkRect::MakeIWH(rtc->width(), rtc->height());
: SkRect::MakeIWH(proxy->width(), proxy->height());
this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo);
fRenderTarget.reset(rtc->accessRenderTarget());
}
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override { return false; }
@ -71,15 +54,14 @@ private:
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
// MDB TODO: instantiate the renderTarget from the proxy in here
state->commandBuffer()->clearStencilClip(fRenderTarget.get(), fClip, fInsideStencilMask);
SkASSERT(state->drawOpArgs().fRenderTarget);
state->commandBuffer()->clearStencilClip(state->drawOpArgs().fRenderTarget,
fClip, fInsideStencilMask);
}
const GrFixedClip fClip;
const bool fInsideStencilMask;
// MDB TODO: remove this. When the renderTargetProxy carries the refs this will be redundant.
GrSurfaceProxy::UniqueID fProxyUniqueID;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
const GrFixedClip fClip;
const bool fInsideStencilMask;
typedef GrOp INHERITED;
};

View File

@ -26,14 +26,11 @@ public:
SkString dumpInfo() const override {
SkString string;
string.append(INHERITED::dumpInfo());
string.printf("proxyID: %d\n", fRenderTargetProxy.get()->uniqueID().asUInt());
return string;
}
private:
GrDiscardOp(GrRenderTargetProxy* proxy)
: INHERITED(ClassID())
, fRenderTargetProxy(proxy) {
GrDiscardOp(GrRenderTargetProxy* proxy) : INHERITED(ClassID()) {
this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()),
HasAABloat::kNo, IsZeroArea::kNo);
}
@ -43,17 +40,11 @@ private:
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
GrRenderTarget* rt = fRenderTargetProxy.get()->instantiateRenderTarget(
state->resourceProvider());
if (!rt) {
return;
}
SkASSERT(state->drawOpArgs().fRenderTarget);
state->commandBuffer()->discard(rt);
state->commandBuffer()->discard(state->drawOpArgs().fRenderTarget);
}
GrPendingIOResource<GrRenderTargetProxy, kWrite_GrIOType> fRenderTargetProxy;
typedef GrOp INHERITED;
};

View File

@ -8,40 +8,27 @@
#ifndef GrStencilPathOp_DEFINED
#define GrStencilPathOp_DEFINED
#include "GrGpu.h"
#include "GrOp.h"
#include "GrOpFlushState.h"
#include "GrPath.h"
#include "GrPathRendering.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetContext.h"
#include "GrStencilSettings.h"
class GrStencilPathOp 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<GrOp> Make(const SkMatrix& viewMatrix,
bool useHWAA,
GrPathRendering::FillType fillType,
bool hasStencilClip,
int numStencilBits,
const GrScissorState& scissor,
GrRenderTargetContext* renderTargetContext,
const GrPath* path) {
// 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 will carry the IO refs.
if (!renderTargetContext->accessRenderTarget()) {
return nullptr;
}
return std::unique_ptr<GrOp>(new GrStencilPathOp(viewMatrix, useHWAA, fillType,
hasStencilClip, numStencilBits, scissor,
renderTargetContext, path));
path));
}
const char* name() const override { return "StencilPathOp"; }
@ -49,8 +36,6 @@ public:
SkString dumpInfo() const override {
SkString string;
string.printf("Path: 0x%p, AA: %d", fPath.get(), fUseHWAA);
string.appendf("rtID: %d proxyID: %d",
fRenderTarget.get()->uniqueID().asUInt(), fProxyUniqueID.asUInt());
string.append(INHERITED::dumpInfo());
return string;
}
@ -62,7 +47,6 @@ private:
bool hasStencilClip,
int numStencilBits,
const GrScissorState& scissor,
GrRenderTargetContext* renderTargetContext,
const GrPath* path)
: INHERITED(ClassID())
, fViewMatrix(viewMatrix)
@ -70,11 +54,8 @@ private:
, fStencil(GrPathRendering::GetStencilPassSettings(fillType), hasStencilClip,
numStencilBits)
, fScissor(scissor)
, fProxyUniqueID(renderTargetContext->asSurfaceProxy()->uniqueID())
, fPath(path) {
this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
fRenderTarget.reset(renderTargetContext->accessRenderTarget());
}
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override { return false; }
@ -82,20 +63,18 @@ private:
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState* state) override {
// MDB TODO: instantiate the renderTarget from the proxy in here
GrPathRendering::StencilPathArgs args(fUseHWAA, fRenderTarget.get(), &fViewMatrix,
&fScissor, &fStencil);
SkASSERT(state->drawOpArgs().fRenderTarget);
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().fRenderTarget,
&fViewMatrix, &fScissor, &fStencil);
state->gpu()->pathRendering()->stencilPath(args, fPath.get());
}
SkMatrix fViewMatrix;
bool fUseHWAA;
GrStencilSettings fStencil;
GrScissorState fScissor;
// MDB TODO: remove this. When the renderTargetProxy carries the refs this will be redundant.
GrSurfaceProxy::UniqueID fProxyUniqueID;
GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget;
GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
SkMatrix fViewMatrix;
bool fUseHWAA;
GrStencilSettings fStencil;
GrScissorState fScissor;
GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
typedef GrOp INHERITED;
};