KhronosGroup / KhronosGroup/SPIRV-Tools

Request: allow SpirvToolsEliminateDeadInputComponents() to strip non-trailing members from blocks

Open
#5,631 2 comments 0 reactions 1 assignee Claimed by @jeremy-lunarg View on GitHub
component:optimization
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

Sending the the following fragment shader through SpirvToolsEliminateDeadInputComponents() and SpirvToolsAnalyzeDeadOutputStores() results in `t` getting eliminated, but not `pos`. Can't `pos` also be eliminated? The analyze pass is correctly detecting that only `c` is being used, and only returning it as part of the livelocs.
And then similarly, SpirvToolsEliminateDeadOutputStores() would need to also to remove `pos`.

Vertex
```
out Vertex
{
vec3 pos;
vec4 c;
vec2 t;
} oVert;
void main()
{
oVert.pos = vec3(0.5);
oVert.c = vec4(1.0);
oVert.t = vec2(0.4);
gl_Position = vec4(0.0);
}
```
Fragment
```
in Vertex
{
vec3 pos;
vec4 c;
vec2 t;
} iVert;

out vec4 fragColor;
void main()
{
vec4 color = vec4(iVert.c);
fragColor = color;
}
```
Compiled using 'auto map locations'.

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.