[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Comments on Dec 20th draft
On Wed, Dec 21, 2011 at 12:07 PM, Daniel Koch <email@example.com>
Desktop GL with the ARB_robustness extension and reset notifications enabled can result in a lost context. Unfortunately that extension doesn't specify what happens if you make GL calls when the extension is lost.
That extension appears to effectively say that you're supposed to constantly check GetGraphicsResetStatusARB() before every OpenGL call ("After a reset event, apps should not use a context for any purpose other than determining its reset status, and then destroying it."), which doesn't seem like a very usable API. Also, saying that users shouldn't do something, without defining what happens if they do, seems like a bug.
What happens if the context is lost between a call to GetGraphicsResetStatusARB() and an OpenGL call immediately after it? That seems like a race condition that makes it impossible to actually avoid using a context that's been lost.
We've implemented an ES version of this extension in ANGLE (EXT_robustness) and we generate GL_OUT_OF_MEMORY on all GL calls that happen after a lost context. We'd considered making all the calls NOPs as suggested above, but any GL call that has a return parameter will have un-defined contents and that is only allowable by the spec if you have an OOM error.
Context loss shouldn't result in undefined output, it should leave the value unchanged. Causing undefined changes to be made to these parameters would be very difficult to code for; you'd have to check getError() after each such call, which isn't normal (more, it's discouraged) in OpenGL programs. Is there something about the Direct3D implementation that makes this hard to do?