New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPIR-V] Arrays of empty structs in cbuffers produce validation errors when optimizations are disabled (asks to file a bug) #3101
Comments
*If no comment in shader, tex+sampler emulation issue microsoft/DirectXShaderCompiler#3100 *A few shaders fail due to use of arrays of empty structs in cbuffers microsoft/DirectXShaderCompiler#3101 *AmbientProbeConvolution.compute fails to create an Metal pipeline, not yet sure what the issue is but produces black artifacts on lit objects due to bad env lighting data
I am not sure we have a clear solution for this issue because it happens because of the limitation of SPIR-V.
If we do not set the However, the
If we set the The DXIL result sets the array size and stride as In my opinion, the best thing we can do is just disabling the spirv-val check when it has a cbuffer with an empty array and the legalization is disabled. |
Fixes microsoft#3101 error out if 2 blobs compiled with different compiler versions are linked.
Title
Having an array of empty structs in a cbuffer produces a validation error when compiling without optimizations. Error message asks to report issue.
Functional impact
Compilation fails only with optimization level
0
i.e. when using compilation flag-O0
or-Od
Minimal repro steps
dxc.exe -T ps_6_0 -E Frag repro_shader.hlsl -spirv -O0
Observe printed error message:
the error produced is appropriately different:
Here's a quick reproduction on shader-playground
Expected result
Compilation succeeds and works since the DXIL backend works with
-O0
. In DXIL the empty cbuffer seems to be removed if unused (which might not be an option) but even if the empty struct array is put into a used cbuffer it is actually correctly identified (marked with/* empty struct */
see example)Actual result
Compilation fails with error seen in the reproduction steps. Error message asks to report the issue.
Further technical details
Reproduces also on most recent source builds of DXC 530958e
The text was updated successfully, but these errors were encountered: