Revert "Don't keep a non-msaa FBO with EXT_multisampled_render_to_texture"

This reverts commit 6694a36a7f.

Reason for revert: Issues with Adreno GMs.

Original change's description:
> Don't keep a non-msaa FBO with EXT_multisampled_render_to_texture
>
> This seems to cause bugs on various platforms. Instead, do the same
> thing we do for dmsaa: reconfigure a single FBO as msaa or not,
> based on need.
>
> Bug: chromium:1222095
> Change-Id: I4ca4aff32772ee2a9607c92c586ae9494f955229
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442565
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: chromium:1222095
Change-Id: I060988c63edbfeb628d5a6c34cda3e159066114a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449918
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2021-09-17 22:37:49 +00:00 committed by SkCQ
parent 3299eb7feb
commit dcfa824c38

View File

@ -1217,19 +1217,18 @@ bool GrGLGpu::createRenderTargetObjects(const GrGLTexture::Desc& desc,
// rendered from.
if (sampleCount <= 1) {
rtIDs->fMultisampleFBOID = GrGLRenderTarget::kUnresolvableFBOID;
} else if (this->glCaps().usesImplicitMSAAResolve()) {
// GrGLRenderTarget target will configure the FBO as multisample or not base on need.
rtIDs->fMultisampleFBOID = rtIDs->fSingleSampleFBOID;
} else {
GL_CALL(GenFramebuffers(1, &rtIDs->fMultisampleFBOID));
if (!rtIDs->fMultisampleFBOID) {
goto FAILED;
}
GL_CALL(GenRenderbuffers(1, &rtIDs->fMSColorRenderbufferID));
if (!rtIDs->fMSColorRenderbufferID) {
goto FAILED;
if (!this->glCaps().usesImplicitMSAAResolve()) {
GL_CALL(GenRenderbuffers(1, &rtIDs->fMSColorRenderbufferID));
if (!rtIDs->fMSColorRenderbufferID) {
goto FAILED;
}
colorRenderbufferFormat = this->glCaps().getRenderbufferInternalFormat(desc.fFormat);
}
colorRenderbufferFormat = this->glCaps().getRenderbufferInternalFormat(desc.fFormat);
}
// below here we may bind the FBO
@ -1247,6 +1246,16 @@ bool GrGLGpu::createRenderTargetObjects(const GrGLTexture::Desc& desc,
GR_GL_RENDERBUFFER,
rtIDs->fMSColorRenderbufferID));
rtIDs->fTotalMemorySamplesPerPixel += sampleCount;
} else if (sampleCount > 1) {
// multisampled_render_to_texture
SkASSERT(this->glCaps().usesImplicitMSAAResolve()); // Otherwise fMSColorRenderbufferID!=0.
this->bindFramebuffer(GR_GL_FRAMEBUFFER, rtIDs->fMultisampleFBOID);
GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER,
GR_GL_COLOR_ATTACHMENT0,
desc.fTarget,
desc.fID,
0,
sampleCount));
}
this->bindFramebuffer(GR_GL_FRAMEBUFFER, rtIDs->fSingleSampleFBOID);