KhronosGroup / KhronosGroup/glslang
Mesh shaders: max_primitives max value limitation issue
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
VkPhysicalDeviceMeshShaderPropertiesNV::maxMeshOutputPrimitives and VkPhysicalDeviceMeshShaderPropertiesNV::maxMeshOutputVertices can be queried using Vulkan API.
In the following code:
`layout(max_vertices=256, max_primitives=512, triangles) out;`
When I set 'max_primitives' in GLSL in shader to the value of maxMeshOutputPrimitives which is 512 (this is a limit on my NVidia) I get this error:
```
max_primitives
'
: too large, must be less than gl_MaxMeshOutputPrimitivesNV
ERROR: 0:9:
```
gl_MaxMeshOutputPrimitivesNV is not even mentioned in the mesh shader extension (so is gl_MaxMeshOutputVerticesNV), anyway when I use it:
`layout(max_vertices=256, max_primitives=gl_MaxMeshOutputPrimitivesNV, triangles) out;`
I get the SPIR-V code:
`; SPIR-V ; Version: 1.0 ; Generator: Khronos Glslang Reference Front End; 7 ; Bound: 72 ; Schema: 0 OpCapability MeshShadingNV OpExtension " SPV_NV_mesh_shader " ....
LocalSize 4 1 1 OpExecutionMode %4 OutputVertices 4 OpExecutionMode %4 OutputPrimitivesNV 256
..... `
**OutputPrimitivesNV 256**
I don't believe it's the way it should work as the value returned by the implementation, using the API, is 512.
Contributor guide
Research direction
Start with the GLSL mesh shader limit handling and the generated SPIR-V execution modes shown in the report. Compare the API-reported limit of 512 with the emitted OutputPrimitivesNV value of 256 and consult the mesh shader extension behavior; done means the compiler's accepted limit and generated value correctly reflect the implementation limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100