Never disable multisample with DMSAA

DMSAA used to disable multisample in order to use coverage ops, but it
turns out that disabling multisample while rendering to an MSAA target
is very expensive. This CL updates DMSAA to always prefer the MSAA op
unless a coverage version exists that also knows how to render when
multisampling is enabled. We will follow it up with updates to
coverage ops that make them MSAA compatible.

Bug: skia:11396
Change-Id: I8e4ea763710d96593e08877b100eb7777268d7eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427657
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Chris Dalton 2021-07-13 15:01:10 -06:00 committed by Skia Commit-Bot
parent 03a2d276ea
commit 8cb159b504
2 changed files with 4 additions and 18 deletions

View File

@ -298,10 +298,9 @@ void GrSurfaceDrawContext::willReplaceOpsTask(GrOpsTask* prevTask, GrOpsTask* ne
inline GrAAType GrSurfaceDrawContext::chooseAAType(GrAA aa) { inline GrAAType GrSurfaceDrawContext::chooseAAType(GrAA aa) {
if (fCanUseDynamicMSAA) { if (fCanUseDynamicMSAA) {
// Use coverage AA if we can disable multisample. Otherwise always trigger dmsaa. The few // Always trigger DMSAA when it's available. The coverage ops that know how to handle both
// coverage ops we have that know how to handle both single and multisample targets without // single and multisample targets without popping will do so without calling chooseAAType.
// popping will do so without calling chooseAAType. return GrAAType::kMSAA;
return this->caps()->multisampleDisableSupport() ? GrAAType::kCoverage : GrAAType::kMSAA;
} }
if (GrAA::kNo == aa) { if (GrAA::kNo == aa) {
// On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect // On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect

View File

@ -4636,20 +4636,7 @@ GrDstSampleFlags GrGLCaps::onGetDstSampleFlagsForProxy(const GrRenderTargetProxy
} }
bool GrGLCaps::onSupportsDynamicMSAA(const GrRenderTargetProxy* rtProxy) const { bool GrGLCaps::onSupportsDynamicMSAA(const GrRenderTargetProxy* rtProxy) const {
if (fDisallowDynamicMSAA) { return !fDisallowDynamicMSAA;
return false;
}
// We only allow DMSAA in two cases:
//
// 1) Desktop GL and EXT_multisample_compatibility: Here it's easy to use all our existing
// coverage ops because we can just call glDisable(GL_MULTISAMPLE). So we only trigger
// MSAA for paths and use the coverage ops for everything else with MSAA disabled.
//
// 2) EXT_multisampled_render_to_to_texture (86% adoption on Android): The assumption here
// is that MSAA is almost free. So we just allow MSAA to be triggered often and don't
// worry about it.
return fMultisampleDisableSupport ||
(fMSAAResolvesAutomatically && rtProxy->asTextureProxy());
} }
uint64_t GrGLCaps::computeFormatKey(const GrBackendFormat& format) const { uint64_t GrGLCaps::computeFormatKey(const GrBackendFormat& format) const {