Add a "usesMSAASurface" arg to GrMeshDrawOp::onCreateProgramInfo
onCreateProgramInfo needs to know if DMSAA will be rendering to a separate MSAA target in order to properly set up its pipeline and shaders. This CL mostly just plumbs this unformation through, but also cleans up FillRRectOp now that this information is available. Bug: skia:12201 Change-Id: I7300d2725da72484a12bd0c9d3ad298ae81bff90 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427577 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
f91013f44b
commit
6aaf00fa7e
@ -172,6 +172,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -89,6 +89,7 @@ protected:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -755,6 +755,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -907,6 +907,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -1108,6 +1109,7 @@ AAHairlineOp::Program AAHairlineOp::predictPrograms(const GrCaps* caps) const {
|
||||
void AAHairlineOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -1157,14 +1159,17 @@ void AAHairlineOp::onPrePrepareDraws(GrRecordingContext* context,
|
||||
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
|
||||
const GrCaps* caps = context->priv().caps();
|
||||
|
||||
// http://skbug.com/12201 -- DDL does not yet support DMSAA.
|
||||
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
|
||||
|
||||
// This is equivalent to a GrOpFlushState::detachAppliedClip
|
||||
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
|
||||
|
||||
// Conservatively predict which programs will be required
|
||||
fCharacterization = this->predictPrograms(caps);
|
||||
|
||||
this->createProgramInfo(caps, arena, writeView, std::move(appliedClip), dstProxyView,
|
||||
renderPassXferBarriers, colorLoadOp);
|
||||
this->createProgramInfo(caps, arena, writeView, usesMSAASurface, std::move(appliedClip),
|
||||
dstProxyView, renderPassXferBarriers, colorLoadOp);
|
||||
|
||||
context->priv().recordProgramInfo(fProgramInfos[0]);
|
||||
context->priv().recordProgramInfo(fProgramInfos[1]);
|
||||
|
@ -202,6 +202,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -171,6 +171,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -316,6 +316,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -474,6 +474,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -54,6 +54,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -201,6 +202,7 @@ SkString DrawAtlasOp::onDumpInfo() const {
|
||||
void DrawAtlasOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -234,6 +234,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -394,6 +395,7 @@ GrGeometryProcessor* DrawVerticesOp::makeGP(SkArenaAlloc* arena) {
|
||||
void DrawVerticesOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -97,6 +97,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -509,10 +510,6 @@ static constexpr uint16_t kIndexData[] = {
|
||||
GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
|
||||
|
||||
void FillRRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
|
||||
if (target->usesMSAASurface()) {
|
||||
fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
|
||||
}
|
||||
|
||||
if (!fProgramInfo) {
|
||||
this->createProgramInfo(target);
|
||||
}
|
||||
@ -767,21 +764,21 @@ GrGLSLGeometryProcessor* FillRRectOp::Processor::createGLSLInstance(const GrShad
|
||||
void FillRRectOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
if (writeView.asRenderTargetProxy()->numSamples() > 1) {
|
||||
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
|
||||
if (usesMSAASurface) {
|
||||
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
|
||||
fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
|
||||
}
|
||||
auto extraPipelineFlags = (fProcessorFlags & ProcessorFlags::kMSAAEnabled)
|
||||
? GrPipeline::InputFlags::kHWAntialias
|
||||
: GrPipeline::InputFlags::kNone;
|
||||
GrGeometryProcessor* gp = Processor::Make(arena, fHelper.aaType(), fProcessorFlags);
|
||||
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
|
||||
caps, arena, writeView, std::move(appliedClip), dstProxyView, gp,
|
||||
fHelper.detachProcessorSet(), GrPrimitiveType::kTriangles, renderPassXferBarriers,
|
||||
colorLoadOp, fHelper.pipelineFlags() | extraPipelineFlags);
|
||||
colorLoadOp, pipelineFlags);
|
||||
}
|
||||
|
||||
void FillRRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||
|
@ -200,6 +200,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -197,6 +197,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -20,6 +20,7 @@ void GrMeshDrawOp::createProgramInfo(GrMeshDrawTarget* target) {
|
||||
this->createProgramInfo(&target->caps(),
|
||||
target->allocator(),
|
||||
target->writeView(),
|
||||
target->usesMSAASurface(),
|
||||
target->detachAppliedClip(),
|
||||
target->dstProxyView(),
|
||||
target->renderPassBarriers(),
|
||||
@ -45,10 +46,13 @@ void GrMeshDrawOp::onPrePrepareDraws(GrRecordingContext* context,
|
||||
GrLoadOp colorLoadOp) {
|
||||
SkArenaAlloc* arena = context->priv().recordTimeAllocator();
|
||||
|
||||
// http://skbug.com/12201 -- DDL does not yet support DMSAA.
|
||||
bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
|
||||
|
||||
// This is equivalent to a GrOpFlushState::detachAppliedClip
|
||||
GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
|
||||
|
||||
this->createProgramInfo(context->priv().caps(), arena, writeView,
|
||||
this->createProgramInfo(context->priv().caps(), arena, writeView, usesMSAASurface,
|
||||
std::move(appliedClip), dstProxyView, renderPassXferBarriers,
|
||||
colorLoadOp);
|
||||
|
||||
|
@ -38,12 +38,13 @@ protected:
|
||||
void createProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
GrLoadOp colorLoadOp) {
|
||||
this->onCreateProgramInfo(caps, arena, writeView, std::move(appliedClip), dstProxyView,
|
||||
renderPassXferBarriers, colorLoadOp);
|
||||
this->onCreateProgramInfo(caps, arena, writeView, usesMSAASurface, std::move(appliedClip),
|
||||
dstProxyView, renderPassXferBarriers, colorLoadOp);
|
||||
}
|
||||
|
||||
void createProgramInfo(GrMeshDrawTarget*);
|
||||
@ -110,6 +111,7 @@ private:
|
||||
virtual void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -1274,6 +1274,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -1636,6 +1637,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -1969,6 +1971,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -2245,6 +2248,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -2643,6 +2647,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -2966,6 +2971,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -86,6 +86,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -528,6 +528,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -168,6 +168,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -172,6 +172,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& clip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -440,6 +441,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -517,6 +519,7 @@ private:
|
||||
void AAStrokeRectOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -653,6 +653,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -412,6 +412,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -101,6 +101,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -59,6 +59,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
@ -124,6 +124,7 @@ private:
|
||||
void onCreateProgramInfo(const GrCaps*,
|
||||
SkArenaAlloc*,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&&,
|
||||
const GrDstProxyView&,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
@ -183,6 +184,7 @@ TestRectOp::TestRectOp(const GrCaps* caps,
|
||||
void TestRectOp::onCreateProgramInfo(const GrCaps* caps,
|
||||
SkArenaAlloc* arena,
|
||||
const GrSurfaceProxyView& writeView,
|
||||
bool usesMSAASurface,
|
||||
GrAppliedClip&& appliedClip,
|
||||
const GrDstProxyView& dstProxyView,
|
||||
GrXferBarrierFlags renderPassXferBarriers,
|
||||
|
Loading…
Reference in New Issue
Block a user