Delete all code related to disabling multisample

Bug: skia:12196
Change-Id: Iae403ae28e134e4762fc7f58bbfe22bf8c42ab97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436317
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Chris Dalton 2021-08-18 21:39:02 -06:00 committed by SkCQ
parent f8e69ca744
commit eb0195e5b4
29 changed files with 62 additions and 266 deletions

View File

@ -165,8 +165,7 @@ private:
SkString name() override { return SkString("PathTessellators"); }
SkPath fPath;
GrPipeline::InputFlags fPipelineFlags = GrPipeline::InputFlags::kHWAntialias |
GrPipeline::InputFlags::kWireframe;
GrPipeline::InputFlags fPipelineFlags = GrPipeline::InputFlags::kWireframe;
Mode fMode = Mode::kWedgeMiddleOut;
float fConicWeight = .5;

View File

@ -26,7 +26,6 @@ GrCaps::GrCaps(const GrContextOptions& options) {
fOversizedStencilSupport = false;
fTextureBarrierSupport = false;
fSampleLocationsSupport = false;
fMultisampleDisableSupport = false;
fDrawInstancedSupport = false;
fNativeDrawIndirectSupport = false;
fUseClientSideIndirectBuffers = false;
@ -205,7 +204,6 @@ void GrCaps::dumpJSON(SkJSONWriter* writer) const {
writer->appendBool("Oversized Stencil Support", fOversizedStencilSupport);
writer->appendBool("Texture Barrier Support", fTextureBarrierSupport);
writer->appendBool("Sample Locations Support", fSampleLocationsSupport);
writer->appendBool("Multisample disable support", fMultisampleDisableSupport);
writer->appendBool("Draw Instanced Support", fDrawInstancedSupport);
writer->appendBool("Native Draw Indirect Support", fNativeDrawIndirectSupport);
writer->appendBool("Use client side indirect buffers", fUseClientSideIndirectBuffers);

View File

@ -51,7 +51,6 @@ public:
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
bool textureBarrierSupport() const { return fTextureBarrierSupport; }
bool sampleLocationsSupport() const { return fSampleLocationsSupport; }
bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
bool drawInstancedSupport() const { return fDrawInstancedSupport; }
// Is there hardware support for indirect draws? (Ganesh always supports indirect draws as long
// as it can polyfill them with instanced calls, but this cap tells us if they are supported
@ -534,7 +533,6 @@ protected:
bool fOversizedStencilSupport : 1;
bool fTextureBarrierSupport : 1;
bool fSampleLocationsSupport : 1;
bool fMultisampleDisableSupport : 1;
bool fDrawInstancedSupport : 1;
bool fNativeDrawIndirectSupport : 1;
bool fUseClientSideIndirectBuffers : 1;

View File

@ -77,10 +77,6 @@ GrPipeline::GrPipeline(GrScissorTest scissorTest,
void GrPipeline::genKey(GrProcessorKeyBuilder* b, const GrCaps& caps) const {
// kSnapVerticesToPixelCenters is implemented in a shader.
InputFlags ignoredFlags = InputFlags::kSnapVerticesToPixelCenters;
if (!caps.multisampleDisableSupport()) {
// Ganesh will omit kHWAntialias regardless of multisampleDisableSupport.
ignoredFlags |= InputFlags::kHWAntialias;
}
b->add32((uint32_t)fFlags & ~(uint32_t)ignoredFlags, "flags");
const GrXferProcessor::BlendInfo& blendInfo = this->getXferProcessor().getBlendInfo();

View File

@ -40,12 +40,6 @@ public:
// NOTE: This enum is extended later by GrPipeline::Flags.
enum class InputFlags : uint8_t {
kNone = 0,
/**
* Perform HW anti-aliasing. This means either HW FSAA, if supported by the render target,
* or smooth-line rendering if a line primitive is drawn and line smoothing is supported by
* the 3D API.
*/
kHWAntialias = (1 << 0),
/**
* Cause every pixel to be rasterized that is touched by the triangle anywhere (not just at
* pixel center). Additionally, if using MSAA, the sample mask will always have 100%
@ -170,7 +164,6 @@ public:
const GrWindowRectsState& getWindowRectsState() const { return fWindowRectsState; }
bool isHWAntialiasState() const { return fFlags & InputFlags::kHWAntialias; }
bool usesConservativeRaster() const { return fFlags & InputFlags::kConservativeRaster; }
bool isWireframe() const { return fFlags & InputFlags::kWireframe; }
bool snapVerticesToPixelCenters() const {

View File

@ -181,17 +181,6 @@ void GrD3DCaps::initGrCaps(const D3D12_FEATURE_DATA_D3D12_OPTIONS& optionsDesc,
// Can use standard sample locations
fSampleLocationsSupport = true;
#if 0
D3D12_FEATURE_DATA_D3D12_OPTIONS2 options2Desc;
if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS2, &options2Desc,
sizeof(options2Desc))) &&
options2Desc.ProgrammableSamplePositionsTier !=
D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED) {
// We "disable" multisample by colocating all samples at pixel center.
fMultisampleDisableSupport = true;
}
#endif
if (D3D12_CONSERVATIVE_RASTERIZATION_TIER_NOT_SUPPORTED !=
optionsDesc.ConservativeRasterizationTier) {
fConservativeRasterSupport = true;

View File

@ -308,7 +308,6 @@ void GrD3DDirectCommandList::setPipelineState(const sk_sp<GrD3DPipeline>& pipeli
fCommandList->SetPipelineState(pipeline->d3dPipelineState());
this->addResource(std::move(pipeline));
fCurrentPipeline = pipeline.get();
this->setDefaultSamplePositions();
}
}
@ -338,25 +337,6 @@ void GrD3DDirectCommandList::setViewports(unsigned int numViewports,
fCommandList->RSSetViewports(numViewports, viewports);
}
void GrD3DDirectCommandList::setCenteredSamplePositions(unsigned int numSamples) {
if (!fUsingCenteredSamples && numSamples > 1) {
gr_cp<ID3D12GraphicsCommandList1> commandList1;
GR_D3D_CALL_ERRCHECK(fCommandList->QueryInterface(IID_PPV_ARGS(&commandList1)));
static D3D12_SAMPLE_POSITION kCenteredSampleLocations[16] = {};
commandList1->SetSamplePositions(numSamples, 1, kCenteredSampleLocations);
fUsingCenteredSamples = true;
}
}
void GrD3DDirectCommandList::setDefaultSamplePositions() {
if (fUsingCenteredSamples) {
gr_cp<ID3D12GraphicsCommandList1> commandList1;
GR_D3D_CALL_ERRCHECK(fCommandList->QueryInterface(IID_PPV_ARGS(&commandList1)));
commandList1->SetSamplePositions(0, 0, nullptr);
fUsingCenteredSamples = false;
}
}
void GrD3DDirectCommandList::setGraphicsRootSignature(const sk_sp<GrD3DRootSignature>& rootSig) {
SkASSERT(fIsActive);
if (fCurrentGraphicsRootSignature != rootSig.get()) {

View File

@ -165,8 +165,6 @@ public:
void setPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY primitiveTopology);
void setScissorRects(unsigned int numRects, const D3D12_RECT* rects);
void setViewports(unsigned int numViewports, const D3D12_VIEWPORT* viewports);
void setCenteredSamplePositions(unsigned int numSamples);
void setDefaultSamplePositions();
void setGraphicsRootSignature(const sk_sp<GrD3DRootSignature>& rootSignature);
void setComputeRootSignature(const sk_sp<GrD3DRootSignature>& rootSignature);
void setVertexBuffers(unsigned int startSlot,
@ -224,7 +222,6 @@ private:
const GrBuffer* fCurrentInstanceBuffer = nullptr;
size_t fCurrentInstanceStride = 0;
const GrBuffer* fCurrentIndexBuffer = nullptr;
bool fUsingCenteredSamples = false;
D3D12_GPU_VIRTUAL_ADDRESS fCurrentGraphicsConstantBufferAddress = 0;
D3D12_GPU_VIRTUAL_ADDRESS fCurrentComputeConstantBufferAddress = 0;

View File

@ -185,12 +185,6 @@ bool GrD3DOpsRenderPass::onBindPipeline(const GrProgramInfo& info, const SkRect&
fGpu->currentCommandList()->setGraphicsRootSignature(fCurrentPipelineState->rootSignature());
fGpu->currentCommandList()->setPipelineState(fCurrentPipelineState->pipeline());
if (info.pipeline().isHWAntialiasState()) {
fGpu->currentCommandList()->setDefaultSamplePositions();
} else {
fGpu->currentCommandList()->setCenteredSamplePositions(fRenderTarget->numSamples());
}
fCurrentPipelineState->setAndBindConstants(fGpu, fRenderTarget, info);
set_stencil_ref(fGpu, info);

View File

@ -382,7 +382,9 @@ static void fill_in_blend_state(const GrPipeline& pipeline, D3D12_BLEND_DESC* bl
}
}
static void fill_in_rasterizer_state(const GrPipeline& pipeline, const GrCaps* caps,
static void fill_in_rasterizer_state(const GrPipeline& pipeline,
bool multisampleEnable,
const GrCaps* caps,
D3D12_RASTERIZER_DESC* rasterizer) {
rasterizer->FillMode = (caps->wireframeMode() || pipeline.isWireframe()) ?
D3D12_FILL_MODE_WIREFRAME : D3D12_FILL_MODE_SOLID;
@ -392,7 +394,7 @@ static void fill_in_rasterizer_state(const GrPipeline& pipeline, const GrCaps* c
rasterizer->DepthBiasClamp = 0.0f;
rasterizer->SlopeScaledDepthBias = 0.0f;
rasterizer->DepthClipEnable = false;
rasterizer->MultisampleEnable = pipeline.isHWAntialiasState();
rasterizer->MultisampleEnable = multisampleEnable;
rasterizer->AntialiasedLineEnable = false;
rasterizer->ForcedSampleCount = 0;
rasterizer->ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
@ -521,7 +523,8 @@ gr_cp<ID3D12PipelineState> create_pipeline_state(
fill_in_blend_state(programInfo.pipeline(), &psoDesc.BlendState);
psoDesc.SampleMask = UINT_MAX;
fill_in_rasterizer_state(programInfo.pipeline(), gpu->caps(), &psoDesc.RasterizerState);
fill_in_rasterizer_state(programInfo.pipeline(), programInfo.numSamples() > 1, gpu->caps(),
&psoDesc.RasterizerState);
fill_in_depth_stencil_state(programInfo, &psoDesc.DepthStencilState);

View File

@ -221,14 +221,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fClientCanDisableMultisample = ctxInfo.hasExtension("GL_EXT_multisample_compatibility");
} // no WebGL support
#if 0
#ifdef SK_BUILD_FOR_MAC
fMultisampleDisableSupport = false;
#else
fMultisampleDisableSupport = fClientCanDisableMultisample;
#endif
#endif
if (GR_IS_GR_GL(standard)) {
// 3.1 has draw_instanced but not instanced_arrays, for the time being we only care about
// instanced arrays, but we could make this more granular if we wanted

View File

@ -545,9 +545,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
}
if (resetBits & kMSAAEnable_GrGLBackendState) {
if (this->caps()->multisampleDisableSupport()) {
fMSAAEnabled = kUnknown_TriState;
} else if (this->glCaps().clientCanDisableMultisample()) {
if (this->glCaps().clientCanDisableMultisample()) {
// Restore GL_MULTISAMPLE to its initial state. It being enabled has no effect on draws
// to non-MSAA targets.
GL_CALL(Enable(GR_GL_MULTISAMPLE));
@ -1843,7 +1841,6 @@ bool GrGLGpu::flushGLState(GrRenderTarget* renderTarget, bool useMultisampleFBO,
this->flushScissorTest(GrScissorTest(programInfo.pipeline().isScissorTestEnabled()));
this->flushWindowRectangles(programInfo.pipeline().getWindowRectsState(),
glRT, programInfo.origin());
this->flushHWAAState(glRT, programInfo.pipeline().isHWAntialiasState());
this->flushConservativeRasterState(programInfo.pipeline().usesConservativeRaster());
this->flushWireframeState(programInfo.pipeline().isWireframe());
@ -2462,27 +2459,6 @@ void GrGLGpu::disableStencil() {
}
}
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
// rt is only optional if useHWAA is false.
SkASSERT(rt || !useHWAA);
SkASSERT(!useHWAA || rt->numSamples() > 1 ||
static_cast<GrGLRenderTarget*>(rt)->multisampleFBOID());
if (this->caps()->multisampleDisableSupport()) {
if (useHWAA) {
if (kYes_TriState != fMSAAEnabled) {
GL_CALL(Enable(GR_GL_MULTISAMPLE));
fMSAAEnabled = kYes_TriState;
}
} else {
if (kNo_TriState != fMSAAEnabled) {
GL_CALL(Disable(GR_GL_MULTISAMPLE));
fMSAAEnabled = kNo_TriState;
}
}
}
}
void GrGLGpu::flushConservativeRasterState(bool enabled) {
if (this->caps()->conservativeRasterSupport()) {
if (enabled) {
@ -3354,7 +3330,6 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst, bool drawToMultisampleFBO, GrSur
sx1 - sx0, sy1 - sy0, sx0, sy0));
GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0));
this->flushBlendAndColorWrite(GrXferProcessor::BlendInfo(), GrSwizzle::RGBA());
this->flushHWAAState(nullptr, false);
this->flushConservativeRasterState(false);
this->flushWireframeState(false);
this->flushScissorTest(GrScissorTest::kDisabled);
@ -3489,7 +3464,6 @@ bool GrGLGpu::onRegenerateMipMapLevels(GrTexture* texture) {
// Set "simple" state once:
this->flushBlendAndColorWrite(GrXferProcessor::BlendInfo(), GrSwizzle::RGBA());
this->flushHWAAState(nullptr, false);
this->flushScissorTest(GrScissorTest::kDisabled);
this->disableWindowRectangles();
this->disableStencil();

View File

@ -457,9 +457,6 @@ private:
void flushStencil(const GrStencilSettings&, GrSurfaceOrigin);
void disableStencil();
// rt is used only if useHWAA is true.
void flushHWAAState(GrRenderTarget* rt, bool useHWAA);
void flushConservativeRasterState(bool enable);
void flushWireframeState(bool enable);
@ -721,7 +718,6 @@ private:
}
} fHWBlendState;
TriState fMSAAEnabled;
TriState fHWConservativeRasterEnabled;
TriState fHWWireframeEnabled;

View File

@ -335,7 +335,6 @@ void GrMtlCaps::initGrCaps(id<MTLDevice> device) {
fTextureBarrierSupport = false; // Need to figure out if we can do this
fSampleLocationsSupport = false;
fMultisampleDisableSupport = false;
if (@available(macOS 10.11, iOS 9.0, *)) {
if (this->isMac() || 3 == fFamilyGroup) {

View File

@ -323,11 +323,9 @@ void GrAtlasTextOp::onPrepareDraws(GrMeshDrawTarget* target) {
}
void GrAtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
auto pipelineFlags = flushState->usesMSAASurface() ? GrPipeline::InputFlags::kHWAntialias
: GrPipeline::InputFlags::kNone;
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
std::move(fProcessors),
pipelineFlags);
GrPipeline::InputFlags::kNone);
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline,
&GrUserStencilSettings::kUnused);

View File

@ -346,11 +346,6 @@ private:
return;
}
auto pipelineFlags = GrPipeline::InputFlags::kNone;
if (AAMode::kCoverageWithMSAA == fAAMode) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
@ -361,7 +356,7 @@ private:
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp,
pipelineFlags,
GrPipeline::InputFlags::kNone,
fStencilSettings);
}

View File

@ -151,9 +151,6 @@ void GrDrawAtlasPathOp::prepareProgram(const GrCaps& caps, SkArenaAlloc* arena,
GrLoadOp colorLoadOp) {
SkASSERT(!fProgram);
GrPipeline::InitArgs initArgs;
if (usesMSAASurface) {
initArgs.fInputFlags |= GrPipeline::InputFlags::kHWAntialias;
}
initArgs.fCaps = &caps;
initArgs.fDstProxyView = dstProxyView;
initArgs.fWriteSwizzle = writeView.swizzle();
@ -190,10 +187,6 @@ void GrDrawAtlasPathOp::onPrepare(GrOpFlushState* flushState) {
SkASSERT(fProgram);
}
// FIXME(skbug.com/12201): Our draw's MSAA state should match the render target, but DDL doesn't
// yet communicate DMSAA state to onPrePrepare.
SkASSERT(fProgram->pipeline().isHWAntialiasState() == flushState->usesMSAASurface());
if (GrVertexWriter instanceWriter = flushState->makeVertexSpace(
fProgram->geomProc().instanceStride(), fInstanceCount, &fInstanceBuffer,
&fBaseInstance)) {

View File

@ -515,10 +515,6 @@ void FillRRectOp::onPrepareDraws(GrMeshDrawTarget* target) {
this->createProgramInfo(target);
}
// FIXME(skbug.com/12201): Our draw's MSAA state should match the render target, but DDL doesn't
// yet communicate DMSAA state to onPrePrepare.
SkASSERT(fProgramInfo->pipeline().isHWAntialiasState() == target->usesMSAASurface());
size_t instanceStride = fProgramInfo->geomProc().instanceStride();
if (GrVertexWriter instanceWrter = target->makeVertexSpace(instanceStride, fInstanceCount,
@ -773,16 +769,13 @@ void FillRRectOp::onCreateProgramInfo(const GrCaps* caps,
const GrDstProxyView& dstProxyView,
GrXferBarrierFlags renderPassXferBarriers,
GrLoadOp colorLoadOp) {
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
if (usesMSAASurface) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
fProcessorFlags |= ProcessorFlags::kMSAAEnabled;
}
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, pipelineFlags);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}
void FillRRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {

View File

@ -1255,9 +1255,15 @@ private:
fRoundCaps, fWideColor,
localMatrix);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
std::move(appliedClip),
dstProxyView,
gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp);
}
void onPrepareDraws(GrMeshDrawTarget* target) override {
@ -1620,9 +1626,15 @@ private:
fWideColor,
localMatrix);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
std::move(appliedClip),
dstProxyView,
gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp);
}
void onPrepareDraws(GrMeshDrawTarget* target) override {
@ -1949,18 +1961,15 @@ private:
GrGeometryProcessor* gp = EllipseGeometryProcessor::Make(arena, fStroked, fWideColor,
fUseScale, localMatrix);
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
if (usesMSAASurface) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
std::move(appliedClip),
dstProxyView, gp,
fHelper.detachProcessorSet(),
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp, pipelineFlags);
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
std::move(appliedClip),
dstProxyView,
gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp);
}
void onPrepareDraws(GrMeshDrawTarget* target) override {
@ -2236,18 +2245,9 @@ private:
this->viewMatrix(),
this->style());
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
if (usesMSAASurface) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
std::move(appliedClip),
dstProxyView, gp,
fHelper.detachProcessorSet(),
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp, pipelineFlags);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}
void onPrepareDraws(GrMeshDrawTarget* target) override {
@ -2979,18 +2979,9 @@ private:
GrGeometryProcessor* gp = EllipseGeometryProcessor::Make(arena, fStroked, fWideColor,
fUseScale, localMatrix);
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
if (usesMSAASurface) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView,
std::move(appliedClip),
dstProxyView, gp,
fHelper.detachProcessorSet(),
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp, pipelineFlags);
fProgramInfo = fHelper.createProgramInfo(caps, arena, writeView, std::move(appliedClip),
dstProxyView, gp, GrPrimitiveType::kTriangles,
renderPassXferBarriers, colorLoadOp);
}
void onPrepareDraws(GrMeshDrawTarget* target) override {

View File

@ -24,9 +24,6 @@ GrSimpleMeshDrawOpHelper::GrSimpleMeshDrawOpHelper(GrProcessorSet* processorSet,
, fCompatibleWithCoverageAsAlpha(false) {
SkDEBUGCODE(fDidAnalysis = false);
SkDEBUGCODE(fMadePipeline = false);
if (GrAATypeIsHW(aaType)) {
fPipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
}
GrSimpleMeshDrawOpHelper::~GrSimpleMeshDrawOpHelper() {
@ -238,9 +235,6 @@ static void dump_pipeline_flags(GrPipeline::InputFlags flags, SkString* result)
if (flags & GrPipeline::InputFlags::kSnapVerticesToPixelCenters) {
result->append("Snap vertices to pixel center.\n");
}
if (flags & GrPipeline::InputFlags::kHWAntialias) {
result->append("HW Antialiasing enabled.\n");
}
if (flags & GrPipeline::InputFlags::kWireframe) {
result->append("Wireframe enabled.\n");
}

View File

@ -600,22 +600,15 @@ void AAStrokeRectOp::onCreateProgramInfo(const GrCaps* caps,
return;
}
GrPipeline::InputFlags pipelineFlags = fHelper.pipelineFlags();
if (usesMSAASurface) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
}
fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps,
arena,
writeView,
std::move(appliedClip),
dstProxyView,
gp,
fHelper.detachProcessorSet(),
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp,
pipelineFlags);
fProgramInfo = fHelper.createProgramInfo(caps,
arena,
writeView,
std::move(appliedClip),
dstProxyView,
gp,
GrPrimitiveType::kTriangles,
renderPassXferBarriers,
colorLoadOp);
}
void AAStrokeRectOp::onPrepareDraws(GrMeshDrawTarget* target) {

View File

@ -688,13 +688,10 @@ private:
SkASSERT(fDesc->fVertexSpec.vertexSize() == gp->vertexStride());
}
auto pipelineFlags = (GrAAType::kMSAA == fMetadata.aaType()) ?
GrPipeline::InputFlags::kHWAntialias : GrPipeline::InputFlags::kNone;
fDesc->fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
caps, arena, writeView, std::move(appliedClip), dstProxyView, gp,
GrProcessorSet::MakeEmptySet(), fDesc->fVertexSpec.primitiveType(),
renderPassXferBarriers, colorLoadOp, pipelineFlags);
renderPassXferBarriers, colorLoadOp, GrPipeline::InputFlags::kNone);
}
void onPrePrepareDraws(GrRecordingContext* context,

View File

@ -60,9 +60,6 @@ const GrPipeline* GrPathTessellationShader::MakeStencilOnlyPipeline(
const GrAppliedHardClip& hardClip) {
using PathFlags = GrTessellationPathFlags;
GrPipeline::InitArgs pipelineArgs;
if (aaType == GrAAType::kMSAA) {
pipelineArgs.fInputFlags |= GrPipeline::InputFlags::kHWAntialias;
}
if (args.fCaps->wireframeSupport() && (pathFlags & PathFlags::kWireframe)) {
pipelineArgs.fInputFlags |= GrPipeline::InputFlags::kWireframe;
}

View File

@ -13,8 +13,6 @@ const GrPipeline* GrTessellationShader::MakePipeline(const ProgramArgs& args,
GrProcessorSet&& processors) {
GrPipeline::InitArgs pipelineArgs;
pipelineArgs.fInputFlags = aaType == GrAAType::kMSAA ? GrPipeline::InputFlags::kHWAntialias
: GrPipeline::InputFlags::kNone;
pipelineArgs.fCaps = args.fCaps;
pipelineArgs.fDstProxyView = *args.fDstProxyView;
pipelineArgs.fWriteSwizzle = args.fWriteView.swizzle();

View File

@ -62,8 +62,7 @@ SkImageInfo make_info(skgpu::v1::SurfaceDrawContext* sdc, bool opaque) {
}
bool force_aa_clip(const skgpu::v1::SurfaceDrawContext* sdc) {
return (sdc->numSamples() > 1 && !sdc->caps()->multisampleDisableSupport()) ||
sdc->alwaysAntialias();
return sdc->numSamples() > 1 || sdc->alwaysAntialias();
}
inline GrPrimitiveType point_mode_to_primitive_type(SkCanvas::PointMode mode) {

View File

@ -333,18 +333,7 @@ void stencil_path(GrRecordingContext* rContext,
}
GrAA supported_aa(skgpu::v1::SurfaceDrawContext* sdc, GrAA aa) {
if (sdc->canUseDynamicMSAA()) {
return GrAA::kYes;
}
if (sdc->numSamples() > 1) {
if (sdc->caps()->multisampleDisableSupport()) {
return aa;
} else {
return GrAA::kYes;
}
} else {
return GrAA::kNo;
}
return GrAA(sdc->numSamples() > 1 || sdc->canUseDynamicMSAA());
}
} // namespace

View File

@ -323,20 +323,12 @@ void SurfaceDrawContext::willReplaceOpsTask(GrOpsTask* prevTask, GrOpsTask* next
}
inline GrAAType SurfaceDrawContext::chooseAAType(GrAA aa) {
if (fCanUseDynamicMSAA) {
if (this->numSamples() > 1 || fCanUseDynamicMSAA) {
// Always trigger DMSAA when it's available. The coverage ops that know how to handle both
// single and multisample targets without popping will do so without calling chooseAAType.
return GrAAType::kMSAA;
}
if (GrAA::kNo == aa) {
// On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect
// that.
if (this->numSamples() > 1 && !this->caps()->multisampleDisableSupport()) {
return GrAAType::kMSAA;
}
return GrAAType::kNone;
}
return (this->numSamples() > 1) ? GrAAType::kMSAA : GrAAType::kCoverage;
return (aa == GrAA::kYes) ? GrAAType::kCoverage : GrAAType::kNone;
}
void SurfaceDrawContext::drawGlyphRunListNoCache(const GrClip* clip,
@ -1366,8 +1358,7 @@ void SurfaceDrawContext::drawRegion(const GrClip* clip,
return this->drawPath(clip, std::move(paint), aa, viewMatrix, path, style);
}
GrAAType aaType = (this->numSamples() > 1 &&
!this->caps()->multisampleDisableSupport())
GrAAType aaType = (this->numSamples() > 1)
? GrAAType::kMSAA
: GrAAType::kNone;
GrOp::Owner op = GrRegionOp::Make(fContext, std::move(paint), viewMatrix, region, aaType, ss);

View File

@ -611,14 +611,6 @@ void GrVkCaps::initGrCaps(const GrVkInterface* vkInterface,
fSampleLocationsSupport = true;
}
// See skbug.com/10346
#if 0
if (extensions.hasExtension(VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME, 1)) {
// We "disable" multisample by colocating all samples at pixel center.
fMultisampleDisableSupport = true;
}
#endif
if (extensions.hasExtension(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME, 1)) {
fConservativeRasterSupport = true;
}

View File

@ -295,29 +295,6 @@ static void setup_multisample_state(int numSamples,
multisampleInfo->alphaToOneEnable = VK_FALSE;
}
static void setup_all_sample_locations_at_pixel_center(
int numSamples,
VkPipelineSampleLocationsStateCreateInfoEXT* sampleLocations) {
constexpr static VkSampleLocationEXT kCenteredSampleLocations[16] = {
{.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f},
{.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}, {.5f,.5f}};
memset(sampleLocations, 0, sizeof(VkPipelineSampleLocationsStateCreateInfoEXT));
sampleLocations->sType = VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT;
sampleLocations->pNext = nullptr;
sampleLocations->sampleLocationsEnable = VK_TRUE;
sampleLocations->sampleLocationsInfo.sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT;
sampleLocations->sampleLocationsInfo.pNext = nullptr;
SkAssertResult(GrSampleCountToVkSampleCount(
numSamples,
&sampleLocations->sampleLocationsInfo.sampleLocationsPerPixel));
sampleLocations->sampleLocationsInfo.sampleLocationGridSize.width = 1;
sampleLocations->sampleLocationsInfo.sampleLocationGridSize.height = 1;
SkASSERT(numSamples < (int)SK_ARRAY_COUNT(kCenteredSampleLocations));
sampleLocations->sampleLocationsInfo.sampleLocationsCount = std::min(
numSamples, (int)SK_ARRAY_COUNT(kCenteredSampleLocations));
sampleLocations->sampleLocationsInfo.pSampleLocations = kCenteredSampleLocations;
}
static VkBlendFactor blend_coeff_to_vk_blend(GrBlendCoeff coeff) {
switch (coeff) {
case kZero_GrBlendCoeff:
@ -530,15 +507,6 @@ sk_sp<GrVkPipeline> GrVkPipeline::Make(GrVkGpu* gpu,
VkPipelineMultisampleStateCreateInfo multisampleInfo;
setup_multisample_state(numSamples, gpu->caps(), &multisampleInfo);
VkPipelineSampleLocationsStateCreateInfoEXT sampleLocations;
if (gpu->caps()->multisampleDisableSupport()) {
if (numSamples > 1 && !isHWAntialiasState) {
setup_all_sample_locations_at_pixel_center(numSamples, &sampleLocations);
sampleLocations.pNext = multisampleInfo.pNext;
multisampleInfo.pNext = &sampleLocations;
}
}
// We will only have one color attachment per pipeline.
VkPipelineColorBlendAttachmentState attachmentStates[1];
VkPipelineColorBlendStateCreateInfo colorBlendInfo;
@ -622,7 +590,7 @@ sk_sp<GrVkPipeline> GrVkPipeline::Make(GrVkGpu* gpu,
programInfo.origin(),
programInfo.nonGLStencilSettings(),
programInfo.numSamples(),
pipeline.isHWAntialiasState(),
programInfo.numSamples() > 1,
pipeline.getXferProcessor().getBlendInfo(),
pipeline.isWireframe(),
pipeline.usesConservativeRaster(),