Bug 1617751 - Ensure that GLScreenBuffer back buffer is created using the newly attached factory. r=jgilbert

Differential Revision: https://phabricator.services.mozilla.com/D64183

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Imanol Fernandez 2020-03-03 00:43:10 +00:00
Родитель 0bc74c9a03
Коммит ec6ba5a531
2 изменённых файлов: 10 добавлений и 1 удалений

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

@ -952,6 +952,12 @@ Maybe<ICRData> WebGLContext::InitializeCanvasRenderer(
gl->Screen()->Morph(std::move(factory));
#if defined(MOZ_WIDGET_ANDROID)
// On Android we are using a different GLScreenBuffer for WebVR, so we need
// a resize here because PresentScreenBuffer() may not be called for the
// gl->Screen() after we set the new factory.
mForceResizeOnPresent = true;
#endif
mVRReady = true;
return Some(ret);
}
@ -978,12 +984,14 @@ bool WebGLContext::PresentScreenBuffer(gl::GLScreenBuffer* const targetScreen) {
if (!ValidateAndInitFB(nullptr)) return false;
const auto& screen = targetScreen ? targetScreen : gl->Screen();
if ((!screen->IsReadBufferReady() || screen->Size() != mDefaultFB->mSize) &&
if ((!screen->IsReadBufferReady() || mForceResizeOnPresent ||
screen->Size() != mDefaultFB->mSize) &&
!screen->Resize(mDefaultFB->mSize)) {
GenerateWarning("screen->Resize failed. Losing context.");
LoseContext();
return false;
}
mForceResizeOnPresent = false;
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
BlitBackbufferToCurDriverFB();

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

@ -849,6 +849,7 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr<WebGLContext> {
bool mCanLoseContextInForeground = true;
bool mShouldPresent = false;
bool mDisableFragHighP = false;
bool mForceResizeOnPresent = false;
bool mVRReady = false;
template <typename WebGLObjectType>