Store the correct number of samples in GrProgramInfo

Bug: skia:11396
Change-Id: I9480b89635bd7a6bdff8ab4876c8eeafdbc27c8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442096
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Chris Dalton 2021-08-26 10:05:11 -06:00 committed by SkCQ
parent 82d081465e
commit 2a26c50a62
41 changed files with 174 additions and 89 deletions

View File

@ -184,6 +184,7 @@ private:
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -103,6 +103,7 @@ protected:
GrPipeline::InputFlags flags = GrPipeline::InputFlags::kNone;
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView, gp,
std::move(fProcessorSet),

View File

@ -150,13 +150,14 @@ private:
GrProgramInfo* createProgramInfo(const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) const {
GrGeometryProcessor* geomProc = ClockwiseTestProcessor::Make(arena, fReadSkFragCoord);
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView,
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
geomProc, SkBlendMode::kPlus,
GrPrimitiveType::kTriangleStrip,
@ -167,6 +168,7 @@ private:
return this->createProgramInfo(&flushState->caps(),
flushState->allocator(),
flushState->writeView(),
flushState->usesMSAASurface(),
flushState->detachAppliedClip(),
flushState->dstProxyView(),
flushState->renderPassBarriers(),
@ -181,12 +183,15 @@ private:
GrLoadOp colorLoadOp) final {
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
// This is equivalent to a GrOpFlushState::detachAppliedClip
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
fProgramInfo = this->createProgramInfo(context->priv().caps(), arena, writeView,
std::move(appliedClip), dstProxyView,
renderPassXferBarriers, colorLoadOp);
usesMSAASurface, std::move(appliedClip),
dstProxyView, renderPassXferBarriers, colorLoadOp);
context->priv().recordProgramInfo(fProgramInfo);
}

View File

@ -171,13 +171,14 @@ private:
GrProgramInfo* createProgramInfo(const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) const {
GrGeometryProcessor* geomProc = FwidthSquircleTestProcessor::Make(arena, fViewMatrix);
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView,
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
geomProc, SkBlendMode::kSrcOver,
GrPrimitiveType::kTriangleStrip,
@ -188,6 +189,7 @@ private:
return this->createProgramInfo(&flushState->caps(),
flushState->allocator(),
flushState->writeView(),
flushState->usesMSAASurface(),
flushState->detachAppliedClip(),
flushState->dstProxyView(),
flushState->renderPassBarriers(),
@ -202,12 +204,15 @@ private:
GrLoadOp colorLoadOp) final {
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
// This is equivalent to a GrOpFlushState::detachAppliedClip
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
fProgramInfo = this->createProgramInfo(context->priv().caps(), arena, writeView,
std::move(appliedClip), dstProxyView,
renderPassXferBarriers, colorLoadOp);
usesMSAASurface, std::move(appliedClip),
dstProxyView, renderPassXferBarriers, colorLoadOp);
context->priv().recordProgramInfo(fProgramInfo);
}

View File

