Bug 1209022 - Fix AA handling in EGL's CreateOffscreen. - r=jrmuizel

This commit is contained in:
Jeff Gilbert 2015-09-28 15:53:37 -07:00
parent 62706101ab
commit bc525759f2

View File

@ -1039,15 +1039,15 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
}
RefPtr<GLContext> 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();