diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index aefe9a2405e7..13b75b2fba99 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -1039,15 +1039,15 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size, } RefPtr gl; - SurfaceCaps offscreenCaps = minCaps; + SurfaceCaps minOffscreenCaps = minCaps; if (canOffscreenUseHeadless) { gl = CreateHeadless(flags); if (!gl) return nullptr; } else { - SurfaceCaps minBackbufferCaps = minCaps; - if (minCaps.antialias) { + SurfaceCaps minBackbufferCaps = minOffscreenCaps; + if (minOffscreenCaps.antialias) { minBackbufferCaps.antialias = false; minBackbufferCaps.depth = false; minBackbufferCaps.stencil = false; @@ -1057,14 +1057,19 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size, if (!gl) return nullptr; - offscreenCaps = gl->Caps(); - if (minCaps.antialias) { - offscreenCaps.depth = minCaps.depth; - offscreenCaps.stencil = minCaps.stencil; + // Pull the actual resulting caps to ensure that our offscreen matches our + // backbuffer. + minOffscreenCaps.alpha = gl->Caps().alpha; + if (!minOffscreenCaps.antialias) { + // Only update these if we don't have AA. If we do have AA, we ignore + // backbuffer depth/stencil. + minOffscreenCaps.depth = gl->Caps().depth; + minOffscreenCaps.stencil = gl->Caps().stencil; } } - if (!gl->InitOffscreen(size, offscreenCaps)) + // Init the offscreen with the updated offscreen caps. + if (!gl->InitOffscreen(size, minOffscreenCaps)) return nullptr; return gl.forget();