Repository navigation
Conversation
… -sFULL_ES2 Fixes: emscripten-core#14589 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
| err(`GL_INVALID_VALUE in glEnableVertexAttribArray(index=${index}): index must be in the range 0 <= index < GL_MAX_VERTEX_ATTRIBS (${GL.currentContext.maxVertexAttribs})!`); | ||
| #endif | ||
| GL.recordError(GL_INVALID_VALUE); | ||
| return; |
There was a problem hiding this comment.
Should the GL_TRACK_ERRORS just wrao the call to recordError?
i.e. My understanding is that turning on or off GL_TRACK_ERRORS doesn't effect whether a given call will crash or not, just whether or not glGetError will report the errors?
So maybe we should still return early if cb is missing here?
There was a problem hiding this comment.
Should the GL_TRACK_ERRORS just wrao the call to recordError?
That would be nice if we did require Closure compiler.. but for example Unity is not currently able to use it, so there would be tons of GL.recordError()s still left behind.
My understanding is that turning on or off GL_TRACK_ERRORS doesn't effect whether a given call will crash or not, just whether or not glGetError will report the errors?
GL_TRACK_ERRORS=1 would be that "I want benign failures" mode, and GL_TRACK_ERRORS=0 would be a "I've tested my code to not need all that pedantic error tracking" mode.
So in the GL_TRACK_ERRORS=0 mode, we'd generally assume that user doesn't run into these types of errors in the first place, so a if (!cb) return; would then be dead code.
| 'full_es2': (['-sFULL_ES2'],), | ||
| 'full_es2_assertions': (['-sFULL_ES2', '-sGL_ASSERTIONS'],), | ||
| 'full_es3': (['-sFULL_ES3', '-DTEST_WEBGL2'],), | ||
| 'full_es3_assertions': (['-sFULL_ES3', '-DTEST_WEBGL2', '-sGL_ASSERTIONS'],), |
There was a problem hiding this comment.
Should we check the -sGL_TRACK_ERRORS=0 too and maybe sure we don't just crash/trap in that case?
There was a problem hiding this comment.
I think it's fine to throw an exception in that case. We do have other locations that use GL_TRACK_ERRORS like that, assuming that the errors don't occur in the first place.
| glDisableVertexAttribArray(max_vertex_attribs - 1); | ||
| assert(glGetError() == GL_NO_ERROR); | ||
|
|
||
| printf("Test passed!\n"); |
There was a problem hiding this comment.
This test program seem fairly involved for something that is just checking if a given call errors on a bad index.
Can it be simplified? Maybe just a few lines of code and achieve the same result?
There was a problem hiding this comment.
We could test just bad API calls before compiling a program, but then it would be only testing a scenario where user doesn't even have a valid program set up. It does seem more robust to actually test that having a valid program, and then asking for invalid indices in the code.
Fix calling glEnableVertexAttribArray(), glDisableVertexAttribArray(), glVertexAttribPointer() or glVertexAttribIPointer() with an invalid attribute index to record a GL_INVALID_VALUE when -sFULL_ES2 is active.
Fixes: #14589