Skip to content
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

Shader reflection broken in DXIL if struct's name starts with "Buffer" #7105

Open
jbourdon-msft opened this issue Jan 31, 2025 · 0 comments
Open
Labels
bug Bug, regression, crash needs-triage Awaiting triage

Comments

@jbourdon-msft
Copy link

jbourdon-msft commented Jan 31, 2025

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:

if (TryToDetectObjectType(structType, &m_Desc.Type)) {

PREFIX_MATCH(Buffer, D3D_SVT_BUFFER);

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:

Image

DXIL:

Image

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

  • DXC version: dxcompiler.dll: 1.8.2407.12; dxil.dll: 101.8.2407.17
  • Host Operating System: Windows 11
@jbourdon-msft jbourdon-msft added bug Bug, regression, crash needs-triage Awaiting triage labels Jan 31, 2025
@jbourdon-msft 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash needs-triage Awaiting triage
Projects
Status: No status
Development

No branches or pull requests

1 participant