Repository navigation
Conversation
…location WebGL represents uniform locations as opaque WebGLUniformLocation objects, so Emscripten maintains a per-program table that maps the integer locations of GLES to them. That table is populated lazily on the first call to glGetUniformLocation(). If glUniform*() was called with an integer that is not in the table, e.g. a hardcoded location that was never acquired from glGetUniformLocation(), the lookup produced `undefined`, which WebGL silently ignores. In native GLES such a call generates GL_INVALID_OPERATION, which made this kind of bug hard to notice when porting. Record GL_INVALID_OPERATION when the location passed to glUniform*() does not resolve to a uniform location of the current program and is not -1. The error is not raised in -sGL_EXPLICIT_UNIFORM_LOCATION builds: there a call that uses the explicit layout(location=x) of a uniform that the linker deemed inactive must be silently ignored (ARB_explicit_uniform_location, issue 4), and the locations taken up by inactive uniforms are not tracked. Fixes: emscripten-core#16367 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Record GL_INVALID_OPERATION when the location passed to glUniform*() does not resolve to a uniform location of the current program and is not -1.
Fixes: #16367