DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
[SPIR-V] Compile and generate reflection information for shader in a single command.
Hello.
I've been trying to get dxc
to compile to SPIRV, stripping reflection infro from the shader and generate reflection info for SPIRV-reflect using a single command like this:
dxc -Qstrip_reflect -spirv -fspv-reflect -fspv-target-env=vulkan1.3 -HV 2021 -T ps_6_7 -Fre reflect/base.frag.ref -Fo bin/base.frag.spv base.frag.hlsl
But instead of two files - one .ref
and .spv
, I only get the .spv
one, with (what it looks like) reflection info in it, as SPIRV-Reflect is able to read the reflection info from it.
I've been trying to do it according to the description in this issue, but wasn't able to and this issue was closed, as the OP was using the SDK and I have to use the commandline.
Any suggestions?
@sudonatalie @kuhar. I've confirmed that this only happens with spirv
The -Qstrip_reflect
and -Fre
options are not currently supported by the SPIR-V backend and we don't have any current plans to implement them, although PR contributions are welcome and will be reviewed.
As a workaround, you can follow up your compilation with -fspv-reflect
by running spirv-opt --strip-nonsemantic
on the results to output a SPIR-V module with all reflection information removed. spirv-opt
is distributed as part of the Vulkan SDK and at KhronosGroup/SPIRV-Tools.