Bug 1576087 - Split EGLSurface creation from RenderCompositorANGLE::ResizeBufferIfNeeded() r=nical

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2019-09-03 12:36:09 +00:00
parent 40fff309dd
commit 6ad6dcbc80
2 changed files with 24 additions and 6 deletions

View File

@ -400,14 +400,32 @@ bool RenderCompositorANGLE::ResizeBufferIfNeeded() {
return true;
}
HRESULT hr;
RefPtr<ID3D11Texture2D> backBuf;
// Release EGLSurface of back buffer before calling ResizeBuffers().
DestroyEGLSurface();
// Reset buffer size
mBufferSize.reset();
mBufferSize = Some(size);
if (!CreateEGLSurface()) {
mBufferSize.reset();
return false;
}
return true;
}
bool RenderCompositorANGLE::CreateEGLSurface() {
MOZ_ASSERT(mBufferSize.isSome());
MOZ_ASSERT(mEGLSurface == EGL_NO_SURFACE);
HRESULT hr;
RefPtr<ID3D11Texture2D> backBuf;
if (mBufferSize.isNothing()) {
gfxCriticalNote << "Buffer size is invalid";
return false;
}
const LayoutDeviceIntSize& size = mBufferSize.ref();
// Resize swap chain
DXGI_SWAP_CHAIN_DESC desc;
@ -462,7 +480,6 @@ bool RenderCompositorANGLE::ResizeBufferIfNeeded() {
}
mEGLSurface = surface;
mBufferSize = Some(size);
return true;
}

View File

@ -63,6 +63,7 @@ class RenderCompositorANGLE : public RenderCompositor {
void InsertPresentWaitQuery();
bool WaitForPreviousPresentQuery();
bool ResizeBufferIfNeeded();
bool CreateEGLSurface();
void DestroyEGLSurface();
ID3D11Device* GetDeviceOfEGLDisplay();
void CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFactory2);