You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPIR-V] Resources declared in cbuffer scope result in validation errors instead of being moved out (works with FXC)
Functional impact
Can't declare resources inside of constant buffers which breaks backwards compatibility with FXC. The DXIL backend keeps the resources inside the CBuffer which results in a different cbuffer layout than FXC but as the types aren't opaque they at least don't fail validation so the shaders are usable. The SPIR-V backend results in a validator error about opaque types in the cbuffer.
Minimal repro steps
Compile repro_shader.txt (see below) with dxc.exe -T ps_6_0 -E PSMain -spirv repro_shader.txt:
fatal error: generated SPIR-V is invalid: In Vulkan, OpTypeStruct must not contain an opaque type.
%type_NamedCBuffer = OpTypeStruct %v4float %type_2d_image %type_sampler
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
Expected result
No validator error is printed. This could be achieved by moving the resources out of the cbuffer scope to be be declared in the global scope.
Actual result
Compiler prints the validation error seen in step 2. of the Minimlar repro steps section
Further technical details
Test output copied from shader playground (link here).
Slightly related to #2695, where resources in structs used to be placed in the global cbuffer, which was fixed.
The text was updated successfully, but these errors were encountered:
The current DXC does not separate the resources from a cbuffer, which
results in a OpTypeStruct including resources. We have to separate the
resources from a cbuffer.
Fixesmicrosoft#4019
The current DXC does not separate the resources from a cbuffer, which
results in a OpTypeStruct including resources. We have to separate the
resources from a cbuffer.
Fixes#4019
Title
[SPIR-V] Resources declared in cbuffer scope result in validation errors instead of being moved out (works with FXC)
Functional impact
Can't declare resources inside of constant buffers which breaks backwards compatibility with FXC. The DXIL backend keeps the resources inside the CBuffer which results in a different cbuffer layout than FXC but as the types aren't opaque they at least don't fail validation so the shaders are usable. The SPIR-V backend results in a validator error about opaque types in the cbuffer.
Minimal repro steps
dxc.exe -T ps_6_0 -E PSMain -spirv repro_shader.txt
:Expected result
No validator error is printed. This could be achieved by moving the resources out of the cbuffer scope to be be declared in the global scope.
Actual result
Compiler prints the validation error seen in step
2.
of theMinimlar repro steps
sectionFurther technical details
Test output copied from shader playground (link here).
Slightly related to #2695, where resources in structs used to be placed in the global cbuffer, which was fixed.
The text was updated successfully, but these errors were encountered: