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

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

On 2010-12-14 11:12, Mark Callow wrote:

On 14/12/2010 18:19, Tim Johansson wrote:

The problem with saying it is undefined is that it will essentially mean you have to do whatever most desktop versions are doing or the content will not work. My guess is that most desktop versions would in this case do a copy of the buffer to avoid all the issues with doDataURL, readPixels etc. In that case the spec says you can do whatever you want, but in order to be compatible with the content you have to reverse engineer what other implementations are doing and do the exact same thing. For that reason I think leaving it undefined would be a mistake.


I'm with Gregg. I do not understand why toDataURL is an issue as the browser must already have the pixels for the reasons Gregg has stated. Just define toDataURL to return the pixels the browser is using for compositing. If the application calls it during a render period, it will get the content from the previous frame or the initial canvas color.

readPixels is defined to read from the current write buffer so is not valid once the _javascript_ code has returned to the browser.  The sole issue appears to be an application calling readPixels in its rendering loop before it has drawn anything into the draw buffer.

Sure, in most cases you can probably solve the toDataURL call that way. readPixels after the js returns  or before rendering could work fine in some implementations if the buffers content is undefined though.
But that does not change my main point: leaving it undefined does not mean you can do whatever you want, in order to be compatible with the content you have to do what the most popular implementations does.
I see no value in leaving it undefined and requiring implementations to check what the other implementations are doing in order to be compatible with all content. Implementing the spec should IMO be enough to be compatible with all content and if we leave this undefined that is, based on previous experience with undefined behavior in web specs, likely to not be the case. I am not saying it has to be the way it is now, just that it should not be undefined.