google / google/shaderc

Allow keeping reflection data in optimized shaders

Open
#600 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

When `glslc` is used to compile shaders with `-O` flag, the reflection data is always stripped. This may not always be desired.

For example:

```
#version 450
layout (location = 0) out vec4 fragColor;
layout (set=0, binding = 0) uniform Uniforms { vec4 uniformColor; };
void main() { fragColor = uniformColor; }
```

`> glslangValidator shader.frag && spirv-cross a.spv --reflect` produces the desired result (referenced resources and their names are present).
`> glslc shader.frag -O && spirv-cross a.spv --reflect` produces auto-generated symbol names, since real reflection data is not present.

Would it be possible / make sense to add an option to `glslc` that would keep reflection data even in the optimized spv? Or perhaps it would be worth changing default behavior to be similar to `fxc.exe`, where reflection data must be explicitly stripped via `/Qstrip_reflect` or that of `glslangValidator`?

I understand and expect that reflection with and without optimizations will be different. This is the case for `fxc` as well, and would not be surprising.

Is this a simple oversight or is there a serious issue that prevents this that I overlooked?

Just in case: this is using glslc in LunarG Vulkan SDK 1.1.106.0.

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.