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

Re: [Public WebGL] Ambiguity and Non-deterministicness in the WebGL Spec

On 13/12/2010 07:20, Gregg Tavares (wrk) wrote:
The spec has changed to effectively require a clear each time the WebGL draw buffer is composited

... By default, after compositing the contents of the drawing buffer shall be cleared to their default values. This includes the color buffer as well as the depth and stencil buffers if they are defined

Please remind me why this clearing is necessary. If it is for "security" then surely this extra clearing is only necessary if the drawingBuffer is given to a different webgl context that original drew the contents.

As I pointed out in a previous e-mail not all applications use glClear() because their other rendering will fill the entire buffer. In those cases following the above is overhead that cannot be optimized away. When I was at SGI, we used to go to enormous lengths to make sure the clear operation was fast because it has an enormous effect on the overall frame-rate. It feels really painful to be introducing extra clears.

I also don't quite understand this part

By setting the preserveDrawingBuffer attribute of the WebGLContextAttributes object to true, the contents of the drawing buffer can be preserved until the author either clears or overwrites them. If this flag is false attempting to perform operations using this context as a source image after the rendering function has returned can lead to undefined behavior. This includes readPixels or toDataURL calls, or using this context as the source image of another context's texImage2D or drawImage call.

That seems counter intuitive. The browser has the pixels. It has to be able to display them. Why do these functions have to have undefined behavior?

readPixels is defined to read pixels from the current write buffer (i.e. the drawing buffer). Other than for that, it's a fair question.


fn:Mark Callow
org:HI Corporation;Graphics Lab, Research & Development
adr:Higashiyama 1-4-4, Meguro-ku;;Meguro Higashiyama Bldg 5F;Tokyo;;153-0043;Japan
title:Chief Architect
tel;work:+81 3 3710 9367 x228
tel;fax:+81 3 5773 8660
url:http://www.hicorp.co.jp,  http://www.mascotcapsule.com