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
Description
The information gathered from a RWStructuredBuffer using ID3D12ShaderReflection isn't the same for DXBC and DXIL if the template argument type name starts with "Buffer". The DXBC information is the expected one.
After a very quick investigation, the problem seems to come from here:
Steps to Reproduce
Build a shader with a declaration like:
struct BufferData { int i; int j; };
RWStructuredBuffer<BufferData> resource;
Accessing the information about that resource through ID3D12ShaderReflection will not get you the correct information about BufferData if the reflection is on DXIL. Getting to the D3D12_SHADER_TYPE_DESC of the BufferData struct through the ID3D12ShaderReflectionConstantBuffer associated to the declared RWStructuredBuffer will give you different results whether you're reflecting on DXBC or DXIL.
DXBC:
DXIL:
Actual Behavior
Note that if the struct name does not start with "Buffer", the behavior is the same for both DXIL and DXBC.
The DXIL information should be the same as that of DXBC in all cases.
jbourdon-msft
changed the title
Shader reflection on DXIL vs DXBC for struct starting with prefix "Buffer".
Shader reflection broken in DXIL if struct's name starts with "Buffer"
Jan 31, 2025
Description
The information gathered from a
RWStructuredBuffer
usingID3D12ShaderReflection
isn't the same for DXBC and DXIL if the template argument type name starts with "Buffer". The DXBC information is the expected one.After a very quick investigation, the problem seems to come from here:
DirectXShaderCompiler/lib/HLSL/DxilContainerReflection.cpp
Line 1258 in ef1472a
DirectXShaderCompiler/lib/HLSL/DxilContainerReflection.cpp
Line 941 in ef1472a
Steps to Reproduce
Build a shader with a declaration like:
Accessing the information about that resource through
ID3D12ShaderReflection
will not get you the correct information aboutBufferData
if the reflection is on DXIL. Getting to theD3D12_SHADER_TYPE_DESC
of theBufferData
struct through theID3D12ShaderReflectionConstantBuffer
associated to the declaredRWStructuredBuffer
will give you different results whether you're reflecting on DXBC or DXIL.DXBC:
DXIL:
Actual Behavior
Note that if the struct name does not start with "Buffer", the behavior is the same for both DXIL and DXBC.
The DXIL information should be the same as that of DXBC in all cases.
Environment
The text was updated successfully, but these errors were encountered: