microsoft / microsoft/DirectXShaderCompiler

StructuredBuffer is reflected as constant buffer

Open
#7,462 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
StructuredBuffer varName: register(t1) is being reflected as a constant buffer

Steps to Reproduce
https://shader-playground.timjones.io/dceaeee1d51b72b3e87ac7e6146c77bf
i'm trying to implement average luminance hdr and the shader above is reflecting t1 as a constant buffer while doing this
D3D12_SHADER_DESC shaderDesc{};
shaderReflection->GetDesc(&shaderDesc);

Actual Behavior
doing this will enumerate AverageLuminance as a constant buffer
for (unsigned int paramIdx = 0; paramIdx < desc.ConstantBuffers; paramIdx++)
{
auto cbReflection = reflection->GetConstantBufferByIndex(paramIdx);
D3D12_SHADER_BUFFER_DESC paramDesc{};
cbReflection->GetDesc(&paramDesc);

std::string cbufferName(paramDesc.Name);

Environment
dxc.exe --version
dxcompiler.dll: 1.8 - 1.8.2407.7 (416fab6b5); dxil.dll: 1.8(101.8.2407.12)
Win11

if this behavior is expected please discard the bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names no repository files or tests; start with the linked shader-playground reproduction and the D3D12 reflection entry points shown, including GetDesc and GetConstantBufferByIndex. Determine whether StructuredBuffer at register(t1) should appear among constant buffers; done means establishing the expected behavior and locating the relevant compiler or reflection test area.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.