Conversation
…. In that case, issue GL_INVALID_OPERATION, generate resources with ID 0, and print an error if GL_ASSERTIONS is enabled.
|
Why the focus on |
|
This is to avoid a crash in those functions, when accessing a property of |
|
Still, why focus on those? Surely we would crash in many other GL methods, if the context is gone? (when using those objects, not just when creating them?) |
|
Yeah, then we should fix the other GL methods as well so that they don't crash either. I don't know which other methods we have that currently have this issue, do you have some specific in mind? Note that not having a context is not the same as having a context that is lost. In other words, |
|
If this is an issue we need to fix, I hope we can find a better way. For example, we could automatically add to all GL calls a prelude I guess the question is, should we report an error here. Or, we can listen for context loss, so we could throw a JS error in that case, which seems just as good - the application is going to fail anyhow? |
|
We don't want to throw a JS error if the user calls a GL function when the context is lost. Also, we don't need to raise a GL error on behalf of WebGL for any entry points that lead to calling to a WebGL function, since it is WebGL's responsibility already to handle the GL error correctly in that case. The existing GL functions should already behave fine like expected, just these resource creation functions in this PR had a bad pattern where they could fail, since they accessed a member of null. Applications don't fail when a GL context is lost, but that's a normal app lifecycle event where the application just cannot render until the GPU becomes available again. This occurs e.g. on Firefox OS every time the user presses the home screen button to switch between applications. |
|
Ok, I didn't understand the background here, now I think I see. |
|
Sorry, my bad for not explaining the rationale better in the PR! |
Define behavior when attempting glGen* when the WebGL context is lost. In that case, issue GL_INVALID_OPERATION, generate resources with ID 0, and print an error if GL_ASSERTIONS is enabled.