Bug 1661869 - Fix screenshotting of WebGL canvases. r=gfx-reviewers,lsalzman

For WebGL canvases with preserveDrawingBuffer:false, frontbuffer
snapshotting was not working properly.
If the frontbuffer had no user-fb associated with it,
was inexplicably calling BindDefaultFBForRead, which binds
*webgl*'s default FB, not *gl*'s default FB 0.
This caused frontbuffer snappshotting to actually snapshot the (cleared)
backbuffer instead of the visible frontbuffer contents.

Differential Revision: https://phabricator.services.mozilla.com/D126024
This commit is contained in:
Jeff Gilbert 2021-09-18 01:23:58 +00:00
Родитель f2cfda3e61
Коммит 4d36916392
1 изменённых файлов: 1 добавлений и 8 удалений

Просмотреть файл

@ -996,14 +996,7 @@ Maybe<uvec2> WebGLContext::FrontBufferSnapshotInto(
}
});
if (front->mFb) {
gl->fBindFramebuffer(fbTarget, front->mFb->mFB);
} else {
if (!BindDefaultFBForRead()) {
gfxCriticalError() << "BindDefaultFBForRead failed";
return {};
}
}
gl->fBindFramebuffer(fbTarget, front->mFb ? front->mFb->mFB : 0);
if (pboWas) {
BindBuffer(LOCAL_GL_PIXEL_PACK_BUFFER, nullptr);
}