diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index b810a75fae82..eb05cd592a45 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -669,6 +669,12 @@ CreateOffscreen(GLContext* gl, if (!baseCaps.alpha) baseCaps.premultAlpha = true; + if (gl->IsANGLE()) { + // We can't use no-alpha formats on ANGLE yet because of: + // https://code.google.com/p/angleproject/issues/detail?id=764 + baseCaps.alpha = true; + } + // we should really have this behind a // |gfxPlatform::GetPlatform()->GetScreenDepth() == 16| check, but // for now it's just behind a pref for testing/evaluation. @@ -928,6 +934,12 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight) mShouldPresent = true; + if (gl->WorkAroundDriverBugs()) { + if (!mOptions.alpha && gl->Caps().alpha) { + mNeedsFakeNoAlpha = true; + } + } + MOZ_ASSERT(gl->Caps().color); MOZ_ASSERT(gl->Caps().alpha == mOptions.alpha); MOZ_ASSERT(gl->Caps().depth == mOptions.depth); @@ -935,12 +947,6 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight) MOZ_ASSERT(gl->Caps().antialias == mOptions.antialias); MOZ_ASSERT(gl->Caps().preserve == mOptions.preserveDrawingBuffer); - if (gl->WorkAroundDriverBugs() && gl->IsANGLE()) { - if (!mOptions.alpha) { - mNeedsFakeNoAlpha = true; - } - } - AssertCachedBindings(); AssertCachedState(); @@ -1845,7 +1851,6 @@ bool WebGLContext::TexImageFromVideoElement(const TexImageTarget texImageTarget, //////////////////////////////////////////////////////////////////////////////// - WebGLContext::ScopedMaskWorkaround::ScopedMaskWorkaround(WebGLContext& webgl) : mWebGL(webgl) , mNeedsChange(NeedsChange(webgl)) diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp index 474734bbfac7..4164357c5989 100644 --- a/dom/canvas/WebGLContextState.cpp +++ b/dom/canvas/WebGLContextState.cpp @@ -312,12 +312,18 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) case LOCAL_GL_RED_BITS: case LOCAL_GL_GREEN_BITS: case LOCAL_GL_BLUE_BITS: - case LOCAL_GL_ALPHA_BITS: case LOCAL_GL_DEPTH_BITS: { GLint i = 0; gl->fGetIntegerv(pname, &i); return JS::Int32Value(i); } + case LOCAL_GL_ALPHA_BITS: { + GLint i = 0; + if (!mNeedsFakeNoAlpha) { + gl->fGetIntegerv(pname, &i); + } + return JS::Int32Value(i); + } case LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT: { if (IsExtensionEnabled(WebGLExtensionID::OES_standard_derivatives)) { GLint i = 0; diff --git a/gfx/gl/SharedSurfaceANGLE.cpp b/gfx/gl/SharedSurfaceANGLE.cpp index 7c871ae5aea7..7143ca134c9c 100644 --- a/gfx/gl/SharedSurfaceANGLE.cpp +++ b/gfx/gl/SharedSurfaceANGLE.cpp @@ -289,7 +289,9 @@ ChooseConfig(GLContext* gl, GLLibraryEGL* egl, const SurfaceCaps& caps) EGLConfig config = EGL_NO_CONFIG; for (int i = 0; i < foundConfigs; i++) { EGLConfig cur = configs[i]; - if (!DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_DEPTH_SIZE, + if (!DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_ALPHA_SIZE, + caps.alpha) || + !DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_DEPTH_SIZE, caps.depth) || !DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_STENCIL_SIZE, caps.stencil)) @@ -297,16 +299,6 @@ ChooseConfig(GLContext* gl, GLLibraryEGL* egl, const SurfaceCaps& caps) continue; } - // We can't enforce alpha on ANGLE yet because of: - // https://code.google.com/p/angleproject/issues/detail?id=764 - if (!gl->IsANGLE()) { - if (!DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_ALPHA_SIZE, - caps.alpha)) - { - continue; - } - } - config = cur; break; }