Bug 697757 - WebGL context fix for alpha being improperly set on OSX. r=jgilbert

If we request alpha and it isn't enabled, or we request it off and it gets
enabled, we now fail the pbuffer creation and fall back to FBOs. This is bad for
performance but allows us to pass the conformance test in this case.
This commit is contained in:
Doug Sherk 2011-10-31 17:49:55 -07:00
Родитель 3e243dea6b
Коммит c47bd89d8a
2 изменённых файлов: 14 добавлений и 2 удалений

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

@ -1,4 +1,3 @@
conformance/context/context-attributes-alpha-depth-stencil-antialias.html
conformance/context/premultiplyalpha-test.html conformance/context/premultiplyalpha-test.html
conformance/glsl/misc/glsl-function-nodes.html conformance/glsl/misc/glsl-function-nodes.html
conformance/glsl/misc/glsl-long-variable-names.html conformance/glsl/misc/glsl-long-variable-names.html
@ -6,7 +5,6 @@ conformance/glsl/misc/shader-with-256-character-identifier.frag.html
conformance/glsl/misc/shader-with-long-line.html conformance/glsl/misc/shader-with-long-line.html
conformance/programs/program-test.html conformance/programs/program-test.html
conformance/state/gl-object-get-calls.html conformance/state/gl-object-get-calls.html
conformance/textures/tex-input-validation.html
conformance/textures/texture-mips.html conformance/textures/texture-mips.html
conformance/textures/texture-npot.html conformance/textures/texture-npot.html
conformance/more/conformance/quickCheckAPI-S_V.html conformance/more/conformance/quickCheckAPI-S_V.html

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

@ -497,6 +497,20 @@ CreateOffscreenPBufferContext(const gfxIntSize& aSize,
return nsnull; return nsnull;
} }
// If we ask for any of these to be on/off and we get the opposite, we stop
// creating a pbuffer and instead create an FBO.
GLint alphaBits, depthBits, stencilBits;
[pbFormat getValues: &alphaBits forAttribute: NSOpenGLPFAAlphaSize forVirtualScreen: 0];
[pbFormat getValues: &depthBits forAttribute: NSOpenGLPFADepthSize forVirtualScreen: 0];
[pbFormat getValues: &stencilBits forAttribute: NSOpenGLPFAStencilSize forVirtualScreen: 0];
if ((alphaBits && !aFormat.alpha) || (!alphaBits && aFormat.alpha) ||
(depthBits && !aFormat.alpha) || (!depthBits && aFormat.depth) ||
(stencilBits && !aFormat.stencil) || (!stencilBits && aFormat.stencil))
{
[pbFormat release];
return nsnull;
}
NSOpenGLPixelBuffer *pb = [[NSOpenGLPixelBuffer alloc] NSOpenGLPixelBuffer *pb = [[NSOpenGLPixelBuffer alloc]
initWithTextureTarget:LOCAL_GL_TEXTURE_2D initWithTextureTarget:LOCAL_GL_TEXTURE_2D
textureInternalFormat:(aFormat.alpha ? LOCAL_GL_RGBA : LOCAL_GL_RGB) textureInternalFormat:(aFormat.alpha ? LOCAL_GL_RGBA : LOCAL_GL_RGB)