KhronosGroup / KhronosGroup/glslang
Missing error messages for gl_PerVertex matching between stages
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
This issue is related to issue #2243 and issue #1726. It seems that the contents of gl_PerVertex is inconsistently filled in glslang, and the extensions that change this block don't seem to be consistently following the specs. From everything I've read, in particular the interface matching rule from the OpenGL spec, 7.4.1 requires the gl_PerVertex structure to match between stages except for gl_PointSize. Various extensions break this rule (GL_NVX_multiview_per_view_attributes, GL_ARB_shader_viewport_layer_array, GL_NV_stereo_view_rendering) without explicitly stating new exceptions.
But, even if they had exceptions, in glslang many of these variables aren't included in gl_PerVertex consistently. gl_ViewportIndex and gl_Layer aren't included in gl_PerVertex at all, even though the extension states they should be. In other cases such as gl_SecondaryPositionNV, it's not included in the Vertex shader's output gl_PerVertex block, but is included in the Geom/Tess/Control shader's input gl_PerVertex block. It is then left outside the output gl_PerVertex blocks for the Geom/Tess/Control shader.
Now, with the more robust block checking that is happening with the recent vulkan_relaxed merge, the gl_PerVertex interface is going to fail to match a lot. Attached is a minimal example, if you run it with
`glslangValidator -V --aml --amb cross.vert cross.geom`
You'll see it's failing due to the gl_PerVertex blocks not matching.
Should we just disable interface matching validations for gl_PerVertex?
[cross.zip](https://github.com/KhronosGroup/glslang/files/6152913/cross.zip)
Contributor guide
Research direction
Start by running the attached cross.vert and cross.geom example with glslangValidator -V --aml --amb to reproduce the gl_PerVertex interface-matching failure. Read the matching validation reached by that entry point and compare its behavior with the OpenGL interface-matching rule and the listed extensions; done requires an agreed, spec-consistent validation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100