Bug 85338

Summary: Enforce alpha:false and depth:false more consistently
Product: WebKit Reporter: Kenneth Russell <kbr>
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, dino, gman, twiz, zmo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 85317    
Bug Blocks:    

Description Kenneth Russell 2012-05-01 19:09:24 PDT
WebKit's WebGL implementation currently relies heavily on the OpenGL driver to provide certain behavior, such as when the developer requests that the alpha channel be disabled for the back buffer, or no depth buffer be provided.

Gregg Tavares went to great lengths in Chromium to avoid running into driver bugs in these areas. For example, if the user requests no alpha channel, his code will always allocate an RGBA texture, but do tricks with the color mask and clear color to ensure that its alpha channel is always populated with 0xFF. These workarounds were motivated by driver bugs encountered in real applications; see for example Bug 61091. Unfortunately, Gregg's workarounds were lost when moving WebKit's WebGL implementation to use a user-allocated FBO (in DrawingBuffer) for its rendering results.

Bug 85317 restores the behavior for the stencil buffer. For best robustness, similar code is needed for the color mask, depth mask and other state. See ApplyDirtyState in http://src.chromium.org/viewvc/chrome/trunk/src/gpu/command_buffer/service/gles2_cmd_decoder.cc . This code should be added to WebGLRenderingContext and other classes to apply to all WebKit ports.