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

[Public WebGL] Error catching with getBufferSubData



Something I noticed today while working on Chrome's implementation of this function. The implied underlying call to glMapBufferRange may return a NULL pointer if the call fails for some reason. This provides a way to do efficient error handling. The WebGL function, however, passes in an ArrayBuffer to be populated and returns nothing, which means the only way to communicate a failure is via getError. It's poor API design to require getError calls after an otherwise valid API call just to ensure it worked.

I propose we update the spec to have getBufferSubData return a GLboolean or similar to indicate whether or not the mapping succeeded. That way getError calls can be avoided unless we know the mapping failed. Any concerns with this approach?

--Brandon