@ -336,7 +336,8 @@ private:
shader = std::make_unique<TessellationTestRectShader>(fViewMatrix);
}
GrProgramInfo programInfo(state->writeView(), &pipeline, &GrUserStencilSettings::kUnused,
GrProgramInfo programInfo(state->caps(), state->writeView(), state->usesMSAASurface(),
&pipeline, &GrUserStencilSettings::kUnused,
shader.get(), GrPrimitiveType::kPatches,
tessellationPatchVertexCount, state->renderPassBarriers(),
state->colorLoadOp());

View File

@ -109,6 +109,7 @@ private:
}
fTessellator->prepare(flushState, this->bounds(), {pathMatrix, fPath}, fPath.countVerbs());
fProgram = GrTessellationShader::MakeProgram({alloc, flushState->writeView(),
flushState->usesMSAASurface(),
&flushState->dstProxyView(),
flushState->renderPassBarriers(),
GrLoadOp::kClear, &flushState->caps()},

View File

@ -51,7 +51,9 @@ void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
++fCurrUpload;
}
GrProgramInfo programInfo(this->writeView(),
GrProgramInfo programInfo(this->caps(),
this->writeView(),
this->usesMSAASurface(),
pipeline,
userStencilSettings,
fCurrDraw->fGeometryProcessor,

View File

@ -16,7 +16,9 @@ class GrStencilSettings;
class GrProgramInfo {
public:
GrProgramInfo(const GrSurfaceProxyView& targetView,
GrProgramInfo(const GrCaps& caps,
const GrSurfaceProxyView& targetView,
bool usesMSAASurface,
const GrPipeline* pipeline,
const GrUserStencilSettings* userStencilSettings,
const GrGeometryProcessor* geomProc,
@ -24,8 +26,7 @@ public:
uint8_t tessellationPatchVertexCount,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp)
: fNumSamples(targetView.asRenderTargetProxy()->numSamples())
, fNeedsStencil(targetView.asRenderTargetProxy()->needsStencil())
: fNeedsStencil(targetView.asRenderTargetProxy()->needsStencil())
, fBackendFormat(targetView.proxy()->backendFormat())
, fOrigin(targetView.origin())
, fTargetHasVkResolveAttachmentWithInput(
@ -41,7 +42,11 @@ public:
, fTessellationPatchVertexCount(tessellationPatchVertexCount)
, fRenderPassXferBarriers(renderPassXferBarriers)
, fColorLoadOp(colorLoadOp) {
SkASSERT(this->numSamples() > 0);
SkASSERT(fTargetsNumSamples > 0);
fNumSamples = fTargetsNumSamples;
if (fNumSamples == 1 && usesMSAASurface) {
fNumSamples = caps.internalMultisampleCount(this->backendFormat());
}
SkASSERT((GrPrimitiveType::kPatches == fPrimitiveType) ==
(fTessellationPatchVertexCount > 0));
SkDEBUGCODE(this->validate(false);)
@ -96,9 +101,9 @@ public:
private:
int fNumSamples;
const bool fNeedsStencil;
const GrBackendFormat fBackendFormat;
const GrSurfaceOrigin fOrigin;
bool fNeedsStencil;
GrBackendFormat fBackendFormat;
GrSurfaceOrigin fOrigin;
bool fTargetHasVkResolveAttachmentWithInput;
int fTargetsNumSamples;
const GrPipeline* fPipeline;

View File

@ -742,7 +742,7 @@ private:
fHelper.usesLocalCoords(),
fWideColor);
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip),
dstProxyView, quadProcessor,
GrPrimitiveType::kTriangles,

View File

@ -828,18 +828,21 @@ public:
private:
void makeLineProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp);
void makeQuadProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp);
void makeConicProgramInfo(const GrCaps&, SkArenaAlloc*, const GrPipeline*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
@ -946,6 +949,7 @@ GR_MAKE_BITFIELD_CLASS_OPS(AAHairlineOp::Program)
void AAHairlineOp::makeLineProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
@ -972,13 +976,14 @@ void AAHairlineOp::makeLineProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
}
fProgramInfos[0] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
arena, pipeline, writeView, lineGP, GrPrimitiveType::kTriangles,
&caps, arena, pipeline, writeView, usesMSAASurface, lineGP, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp, fHelper.stencilSettings());
}
void AAHairlineOp::makeQuadProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
@ -997,13 +1002,14 @@ void AAHairlineOp::makeQuadProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
SkASSERT(sizeof(BezierVertex) == quadGP->vertexStride());
fProgramInfos[1] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
arena, pipeline, writeView, quadGP, GrPrimitiveType::kTriangles,
&caps, arena, pipeline, writeView, usesMSAASurface, quadGP, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp, fHelper.stencilSettings());
}
void AAHairlineOp::makeConicProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
const SkMatrix* geometryProcessorViewM,
const SkMatrix* geometryProcessorLocalM,
GrXferBarrierFlags renderPassXferBarriers,
@ -1022,8 +1028,9 @@ void AAHairlineOp::makeConicProgramInfo(const GrCaps& caps, SkArenaAlloc* arena,
SkASSERT(sizeof(BezierVertex) == conicGP->vertexStride());
fProgramInfos[2] = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
arena, pipeline, writeView, conicGP, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp, fHelper.stencilSettings());
&caps, arena, pipeline, writeView, usesMSAASurface, conicGP,
GrPrimitiveType::kTriangles, renderPassXferBarriers, colorLoadOp,
fHelper.stencilSettings());
}
AAHairlineOp::Program AAHairlineOp::predictPrograms(const GrCaps* caps) const {
@ -1079,17 +1086,17 @@ void AAHairlineOp::onCreateProgramInfo(const GrCaps* caps,
std::move(appliedClip), dstProxyView);
if (fCharacterization & Program::kLine) {
this->makeLineProgramInfo(*caps, arena, pipeline, writeView,
this->makeLineProgramInfo(*caps, arena, pipeline, writeView, usesMSAASurface,
geometryProcessorViewM, geometryProcessorLocalM,
renderPassXferBarriers, colorLoadOp);
}
if (fCharacterization & Program::kQuad) {
this->makeQuadProgramInfo(*caps, arena, pipeline, writeView,
this->makeQuadProgramInfo(*caps, arena, pipeline, writeView, usesMSAASurface,
geometryProcessorViewM, geometryProcessorLocalM,
renderPassXferBarriers, colorLoadOp);
}
if (fCharacterization & Program::kConic) {
this->makeConicProgramInfo(*caps, arena, pipeline, writeView,
this->makeConicProgramInfo(*caps, arena, pipeline, writeView, usesMSAASurface,
geometryProcessorViewM, geometryProcessorLocalM,
renderPassXferBarriers, colorLoadOp);

View File

@ -165,7 +165,7 @@ private:
return;
}
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);

View File

@ -486,8 +486,9 @@ private:
SkASSERT(gp->vertexStride() == sizeof(SkPoint));
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
std::move(appliedClip),
dstProxyView, gp, this->primType(),
usesMSAASurface,
std::move(appliedClip), dstProxyView,
gp, this->primType(),
renderPassXferBarriers, colorLoadOp);
}

View File

@ -349,6 +349,7 @@ private:
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -214,9 +214,10 @@ void DrawAtlasOp::onCreateProgramInfo(const GrCaps* caps,
this->color(),
this->viewMatrix());
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
GrPrimitiveType::kTriangles, renderPassXferBarriers,
colorLoadOp);
}
void DrawAtlasOp::onPrepareDraws(GrMeshDrawTarget* target) {

View File

@ -158,8 +158,9 @@ void GrDrawAtlasPathOp::prepareProgram(const GrCaps& caps, SkArenaAlloc* arena,
std::move(appliedClip));
auto shader = arena->make<DrawAtlasPathShader>(fUsesLocalCoords, &fAtlasHelper,
*caps.shaderCaps());
fProgram = arena->make<GrProgramInfo>(writeView, pipeline, &GrUserStencilSettings::kUnused,
shader, GrPrimitiveType::kTriangleStrip, 0,
fProgram = arena->make<GrProgramInfo>(caps, writeView, usesMSAASurface, pipeline,
&GrUserStencilSettings::kUnused, shader,
GrPrimitiveType::kTriangleStrip, 0,
renderPassXferBarriers, colorLoadOp);
}
@ -168,10 +169,11 @@ void GrDrawAtlasPathOp::onPrePrepare(GrRecordingContext* rContext,
GrAppliedClip* appliedClip, const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
this->prepareProgram(*rContext->priv().caps(), rContext->priv().recordTimeAllocator(),
writeView, writeView.asRenderTargetProxy()->numSamples() > 1,
std::move(*appliedClip), dstProxyView, renderPassXferBarriers,
colorLoadOp);
writeView, usesMSAASurface, std::move(*appliedClip), dstProxyView,
renderPassXferBarriers, colorLoadOp);
SkASSERT(fProgram);
rContext->priv().recordProgramInfo(fProgram);
}

