Repository navigation
Reject reads of mesh shader outputs under GL_EXT_mesh_shader - #4467
Merged
Merged
Conversation
GL_EXT_mesh_shader says "mesh shaders do not permit read access on
output variables", but glslang accepted code like
gl_MeshVerticesEXT[v].gl_Position = vec4(outVert[v].worldPos, 1.0);
and emitted an OpLoad from the Output storage class, which spirv-val
and spirv-opt then reject (VUID-StandaloneSpirv-MeshEXT-07107).
After parsing an EXT mesh shader, walk the tree and report every read
of an output: r-values, compound assignments, increments, inout
arguments and indices. Plain assignments and out arguments are still
allowed. GL_NV_mesh_shader permits these reads and is unchanged.
Fixes KhronosGroup#4170
arcady-lunarg
approved these changes
Oct 14, 2026
arcady-lunarg
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks for the fix.
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.
Fixes #4170.
GL_EXT_mesh_shader doesn't allow reading mesh shader outputs, but glslang was accepting it and emitting an
OpLoadfromOutput. You'd only find out later when spirv-val failed withVUID-StandaloneSpirv-MeshEXT-07107, which makes it pretty hard to track down. Now glslang points at the line instead:After parsing, a small traverser walks EXT mesh shaders and flags any output access that isn't a plain write (assignment target or
outargument). NV mesh shaders allow these reads, so they're left alone.Added
spv.ext.meshShaderOutputRead.error.mesh, which covers a handful of write and read cases, and all existing tests still pass. Happy to change the error wording or approach if you'd prefer something else :)