Update GrProgramInfo's constructor

Change-Id: I3a8ca6913ad64ac4fc29e63f7e26db128774c407
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337118
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-11-20 12:28:45 -05:00 committed by Skia Commit-Bot
parent 6c1191d749
commit 5c80964048
17 changed files with 39 additions and 71 deletions

View File

@ -344,11 +344,10 @@ private:
shader = std::make_unique<TessellationTestRectShader>(fViewMatrix);
}
GrProgramInfo programInfo(state->proxy()->numSamples(), state->proxy()->numStencilSamples(),
state->proxy()->backendFormat(), state->writeView().origin(),
&pipeline, &GrUserStencilSettings::kUnused, shader.get(),
GrPrimitiveType::kPatches, tessellationPatchVertexCount,
state->renderPassBarriers(), state->colorLoadOp());
GrProgramInfo programInfo(state->writeView(), &pipeline, &GrUserStencilSettings::kUnused,
shader.get(), GrPrimitiveType::kPatches,
tessellationPatchVertexCount, state->renderPassBarriers(),
state->colorLoadOp());
state->bindPipeline(programInfo, SkRect::MakeIWH(kWidth, kHeight));
state->bindBuffers(nullptr, nullptr, std::move(fVertexBuffer));

View File

@ -51,10 +51,7 @@ void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
++fCurrUpload;
}
GrProgramInfo programInfo(this->proxy()->numSamples(),
this->proxy()->numStencilSamples(),
this->proxy()->backendFormat(),
this->writeView().origin(),
GrProgramInfo programInfo(this->writeView(),
pipeline,
userStencilSettings,
fCurrDraw->fGeometryProcessor,

View File

@ -73,7 +73,7 @@ public:
GrOp* op() { return fOp; }
const GrSurfaceProxyView& writeView() const { return fSurfaceView; }
GrRenderTargetProxy* proxy() const { return fRenderTargetProxy; }
GrRenderTargetProxy* rtProxy() const { return fRenderTargetProxy; }
GrAppliedClip* appliedClip() { return fAppliedClip; }
const GrAppliedClip* appliedClip() const { return fAppliedClip; }
const GrXferProcessor::DstProxyView& dstProxyView() const { return fDstProxyView; }
@ -145,7 +145,7 @@ public:
void putBackIndices(int indexCount) final;
void putBackVertices(int vertices, size_t vertexStride) final;
const GrSurfaceProxyView& writeView() const final { return this->drawOpArgs().writeView(); }
GrRenderTargetProxy* proxy() const final { return this->drawOpArgs().proxy(); }
GrRenderTargetProxy* rtProxy() const final { return this->drawOpArgs().rtProxy(); }
const GrAppliedClip* appliedClip() const final { return this->drawOpArgs().appliedClip(); }
const GrAppliedHardClip& appliedHardClip() const {
return (fOpArgs->appliedClip()) ?

View File

@ -16,10 +16,7 @@ class GrStencilSettings;
class GrProgramInfo {
public:
GrProgramInfo(int numSamples,
int numStencilSamples,
const GrBackendFormat& backendFormat,
GrSurfaceOrigin origin,
GrProgramInfo(const GrSurfaceProxyView& targetView,
const GrPipeline* pipeline,
const GrUserStencilSettings* userStencilSettings,
const GrPrimitiveProcessor* primProc,
@ -27,10 +24,10 @@ public:
uint8_t tessellationPatchVertexCount,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp)
: fNumSamples(numSamples)
, fNumStencilSamples(numStencilSamples)
, fBackendFormat(backendFormat)
, fOrigin(origin)
: fNumSamples(targetView.asRenderTargetProxy()->numSamples())
, fNumStencilSamples(targetView.asRenderTargetProxy()->numStencilSamples())
, fBackendFormat(targetView.proxy()->backendFormat())
, fOrigin(targetView.origin())
, fPipeline(pipeline)
, fUserStencilSettings(userStencilSettings)
, fPrimProc(primProc)
@ -38,7 +35,7 @@ public:
, fTessellationPatchVertexCount(tessellationPatchVertexCount)
, fRenderPassXferBarriers(renderPassXferBarriers)
, fColorLoadOp(colorLoadOp)
, fIsMixedSampled(this->isStencilEnabled() && numStencilSamples > numSamples) {
, fIsMixedSampled(this->isStencilEnabled() && fNumStencilSamples > fNumSamples) {
SkASSERT(this->numRasterSamples() > 0);
SkASSERT((GrPrimitiveType::kPatches == fPrimitiveType) ==
(fTessellationPatchVertexCount > 0));

View File

@ -198,10 +198,7 @@ GrGLSLPrimitiveProcessor* GrCCCoverageProcessor::createGLSLInstance(const GrShad
void GrCCCoverageProcessor::bindPipeline(GrOpFlushState* flushState, const GrPipeline& pipeline,
const SkRect& drawBounds,
const GrUserStencilSettings* stencil) const {
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->writeView().origin(), &pipeline, stencil, this,
GrProgramInfo programInfo(flushState->writeView(), &pipeline, stencil, this,
this->primType(), 0, flushState->renderPassBarriers(),
flushState->colorLoadOp());
flushState->bindPipeline(programInfo, drawBounds);

View File

@ -144,11 +144,9 @@ void GrCCPathProcessor::drawPaths(GrOpFlushState* flushState, const GrPipeline&
: SK_ARRAY_COUNT(kOctoIndicesAsTris);
auto enablePrimitiveRestart = GrPrimitiveRestart(flushState->caps().usePrimitiveRestart());
GrRenderTargetProxy* rtProxy = flushState->proxy();
GrProgramInfo programInfo(rtProxy->numSamples(), rtProxy->numStencilSamples(),
rtProxy->backendFormat(), flushState->writeView().origin(),
&pipeline, &GrUserStencilSettings::kUnused, this, primitiveType, 0,
flushState->renderPassBarriers(), flushState->colorLoadOp());
GrProgramInfo programInfo(flushState->writeView(), &pipeline, &GrUserStencilSettings::kUnused,
this, primitiveType, 0, flushState->renderPassBarriers(),
flushState->colorLoadOp());
flushState->bindPipelineAndScissorClip(programInfo, bounds);
flushState->bindTextures(*this, atlasProxy, pipeline);

View File

@ -726,10 +726,7 @@ void GrCCStroker::drawLog2Strokes(int numSegmentsLog2, GrOpFlushState* flushStat
const GrPrimitiveProcessor& processor, const GrPipeline& pipeline,
const Batch& batch, const InstanceTallies* startIndices[2],
int startScissorSubBatch, const SkIRect& drawBounds) const {
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->writeView().origin(), &pipeline,
GrProgramInfo programInfo(flushState->writeView(), &pipeline,
&GrUserStencilSettings::kUnused, &processor,
GrPrimitiveType::kTriangleStrip, 0, flushState->renderPassBarriers(),
flushState->colorLoadOp());

View File

@ -178,10 +178,7 @@ void GrStencilAtlasOp::drawResolve(GrOpFlushState* flushState, const GrPipeline&
const GrUserStencilSettings* stencil,
const GrPrimitiveProcessor& primProc,
const SkIRect& drawBounds) const {
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->writeView().origin(), &resolvePipeline, stencil,
GrProgramInfo programInfo(flushState->writeView(), &resolvePipeline, stencil,
&primProc, GrPrimitiveType::kTriangleStrip, 0,
flushState->renderPassBarriers(),
flushState->colorLoadOp());

View File

@ -82,7 +82,7 @@ public:
UNIMPL(uint16_t* makeIndexSpace(int, sk_sp<const GrBuffer>*, int*))
UNIMPL(uint16_t* makeIndexSpaceAtLeast(int, int, sk_sp<const GrBuffer>*, int*, int*))
UNIMPL(void putBackIndices(int))
UNIMPL(GrRenderTargetProxy* proxy() const)
UNIMPL(GrRenderTargetProxy* rtProxy() const)
UNIMPL(const GrSurfaceProxyView& writeView() const)
UNIMPL(const GrAppliedClip* appliedClip() const)
UNIMPL(GrStrikeCache* strikeCache() const)

View File

@ -58,7 +58,7 @@ void init_stencil_pass_settings(const GrOpFlushState& flushState,
GrPathRendering::FillType fillType, GrStencilSettings* stencil) {
const GrAppliedClip* appliedClip = flushState.drawOpArgs().appliedClip();
bool stencilClip = appliedClip && appliedClip->hasStencilClip();
GrRenderTarget* rt = flushState.drawOpArgs().proxy()->peekRenderTarget();
GrRenderTarget* rt = flushState.drawOpArgs().rtProxy()->peekRenderTarget();
stencil->reset(GrPathRendering::GetStencilPassSettings(fillType), stencilClip,
rt->numStencilBits());
}
@ -85,11 +85,7 @@ void GrDrawPathOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBoun
sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
GrRenderTargetProxy* proxy = flushState->proxy();
GrProgramInfo programInfo(proxy->numSamples(),
proxy->numStencilSamples(),
proxy->backendFormat(),
flushState->writeView().origin(),
GrProgramInfo programInfo(flushState->writeView(),
pipeline,
&kCoverPass,
pathProc.get(),
@ -103,7 +99,7 @@ void GrDrawPathOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBoun
GrStencilSettings stencil;
init_stencil_pass_settings(*flushState, this->fillType(), &stencil);
flushState->gpu()->pathRendering()->drawPath(proxy->peekRenderTarget(),
flushState->gpu()->pathRendering()->drawPath(flushState->rtProxy()->peekRenderTarget(),
programInfo, stencil, fPath.get());
}

View File

@ -220,7 +220,7 @@ public:
return this->allocator()->makeArray<const GrSurfaceProxy*>(n);
}
virtual GrRenderTargetProxy* proxy() const = 0;
virtual GrRenderTargetProxy* rtProxy() const = 0;
virtual const GrSurfaceProxyView& writeView() const = 0;
virtual const GrAppliedClip* appliedClip() const = 0;

View File

@ -199,12 +199,7 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(SkArenaAlloc* arena,
GrXferBarrierFlags xferBarrierFlags,
GrLoadOp colorLoadOp,
const GrUserStencilSettings* stencilSettings) {
GrRenderTargetProxy* outputProxy = writeView.asRenderTargetProxy();
auto tmp = arena->make<GrProgramInfo>(outputProxy->numSamples(),
outputProxy->numStencilSamples(),
outputProxy->backendFormat(),
writeView.origin(),
auto tmp = arena->make<GrProgramInfo>(writeView,
pipeline,
stencilSettings,
geometryProcessor,

View File

@ -25,14 +25,14 @@ GrOp::Owner GrStencilPathOp::Make(GrRecordingContext* context,
}
void GrStencilPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
GrRenderTarget* rt = state->drawOpArgs().proxy()->peekRenderTarget();
GrRenderTarget* rt = state->drawOpArgs().rtProxy()->peekRenderTarget();
SkASSERT(rt);
int numStencilBits = rt->numStencilBits();
GrStencilSettings stencil(GrPathRendering::GetStencilPassSettings(fPath->getFillType()),
fHasStencilClip, numStencilBits);
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().proxy(),
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().rtProxy(),
state->drawOpArgs().writeView().origin(),
&fViewMatrix, &fScissor, &stencil);
state->gpu()->pathRendering()->stencilPath(args, fPath.get());

View File

@ -179,11 +179,9 @@ void GrDrawAtlasPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBoun
DrawAtlasPathShader shader(fAtlasProxy.get(), swizzle, fUsesLocalCoords);
SkASSERT(shader.instanceStride() == Instance::Stride(fUsesLocalCoords));
GrProgramInfo programInfo(state->proxy()->numSamples(), state->proxy()->numStencilSamples(),
state->proxy()->backendFormat(), state->writeView().origin(),
&pipeline, &GrUserStencilSettings::kUnused, &shader,
GrPrimitiveType::kTriangleStrip, 0, state->renderPassBarriers(),
state->colorLoadOp());
GrProgramInfo programInfo(state->writeView(), &pipeline, &GrUserStencilSettings::kUnused,
&shader, GrPrimitiveType::kTriangleStrip, 0,
state->renderPassBarriers(), state->colorLoadOp());
state->bindPipelineAndScissorClip(programInfo, this->bounds());
state->bindTextures(shader, *fAtlasProxy, pipeline);

View File

@ -57,10 +57,11 @@ public:
GrLoadOp colorLoadOp,
const GrUserStencilSettings* stencil,
const GrCaps& caps) {
GrRenderTargetProxy* proxy = writeView.asRenderTargetProxy();
return arena->make<GrProgramInfo>(proxy->numSamples(), proxy->numStencilSamples(),
proxy->backendFormat(), writeView.origin(), pipeline,
stencil, shader, shader->fPrimitiveType,
return arena->make<GrProgramInfo>(writeView,
pipeline,
stencil,
shader,
shader->fPrimitiveType,
shader->fTessellationPatchVertexCount,
renderPassXferBarriers, colorLoadOp);
}

View File

@ -574,10 +574,9 @@ GrOpsRenderPass* DrawMeshHelper::bindPipeline(GrPrimitiveType primitiveType, boo
GrGeometryProcessor* mtp = GrMeshTestProcessor::Make(fState->allocator(), isInstanced,
hasVertexBuffer);
GrProgramInfo programInfo(fState->proxy()->numSamples(), fState->proxy()->numStencilSamples(),
fState->proxy()->backendFormat(), fState->writeView().origin(),
pipeline, &GrUserStencilSettings::kUnused, mtp, primitiveType, 0,
fState->renderPassBarriers(), fState->colorLoadOp());
GrProgramInfo programInfo(fState->writeView(), pipeline, &GrUserStencilSettings::kUnused,
mtp, primitiveType, 0, fState->renderPassBarriers(),
fState->colorLoadOp());
fState->opsRenderPass()->bindPipeline(programInfo, SkRect::MakeIWH(kImageWidth, kImageHeight));
return fState->opsRenderPass();

View File

@ -160,10 +160,7 @@ private:
auto geomProc = GrPipelineDynamicStateTestProcessor::Make(flushState->allocator());
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->writeView().origin(),
GrProgramInfo programInfo(flushState->writeView(),
&pipeline,
&GrUserStencilSettings::kUnused,
geomProc,