View File

@ -389,9 +389,10 @@ void DrawVerticesOp::onCreateProgramInfo(const GrCaps* caps,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
GrGeometryProcessor* gp = this->makeGP(arena);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, this->primitiveType(),
renderPassXferBarriers, colorLoadOp);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
this->primitiveType(), renderPassXferBarriers,
colorLoadOp);
}
void DrawVerticesOp::onPrepareDraws(GrMeshDrawTarget* target) {

View File

@ -773,9 +773,10 @@ void FillRRectOp::onCreateProgramInfo(const GrCaps* caps,
fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
}
GrGeometryProcessor* gp = Processor::Make(arena, fHelper.aaType(), fProcessorFlags);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
GrPrimitiveType::kTriangles, renderPassXferBarriers,
colorLoadOp);
}
void FillRRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {

View File

@ -213,7 +213,7 @@ private:
GrGeometryProcessor* gp = GrQuadPerEdgeAA::MakeProcessor(arena, vertexSpec);
SkASSERT(gp->vertexStride() == vertexSpec.vertexSize());
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip),
dstProxyView, gp,
vertexSpec.primitiveType(),

View File

@ -215,6 +215,7 @@ private:
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView, gp,
fHelper.detachProcessorSet(),

View File

@ -1258,6 +1258,7 @@ private:
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,
@ -1629,6 +1630,7 @@ private:
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,
@ -1964,6 +1966,7 @@ private:
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,
@ -2245,8 +2248,9 @@ private:
this->viewMatrix(),
this->style());
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}
@ -2659,8 +2663,9 @@ private:
false, false, false, false,
fWideColor, localMatrix);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}
@ -2979,8 +2984,9 @@ private:
GrGeometryProcessor* gp = EllipseGeometryProcessor::Make(arena, fStroked, fWideColor,
fUseScale, localMatrix);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView, gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}

