KhronosGroup / KhronosGroup/SPIRV-Cross
Does spirvcross optimize out unused push constants?
- Dominant language
- GLSL
- Stars
- 2.5k
- Forks
- 713
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 16
Description
Greetings,
compiled the following glsl vertex shader with spirvcross for Vulkan on an Nvidia card:
`
#version 310 es
precision highp float;
precision highp int;
layout( std140, push_constant ) uniform PushConstants {
lowp float someValue;
};
layout(location = 0) in vec4 a_pos;
layout(location = 3) in vec2 a_tex;
layout(location = 0) out vec2 tex;
void main()
{
gl_Position = a_pos;
tex = a_tex;
}
`
When I try to get the push constant block from the compilers spirv_cross::ShaderResources object it is not there. In the fragment shader that has the same PushConstants block it is there.
Is this an error or intended? Might it have something to do with that the fragment shader uses the variable while the vertex shader doesn't?
Regards
Contributor guide
No contributing guide indexed for this repository
Research direction
Start from the provided GLSL vertex and fragment shaders and inspect how their SPIR-V resources are reflected through spirv_cross::ShaderResources. Compare the push-constant results for the unused and used members; determine whether omission of the unused vertex-stage block is intended, and document or test the confirmed behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100