KhronosGroup / KhronosGroup/SPIRV-Tools
SpirvToolsEliminateDeadInputComponents() doesn't seem to be trimming array size down
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
The following code does not end up with a reduced array size for `arrInOut`. The whitepaper (and my recollection of early tests of this feature with @greg-lunarg) seems to suggest that array size should get reduced to arrInOut[2]. Since the resources available for in/out variables between shader stages are very limited, this is an important optimization.
`arrIn` is correctly reduced to arrIn[2] though.
Vertex:
```
out Vertex
{
vec4 c;
vec3 n;
} oVert;
in vec3 arrIn[5];
out vec3 arrInOut[5];
void main()
{
arrInOut[1] = arrIn[1];
oVert.c = vec4(1, 0, 0, 1);
oVert.n = vec3(1);
gl_Position = vec4(0);
}
```
Fragment
```
in Vertex
{
vec4 c;
vec3 n;
} iVert;
in vec3 arrInOut[5];
out vec4 fragColor;
void main()
{
vec4 color = vec4(iVert.c + arrInOut[1].xyzz);
fragColor = color;
}
```
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.