View File

@ -97,7 +97,7 @@ private:
return;
}
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);

View File

@ -537,6 +537,7 @@ private:
SkASSERT(sizeof(CircleVertex) == gp->vertexStride());
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView, gp,
GrProcessorSet::MakeEmptySet(),

View File

@ -166,6 +166,7 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(
const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrGeometryProcessor* geometryProcessor,
@ -183,19 +184,23 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(
std::move(processorSet),
pipelineFlags);
return CreateProgramInfo(arena, pipeline, writeView, geometryProcessor, primitiveType,
renderPassXferBarriers, colorLoadOp, stencilSettings);
return CreateProgramInfo(caps, arena, pipeline, writeView, usesMSAASurface, geometryProcessor,
primitiveType, renderPassXferBarriers, colorLoadOp, stencilSettings);
}
GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(SkArenaAlloc* arena,
GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(const GrCaps* caps,
SkArenaAlloc* arena,
const GrPipeline* pipeline,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrGeometryProcessor* geometryProcessor,
GrPrimitiveType primitiveType,
GrXferBarrierFlags xferBarrierFlags,
GrLoadOp colorLoadOp,
const GrUserStencilSettings* stencilSettings) {
auto tmp = arena->make<GrProgramInfo>(writeView,
auto tmp = arena->make<GrProgramInfo>(*caps,
writeView,
usesMSAASurface,
pipeline,
stencilSettings,
geometryProcessor,
@ -210,6 +215,7 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::createProgramInfo(
const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrGeometryProcessor* gp,
@ -219,6 +225,7 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::createProgramInfo(
return CreateProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -131,9 +131,11 @@ public:
GrAppliedClip&&,
const GrDstProxyView&);
static GrProgramInfo* CreateProgramInfo(SkArenaAlloc*,
static GrProgramInfo* CreateProgramInfo(const GrCaps*,
SkArenaAlloc*,
const GrPipeline*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrGeometryProcessor*,
GrPrimitiveType,
GrXferBarrierFlags renderPassXferBarriers,
@ -147,6 +149,7 @@ public:
static GrProgramInfo* CreateProgramInfo(const GrCaps*,
SkArenaAlloc*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&&,
const GrDstProxyView&,
GrGeometryProcessor*,
@ -162,6 +165,7 @@ public:
GrProgramInfo* createProgramInfo(const GrCaps*,
SkArenaAlloc*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&&,
const GrDstProxyView&,
GrGeometryProcessor*,

View File

@ -45,7 +45,8 @@ bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
GrProgramInfo* GrSimpleMeshDrawOpHelperWithStencil::createProgramInfoWithStencil(
const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeViewSwizzle,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrGeometryProcessor* gp,
@ -54,7 +55,8 @@ GrProgramInfo* GrSimpleMeshDrawOpHelperWithStencil::createProgramInfoWithStencil
GrLoadOp colorLoadOp) {
return CreateProgramInfo(caps,
arena,
writeViewSwizzle,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -24,7 +24,8 @@ public:
GrProgramInfo* createProgramInfoWithStencil(const GrCaps*,
SkArenaAlloc*,
const GrSurfaceProxyView& writeViewSwizzle,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&&,
const GrDstProxyView&,
GrGeometryProcessor*,

View File

@ -191,8 +191,8 @@ private:
GrPrimitiveType primType = (fStrokeWidth > 0) ? GrPrimitiveType::kTriangleStrip
: GrPrimitiveType::kLineStrip;
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(clip),
dstProxyView, gp, primType,
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(clip), dstProxyView, gp, primType,
renderPassXferBarriers, colorLoadOp);
}
@ -603,6 +603,7 @@ void AAStrokeRectOp::onCreateProgramInfo(const GrCaps* caps,
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -689,7 +689,7 @@ private:
}
fDesc->fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
caps, arena, writeView, std::move(appliedClip), dstProxyView, gp,
caps, arena, writeView, usesMSAASurface, std::move(appliedClip), dstProxyView, gp,
GrProcessorSet::MakeEmptySet(), fDesc->fVertexSpec.primitiveType(),
renderPassXferBarriers, colorLoadOp, GrPipeline::InputFlags::kNone);
}

View File

@ -367,8 +367,11 @@ void PathInnerTriangulateOp::onPrePrepare(GrRecordingContext* context,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
this->prePreparePrograms({context->priv().recordTimeAllocator(), writeView, &dstProxyView,
renderPassXferBarriers, colorLoadOp, context->priv().caps()},
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
this->prePreparePrograms({context->priv().recordTimeAllocator(), writeView, usesMSAASurface,
&dstProxyView, renderPassXferBarriers, colorLoadOp,
context->priv().caps()},
(clip) ? std::move(*clip) : GrAppliedClip::Disabled());
if (fStencilCurvesProgram) {
context->priv().recordProgramInfo(fStencilCurvesProgram);
@ -386,9 +389,9 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gHullVertexBufferKey);
void PathInnerTriangulateOp::onPrepare(GrOpFlushState* flushState) {
if (!fFanTriangulator) {
this->prePreparePrograms({flushState->allocator(), flushState->writeView(),
&flushState->dstProxyView(), flushState->renderPassBarriers(),
flushState->colorLoadOp(), &flushState->caps()},
flushState->detachAppliedClip());
flushState->usesMSAASurface(), &flushState->dstProxyView(),
flushState->renderPassBarriers(), flushState->colorLoadOp(),
&flushState->caps()}, flushState->detachAppliedClip());
if (!fFanTriangulator) {
return;
}

View File

@ -184,9 +184,11 @@ void PathStencilCoverOp::prePreparePrograms(const GrTessellationShader::ProgramA
auto* bboxStencil = GrPathTessellationShader::TestAndResetStencilSettings(
SkPathFillType_IsInverse(this->pathFillType()));
fCoverBBoxProgram = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
args.fCaps,
args.fArena,
bboxPipeline,
args.fWriteView,
args.fUsesMSAASurface,
bboxShader,
GrPrimitiveType::kTriangleStrip,
args.fXferBarrierFlags,
@ -200,8 +202,11 @@ void PathStencilCoverOp::onPrePrepare(GrRecordingContext* context,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
this->prePreparePrograms({context->priv().recordTimeAllocator(), writeView, &dstProxyView,
renderPassXferBarriers, colorLoadOp, context->priv().caps()},
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
this->prePreparePrograms({context->priv().recordTimeAllocator(), writeView, usesMSAASurface,
&dstProxyView, renderPassXferBarriers, colorLoadOp,
context->priv().caps()},
(clip) ? std::move(*clip) : GrAppliedClip::Disabled());
if (fStencilFanProgram) {
context->priv().recordProgramInfo(fStencilFanProgram);
@ -219,9 +224,9 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gUnitQuadBufferKey);
void PathStencilCoverOp::onPrepare(GrOpFlushState* flushState) {
if (!fTessellator) {
this->prePreparePrograms({flushState->allocator(), flushState->writeView(),
&flushState->dstProxyView(), flushState->renderPassBarriers(),
flushState->colorLoadOp(), &flushState->caps()},
flushState->detachAppliedClip());
flushState->usesMSAASurface(), &flushState->dstProxyView(),
flushState->renderPassBarriers(), flushState->colorLoadOp(),
&flushState->caps()}, flushState->detachAppliedClip());
if (!fTessellator) {
return;
}

View File

@ -46,8 +46,11 @@ void PathTessellateOp::onPrePrepare(GrRecordingContext* context,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
this->prepareTessellator({context->priv().recordTimeAllocator(), writeView, &dstProxyView,
renderPassXferBarriers, colorLoadOp, context->priv().caps()},
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
this->prepareTessellator({context->priv().recordTimeAllocator(), writeView, usesMSAASurface,
&dstProxyView, renderPassXferBarriers, colorLoadOp,
context->priv().caps()},
(clip) ? std::move(*clip) : GrAppliedClip::Disabled());
SkASSERT(fTessellationProgram);
context->priv().recordProgramInfo(fTessellationProgram);
@ -56,9 +59,9 @@ void PathTessellateOp::onPrePrepare(GrRecordingContext* context,
void PathTessellateOp::onPrepare(GrOpFlushState* flushState) {
if (!fTessellator) {
this->prepareTessellator({flushState->allocator(), flushState->writeView(),
&flushState->dstProxyView(), flushState->renderPassBarriers(),
flushState->colorLoadOp(), &flushState->caps()},
flushState->detachAppliedClip());
flushState->usesMSAASurface(), &flushState->dstProxyView(),
flushState->renderPassBarriers(), flushState->colorLoadOp(),
&flushState->caps()}, flushState->detachAppliedClip());
SkASSERT(fTessellator);
}
fTessellator->prepare(flushState, this->bounds(), {SkMatrix::I(), fPath}, fPath.countVerbs());

View File

@ -227,8 +227,11 @@ void StrokeTessellateOp::onPrePrepare(GrRecordingContext* context,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers, GrLoadOp
colorLoadOp) {
this->prePrepareTessellator({context->priv().recordTimeAllocator(), writeView, &dstProxyView,
renderPassXferBarriers, colorLoadOp, context->priv().caps()},
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
this->prePrepareTessellator({context->priv().recordTimeAllocator(), writeView, usesMSAASurface,
&dstProxyView, renderPassXferBarriers, colorLoadOp,
context->priv().caps()},
(clip) ? std::move(*clip) : GrAppliedClip::Disabled());
if (fStencilProgram) {
context->priv().recordProgramInfo(fStencilProgram);
@ -241,9 +244,9 @@ void StrokeTessellateOp::onPrePrepare(GrRecordingContext* context,
void StrokeTessellateOp::onPrepare(GrOpFlushState* flushState) {
if (!fTessellator) {
this->prePrepareTessellator({flushState->allocator(), flushState->writeView(),
&flushState->dstProxyView(), flushState->renderPassBarriers(),
flushState->colorLoadOp(), &flushState->caps()},
flushState->detachAppliedClip());
flushState->usesMSAASurface(), &flushState->dstProxyView(),
flushState->renderPassBarriers(), flushState->colorLoadOp(),
&flushState->caps()}, flushState->detachAppliedClip());
}
SkASSERT(fTessellator);
fTessellator->prepare(flushState, fTotalCombinedVerbCnt);

View File

@ -414,6 +414,7 @@ private:
: GrPrimitiveType::kTriangles;
fProgramInfo = fHelper.createProgramInfoWithStencil(caps, arena, writeView,
usesMSAASurface,
std::move(appliedClip), dstProxyView,
gp, primitiveType,
renderPassXferBarriers, colorLoadOp);

View File

@ -60,6 +60,7 @@ public:
struct ProgramArgs {
SkArenaAlloc* fArena;
const GrSurfaceProxyView& fWriteView;
bool fUsesMSAASurface;
const GrDstProxyView* fDstProxyView;
GrXferBarrierFlags fXferBarrierFlags;
GrLoadOp fColorLoadOp;
@ -73,8 +74,8 @@ public:
const GrTessellationShader* shader,
const GrPipeline* pipeline,
const GrUserStencilSettings* stencil) {
return args.fArena->make<GrProgramInfo>(args.fWriteView, pipeline, stencil, shader,
shader->fPrimitiveType,
return args.fArena->make<GrProgramInfo>(*args.fCaps, args.fWriteView, args.fUsesMSAASurface,
pipeline, stencil, shader, shader->fPrimitiveType,
shader->fTessellationPatchVertexCount,
args.fXferBarrierFlags, args.fColorLoadOp);
}

View File

@ -570,9 +570,9 @@ GrOpsRenderPass* DrawMeshHelper::bindPipeline(GrPrimitiveType primitiveType, boo
GrGeometryProcessor* mtp = MeshTestProcessor::Make(fState->allocator(), isInstanced,
hasVertexBuffer);
GrProgramInfo programInfo(fState->writeView(), pipeline, &GrUserStencilSettings::kUnused,
mtp, primitiveType, 0, fState->renderPassBarriers(),
fState->colorLoadOp());
GrProgramInfo programInfo(fState->caps(), fState->writeView(), fState->usesMSAASurface(),
pipeline, &GrUserStencilSettings::kUnused, mtp, primitiveType, 0,
fState->renderPassBarriers(), fState->colorLoadOp());
fState->opsRenderPass()->bindPipeline(programInfo, SkRect::MakeIWH(kImageWidth, kImageHeight));
return fState->opsRenderPass();

View File

@ -160,7 +160,9 @@ private:
auto geomProc = PipelineDynamicStateTestProcessor::Make(flushState->allocator());
GrProgramInfo programInfo(flushState->writeView(),
GrProgramInfo programInfo(flushState->caps(),
flushState->writeView(),
flushState->usesMSAASurface(),
&pipeline,
&GrUserStencilSettings::kUnused,
geomProc,

View File

@ -457,6 +457,7 @@ private:
GrProgramInfo* createProgramInfo(const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
@ -470,7 +471,7 @@ private:
LocalCoords::kUnused_Type,
SkMatrix::I());
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView,
return sk_gpu_test::CreateProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
gp, SkBlendMode::kSrcOver,
GrPrimitiveType::kTriangleStrip,
@ -481,6 +482,7 @@ private:
return this->createProgramInfo(&flushState->caps(),
flushState->allocator(),
flushState->writeView(),
flushState->usesMSAASurface(),
flushState->detachAppliedClip(),
flushState->dstProxyView(),
flushState->renderPassBarriers(),
@ -555,12 +557,15 @@ private:
GrLoadOp colorLoadOp) override {
SkArenaAlloc* arena = rContext->priv().recordTimeAllocator();
// DMSAA is not supported on DDL.
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
// This is equivalent to a GrOpFlushState::detachAppliedClip
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
fProgramInfo = this->createProgramInfo(rContext->priv().caps(), arena, writeView,
std::move(appliedClip), dstProxyView,
renderPassXferBarriers, colorLoadOp);
usesMSAASurface, std::move(appliedClip),
dstProxyView, renderPassXferBarriers, colorLoadOp);
rContext->priv().recordProgramInfo(fProgramInfo);

View File

@ -130,6 +130,7 @@ private:
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
gp,

View File

@ -95,6 +95,7 @@ GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext* dContext,
GrProgramInfo* CreateProgramInfo(const GrCaps* caps,
SkArenaAlloc* arena,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&& appliedClip,
const GrDstProxyView& dstProxyView,
GrGeometryProcessor* geomProc,
@ -115,7 +116,7 @@ GrProgramInfo* CreateProgramInfo(const GrCaps* caps,
GrClampType::kAuto, &analysisColor);
SkASSERT(!analysis.requiresDstTexture());
return GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
return GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView, usesMSAASurface,
std::move(appliedClip), dstProxyView,
geomProc, std::move(processors),
primitiveType, renderPassXferBarriers,

View File

@ -32,6 +32,7 @@ GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext*,
GrProgramInfo* CreateProgramInfo(const GrCaps*,
SkArenaAlloc*,
const GrSurfaceProxyView& writeView,
bool usesMSAASurface,
GrAppliedClip&&,
const GrDstProxyView&,
GrGeometryProcessor*,

View File

@ -187,6 +187,7 @@ void TestRectOp::onCreateProgramInfo(const GrCaps* caps,
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
usesMSAASurface,
std::move(appliedClip),
dstProxyView,
&fGP,