[Public WebGL] Optimization or bug?

Mark Callow [email protected]
Wed May 11 01:54:41 PDT 2011

It looks like it is a clever optimization. I modified the test so it
sets gl.colorMask(gl.TRUE, gl.TRUE, gl.TRUE, gl.FALSE) before the first
clear so it never writes to the alpha channel. This gives a transparent
canvas. However it is not strictly following the specification and
having different results across browsers causes problems, which is why
we spotted this in the first place.



On 11/05/2011 12:58, Mark Callow wrote:
> We have discovered an interesting edge case regarding clearing of the
> drawing buffer after presentation when preserveDrawingBuffer is false
> where the implementations have different behaviour. A simple test
> program is attached.
> The test program clears only the color channels; the alpha channel is
> masked. Both Chrome & Safari clear the alpha channel to zero as
> required by the specification. Firefox 4 does not. On the systems I
> have tested so far, the initial value set by of 1.0 set when the test
> starts, remains in the alpha channel. Most likely the underlying GL
> implementations I've been able to test with preserve the drawing
> buffer across swap giving this result.
> But is this a bug in Firefox or a smart optimization? One could argue
> that if the WebGL implementation knows that the GL is preserving the
> buffer contents and the application has cleared the channel at least
> once, no further action is necessary to preserve security. What do the
> list members think?
> By the way, the spec language needs a small tweak. Section 2.2 says
>     "The table below also shows the value to which these buffers shall
>     be cleared when first created or when the size is changed."
> It needs to say
>     "... when first created, when the size is changed or after
>     presentation when preserveDrawingBuffer is false."
> Regards
>     -Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110511/e19b6dbf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: callow_mark.vcf
Type: text/x-vcard
Size: 412 bytes
Desc: not available
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110511/e19b6dbf/attachment.vcf>

More information about the public_webgl mailing list