Open kayru opened 5 years ago
Any response to this?
Edit: looks like -g
can be used to preserve the reflection data, even though the description says that it has no effect.
Edit2: alternatively, spirv-opt can be used to do the optimization afterwards.
But -g
is for preserving full debug data, which may not always be needed.
I indeed currently first compile a shader without optimizations, extract reflection data and then run spirv-opt explicitly. It would be nice to just streamline this workflow.
spirv-opt actually preserves the reflection data during optimization the way glslc also should, so it's possible to swap the last two phases in your workflow. But I agree, there should be no need to invoke spirv-opt separately after the first build step.
This would be great feature to have, +1.
+1 as I've arrived here myself, ~3 years on
any update?
When
glslc
is used to compile shaders with-O
flag, the reflection data is always stripped. This may not always be desired.For example:
> 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 tofxc.exe
, where reflection data must be explicitly stripped via/Qstrip_reflect
or that ofglslangValidator
?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.