Clarify that the OpArgs' outputSwizzle comes from its GrRenderTargetProxy
Since we want to collect shader information early, this attempts to make clear that numSamples, origin and outputSwizzle can all be obtained from the target renderTargetProxy. Change-Id: I42e0fd79e2163f17673ccdd344a31fbaadac5f53 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246298 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
513109e9de
commit
405413fcec
@ -161,7 +161,7 @@ private:
|
||||
return;
|
||||
}
|
||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kPlus,
|
||||
flushState->drawOpArgs().fOutputSwizzle);
|
||||
flushState->drawOpArgs().outputSwizzle());
|
||||
GrMesh mesh(GrPrimitiveType::kTriangleStrip);
|
||||
mesh.setNonIndexedNonInstanced(4);
|
||||
mesh.setVertexData(std::move(fVertexBuffer));
|
||||
|
@ -171,7 +171,7 @@ private:
|
||||
return;
|
||||
}
|
||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrcOver,
|
||||
flushState->drawOpArgs().fOutputSwizzle);
|
||||
flushState->drawOpArgs().outputSwizzle());
|
||||
GrMesh mesh(GrPrimitiveType::kTriangleStrip);
|
||||
mesh.setNonIndexedNonInstanced(4);
|
||||
mesh.setVertexData(std::move(fVertexBuffer));
|
||||
|
@ -232,7 +232,7 @@ private:
|
||||
);
|
||||
|
||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrcOver,
|
||||
flushState->drawOpArgs().fOutputSwizzle,
|
||||
flushState->drawOpArgs().outputSwizzle(),
|
||||
GrPipeline::InputFlags::kHWAntialias, &kStencilWrite);
|
||||
|
||||
GrMesh mesh(GrPrimitiveType::kTriangleStrip);
|
||||
|
@ -335,7 +335,7 @@ void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state,
|
||||
}
|
||||
|
||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kPlus,
|
||||
state->drawOpArgs().fOutputSwizzle);
|
||||
state->drawOpArgs().outputSwizzle());
|
||||
|
||||
std::unique_ptr<GrCCCoverageProcessor> proc;
|
||||
if (state->caps().shaderCaps()->geometryShaderSupport()) {
|
||||
|
@ -40,7 +40,7 @@ void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
|
||||
pipelineArgs.fDstProxy = this->dstProxy();
|
||||
pipelineArgs.fCaps = &this->caps();
|
||||
pipelineArgs.fUserStencil = stencilSettings;
|
||||
pipelineArgs.fOutputSwizzle = this->drawOpArgs().fOutputSwizzle;
|
||||
pipelineArgs.fOutputSwizzle = this->drawOpArgs().outputSwizzle();
|
||||
GrPipeline* pipeline = this->allocator()->make<GrPipeline>(pipelineArgs,
|
||||
std::move(processorSet),
|
||||
this->detachAppliedClip());
|
||||
@ -134,7 +134,7 @@ void GrOpFlushState::recordDraw(
|
||||
const GrPipeline::FixedDynamicState* fixedDynamicState,
|
||||
const GrPipeline::DynamicStateArrays* dynamicStateArrays) {
|
||||
SkASSERT(fOpArgs);
|
||||
SkASSERT(fOpArgs->fOp);
|
||||
SkDEBUGCODE(fOpArgs->validate());
|
||||
bool firstDraw = fDraws.begin() == fDraws.end();
|
||||
auto& draw = fDraws.append(&fArena);
|
||||
GrDeferredUploadToken token = fTokenTracker->issueDrawToken();
|
||||
@ -154,7 +154,7 @@ void GrOpFlushState::recordDraw(
|
||||
draw.fDynamicStateArrays = dynamicStateArrays;
|
||||
draw.fMeshes = meshes;
|
||||
draw.fMeshCnt = meshCnt;
|
||||
draw.fOp = fOpArgs->fOp;
|
||||
draw.fOp = fOpArgs->op();
|
||||
if (firstDraw) {
|
||||
fBaseDrawToken = token;
|
||||
}
|
||||
@ -193,7 +193,7 @@ void GrOpFlushState::putBackVertices(int vertices, size_t vertexStride) {
|
||||
}
|
||||
|
||||
GrAppliedClip GrOpFlushState::detachAppliedClip() {
|
||||
return fOpArgs->fAppliedClip ? std::move(*fOpArgs->fAppliedClip) : GrAppliedClip();
|
||||
return fOpArgs->appliedClip() ? std::move(*fOpArgs->appliedClip()) : GrAppliedClip();
|
||||
}
|
||||
|
||||
GrStrikeCache* GrOpFlushState::glyphCache() const {
|
||||
|
@ -57,22 +57,44 @@ public:
|
||||
|
||||
/** Additional data required on a per-op basis when executing GrOps. */
|
||||
struct OpArgs {
|
||||
GrSurfaceOrigin origin() const { return fProxy->origin(); }
|
||||
GrRenderTarget* renderTarget() const { return fProxy->peekRenderTarget(); }
|
||||
explicit OpArgs(GrOp* op, GrRenderTargetProxy* proxy, GrAppliedClip* appliedClip,
|
||||
const GrXferProcessor::DstProxy& dstProxy)
|
||||
: fOp(op)
|
||||
, fProxy(proxy)
|
||||
, fAppliedClip(appliedClip)
|
||||
, fDstProxy(dstProxy) {
|
||||
}
|
||||
|
||||
GrOp* fOp;
|
||||
// TODO: do we still need the dst proxy here?
|
||||
GrRenderTargetProxy* fProxy;
|
||||
GrAppliedClip* fAppliedClip;
|
||||
GrSwizzle fOutputSwizzle;
|
||||
GrXferProcessor::DstProxy fDstProxy;
|
||||
int numSamples() const { return fProxy->numSamples(); }
|
||||
GrSurfaceOrigin origin() const { return fProxy->origin(); }
|
||||
GrSwizzle outputSwizzle() const { return fProxy->outputSwizzle(); }
|
||||
|
||||
GrOp* op() { return fOp; }
|
||||
GrRenderTargetProxy* proxy() const { return fProxy; }
|
||||
GrRenderTarget* renderTarget() const { return fProxy->peekRenderTarget(); }
|
||||
GrAppliedClip* appliedClip() { return fAppliedClip; }
|
||||
const GrAppliedClip* appliedClip() const { return fAppliedClip; }
|
||||
const GrXferProcessor::DstProxy& dstProxy() const { return fDstProxy; }
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
void validate() const {
|
||||
SkASSERT(fOp);
|
||||
SkASSERT(fProxy);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
GrOp* fOp;
|
||||
GrRenderTargetProxy* fProxy;
|
||||
GrAppliedClip* fAppliedClip;
|
||||
GrXferProcessor::DstProxy fDstProxy; // TODO: do we still need the dst proxy here?
|
||||
};
|
||||
|
||||
void setOpArgs(OpArgs* opArgs) { fOpArgs = opArgs; }
|
||||
|
||||
const OpArgs& drawOpArgs() const {
|
||||
SkASSERT(fOpArgs);
|
||||
SkASSERT(fOpArgs->fOp);
|
||||
SkDEBUGCODE(fOpArgs->validate());
|
||||
return *fOpArgs;
|
||||
}
|
||||
|
||||
@ -105,10 +127,10 @@ public:
|
||||
int* actualIndexCount) final;
|
||||
void putBackIndices(int indexCount) final;
|
||||
void putBackVertices(int vertices, size_t vertexStride) final;
|
||||
GrRenderTargetProxy* proxy() const final { return fOpArgs->fProxy; }
|
||||
const GrAppliedClip* appliedClip() final { return fOpArgs->fAppliedClip; }
|
||||
GrRenderTargetProxy* proxy() const final { return fOpArgs->proxy(); }
|
||||
const GrAppliedClip* appliedClip() final { return fOpArgs->appliedClip(); }
|
||||
GrAppliedClip detachAppliedClip() final;
|
||||
const GrXferProcessor::DstProxy& dstProxy() const final { return fOpArgs->fDstProxy; }
|
||||
const GrXferProcessor::DstProxy& dstProxy() const final { return fOpArgs->dstProxy(); }
|
||||
GrDeferredUploadTarget* deferredUploadTarget() final { return this; }
|
||||
const GrCaps& caps() const final;
|
||||
GrResourceProvider* resourceProvider() const final { return fResourceProvider; }
|
||||
|
@ -412,13 +412,12 @@ void GrOpsTask::onPrepare(GrOpFlushState* flushState) {
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
TRACE_EVENT0("skia.gpu", chain.head()->name());
|
||||
#endif
|
||||
GrOpFlushState::OpArgs opArgs = {
|
||||
GrOpFlushState::OpArgs opArgs(
|
||||
chain.head(),
|
||||
fTarget->asRenderTargetProxy(),
|
||||
chain.appliedClip(),
|
||||
fTarget.get()->asRenderTargetProxy()->outputSwizzle(),
|
||||
chain.dstProxy()
|
||||
};
|
||||
chain.dstProxy());
|
||||
|
||||
flushState->setOpArgs(&opArgs);
|
||||
chain.head()->prepare(flushState);
|
||||
flushState->setOpArgs(nullptr);
|
||||
@ -532,13 +531,10 @@ bool GrOpsTask::onExecute(GrOpFlushState* flushState) {
|
||||
TRACE_EVENT0("skia.gpu", chain.head()->name());
|
||||
#endif
|
||||
|
||||
GrOpFlushState::OpArgs opArgs {
|
||||
chain.head(),
|
||||
fTarget->asRenderTargetProxy(),
|
||||
chain.appliedClip(),
|
||||
fTarget.get()->asRenderTargetProxy()->outputSwizzle(),
|
||||
chain.dstProxy()
|
||||
};
|
||||
GrOpFlushState::OpArgs opArgs(chain.head(),
|
||||
fTarget->asRenderTargetProxy(),
|
||||
chain.appliedClip(),
|
||||
chain.dstProxy());
|
||||
|
||||
flushState->setOpArgs(&opArgs);
|
||||
chain.head()->execute(flushState, chain.bounds());
|
||||
|
@ -433,8 +433,8 @@ void GrCCDrawPathsOp::onExecute(GrOpFlushState* flushState, const SkRect& chainB
|
||||
|
||||
GrPipeline::InitArgs initArgs;
|
||||
initArgs.fCaps = &flushState->caps();
|
||||
initArgs.fDstProxy = flushState->drawOpArgs().fDstProxy;
|
||||
initArgs.fOutputSwizzle = flushState->drawOpArgs().fOutputSwizzle;
|
||||
initArgs.fDstProxy = flushState->drawOpArgs().dstProxy();
|
||||
initArgs.fOutputSwizzle = flushState->drawOpArgs().outputSwizzle();
|
||||
auto clip = flushState->detachAppliedClip();
|
||||
GrPipeline::FixedDynamicState fixedDynamicState(clip.scissorState().rect());
|
||||
GrPipeline pipeline(initArgs, std::move(fProcessors), std::move(clip));
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
srcProxy->textureSwizzle(), srcProxy->origin());
|
||||
|
||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrc,
|
||||
flushState->drawOpArgs().fOutputSwizzle);
|
||||
flushState->drawOpArgs().outputSwizzle());
|
||||
GrPipeline::FixedDynamicState dynamicState;
|
||||
dynamicState.fPrimitiveProcessorTextures = &srcProxy;
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||
ProcessorType proc;
|
||||
GrPipeline pipeline(GrScissorTest::kEnabled, SkBlendMode::kPlus,
|
||||
flushState->drawOpArgs().fOutputSwizzle);
|
||||
flushState->drawOpArgs().outputSwizzle());
|
||||
fResources->filler().drawFills(flushState, &proc, pipeline, fFillBatchID, fDrawBounds);
|
||||
fResources->stroker().drawStrokes(flushState, &proc, fStrokeBatchID, fDrawBounds);
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ void GrCCStroker::drawStrokes(GrOpFlushState* flushState, GrCCCoverageProcessor*
|
||||
? &fZeroTallies : fScissorSubBatches[startScissorSubBatch - 1].fEndInstances;
|
||||
|
||||
GrPipeline pipeline(GrScissorTest::kEnabled, SkBlendMode::kPlus,
|
||||
flushState->drawOpArgs().fOutputSwizzle);
|
||||
flushState->drawOpArgs().outputSwizzle());
|
||||
|
||||
// Draw linear strokes.
|
||||
this->appendStrokeMeshesToBuffers(0, batch, startIndices, startScissorSubBatch, drawBounds);
|
||||
|
@ -116,7 +116,7 @@ void GrStencilAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chain
|
||||
|
||||
GrPipeline pipeline(
|
||||
GrScissorTest::kEnabled, GrDisableColorXPFactory::MakeXferProcessor(),
|
||||
flushState->drawOpArgs().fOutputSwizzle, GrPipeline::InputFlags::kHWAntialias,
|
||||
flushState->drawOpArgs().outputSwizzle(), GrPipeline::InputFlags::kHWAntialias,
|
||||
&kIncrDecrStencil);
|
||||
|
||||
GrSampleMaskProcessor sampleMaskProc;
|
||||
@ -139,7 +139,7 @@ void GrStencilAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chain
|
||||
: &kResolveStencilCoverageAndReset;
|
||||
|
||||
GrPipeline resolvePipeline(GrScissorTest::kEnabled, SkBlendMode::kSrc,
|
||||
flushState->drawOpArgs().fOutputSwizzle, noHWAA,
|
||||
flushState->drawOpArgs().outputSwizzle(), noHWAA,
|
||||
stencilResolveSettings);
|
||||
GrPipeline::FixedDynamicState scissorRectState(drawBoundsRect);
|
||||
|
||||
|
@ -49,8 +49,8 @@ GrPipeline::InitArgs GrDrawPathOpBase::pipelineInitArgs(const GrOpFlushState& st
|
||||
}
|
||||
args.fUserStencil = &kCoverPass;
|
||||
args.fCaps = &state.caps();
|
||||
args.fDstProxy = state.drawOpArgs().fDstProxy;
|
||||
args.fOutputSwizzle = state.drawOpArgs().fOutputSwizzle;
|
||||
args.fDstProxy = state.drawOpArgs().dstProxy();
|
||||
args.fOutputSwizzle = state.drawOpArgs().outputSwizzle();
|
||||
return args;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ const GrProcessorSet::Analysis& GrDrawPathOpBase::doProcessorAnalysis(
|
||||
|
||||
void init_stencil_pass_settings(const GrOpFlushState& flushState,
|
||||
GrPathRendering::FillType fillType, GrStencilSettings* stencil) {
|
||||
const GrAppliedClip* appliedClip = flushState.drawOpArgs().fAppliedClip;
|
||||
const GrAppliedClip* appliedClip = flushState.drawOpArgs().appliedClip();
|
||||
bool stencilClip = appliedClip && appliedClip->hasStencilClip();
|
||||
stencil->reset(GrPathRendering::GetStencilPassSettings(fillType), stencilClip,
|
||||
flushState.drawOpArgs().renderTarget()->renderTargetPriv().numStencilBits());
|
||||
|
@ -741,8 +741,8 @@ void GrFillRRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBou
|
||||
initArgs.fInputFlags = GrPipeline::InputFlags::kHWAntialias;
|
||||
}
|
||||
initArgs.fCaps = &flushState->caps();
|
||||
initArgs.fDstProxy = flushState->drawOpArgs().fDstProxy;
|
||||
initArgs.fOutputSwizzle = flushState->drawOpArgs().fOutputSwizzle;
|
||||
initArgs.fDstProxy = flushState->drawOpArgs().dstProxy();
|
||||
initArgs.fOutputSwizzle = flushState->drawOpArgs().outputSwizzle();
|
||||
auto clip = flushState->detachAppliedClip();
|
||||
GrPipeline::FixedDynamicState* fixedDynamicState =
|
||||
flushState->allocator()->make<GrPipeline::FixedDynamicState>(clip.scissorState().rect());
|
||||
|
@ -34,7 +34,7 @@ void GrStencilPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds
|
||||
GrStencilSettings stencil(GrPathRendering::GetStencilPassSettings(fPath->getFillType()),
|
||||
fHasStencilClip, numStencilBits);
|
||||
|
||||
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().fProxy,
|
||||
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().proxy(),
|
||||
&fViewMatrix, &fScissor, &stencil);
|
||||
state->gpu()->pathRendering()->stencilPath(args, fPath.get());
|
||||
}
|
||||
|
@ -211,13 +211,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo)
|
||||
TestingUploadTarget uploadTarget;
|
||||
|
||||
GrOpFlushState flushState(gpu, resourceProvider, uploadTarget.writeableTokenTracker());
|
||||
GrOpFlushState::OpArgs opArgs = {
|
||||
GrOpFlushState::OpArgs opArgs(
|
||||
op.get(),
|
||||
rtc->asRenderTargetProxy(),
|
||||
nullptr,
|
||||
rtc->asRenderTargetProxy()->outputSwizzle(),
|
||||
GrXferProcessor::DstProxy(nullptr, SkIPoint::Make(0, 0))
|
||||
};
|
||||
GrXferProcessor::DstProxy(nullptr, SkIPoint::Make(0, 0)));
|
||||
|
||||
// Cripple the atlas manager so it can't allocate any pages. This will force a failure
|
||||
// in the preparation of the text op
|
||||
|
@ -141,7 +141,7 @@ private:
|
||||
}
|
||||
void onPrepare(GrOpFlushState*) override {}
|
||||
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
|
||||
GrPipeline pipeline(fScissorTest, SkBlendMode::kSrc, state->drawOpArgs().fOutputSwizzle);
|
||||
GrPipeline pipeline(fScissorTest, SkBlendMode::kSrc, state->drawOpArgs().outputSwizzle());
|
||||
SkSTArray<kNumMeshes, GrMesh> meshes;
|
||||
for (int i = 0; i < kNumMeshes; ++i) {
|
||||
GrMesh& mesh = meshes.emplace_back(GrPrimitiveType::kTriangleStrip);
|
||||
|
Loading…
Reference in New Issue
Block a user