[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] Re: inconsistent clear behavior for preserveDrawingBuffer: false (the default)





On Fri, Jun 1, 2012 at 1:49 PM, Gregg Tavares (çç) <gman@google.com> wrote:
I was trying to repo an error mentioned in another thread

Here's my test

http://jsfiddle.net/greggman/hDcxp/1/

The spec says

WebGL presents its drawing buffer to the HTML page compositor immediately before a compositing operation, but only if the drawing buffer has been modified since the last compositing operation. Before the drawing buffer is presented for compositing the implementation shall ensure that all rendering operations have been flushed to the drawing buffer. By default, after compositing the contents of the drawing buffer shall be cleared to their default values, as shown in the table above.

In the sample I clear the drawing buffer to green. Then 1 second later I issue some GL commands to see what happens. ÂThese 6 commands should not effect what is displayed

   ÂÂgl.enable(gl.BLEND);
   ÂÂgl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
   ÂÂgl.viewport(1,1,1,1);
   ÂÂgl.bindFramebuffer(gl.FRAMEBUFFER, null);
    var p = new Uint8Array(4);
    gl.readPixels(0,0,1,1,gl.RGBA,gl.UNSIGNED_BYTE, p);

What I find is Firefox ends up reflecting that the backbuffer has been cleared if I call gl.readPixels. On other words it recomposites the page with the cleared drawing buffer. As far as I can tell from the spec that's a bug. The drawing buffer has not been modified so Âit should not be composited again.

On Chrome if I call gl.drawArrays(gl.TRIANGLE, 0, 0) the drawing buffer is not recomposited. That could be argued either way. The drawing buffer did not get modified but it's a special case. I could easily call gl.drawArrays with a real program and real data that doesn't actually end upÂmodifyingÂthe drawing buffer. ÂI think this means the spec should be more clear. Instead of saying "but only if the drawing buffer has been modified since the last compositing operation" it should be specific and say "Âbut only if clear, drawArrays or drawElements have been called since the last compositing operation".


Actually I think it should say

"Âbut only ifÂclear, drawArrays or drawElements have been called while the drawing buffer is the currently bound framebufferÂsince the last compositing operation".

or something to that effect.
Â
Thoughts?

Unfortunately there is no way to write conformance tests for these cases. In all cases the drawing buffer is cleared correctly and so calling readPixels to verify will pass on all browsers. This is only something browser vendors can test themselves with screen captures or other browser specific test.