microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Push constant of a derived struct causes multiple fatal errors

Open
#8,247 0 comments 0 reactions 1 assignee View on GitHub

@s-perron is already working on this.

Since Mar 26, 2026.

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

Description

Description
(1) Attempting to access a value in a push constant of a derived struct results in fatal error: generated SPIR-V is invalid: OpAccessChain reached non-composite type while indexes still remain to be traversed.

(2) A different fatal error is produced if the derived push constant struct is empty whereas the parent has members: fatal error: generated SPIR-V is invalid: Index '9[%int_0]' is out of bounds: OpAccessChain cannot find index 0 into the structure <id> '4[%type_PushConstant_SDebugPushConstants]'. This structure has 0 members. Largest valid index is -1.

Steps to Reproduce
(1) Use a push constant of a derived struct type and attempt to access members of the struct. See godbolt repro: https://godbolt.org/z/fqKvr6581

(2) Use a push constant of a derived struct type (of which has no members of its own) and attempt to access members of the parent struct type. See godbolt repro: https://godbolt.org/z/q4x4KWd43

Actual Behavior
Would expect both cases to work perfectly fine. Current workaround is having to do composition over inheritance. https://godbolt.org/z/KjvaYedvq

Environment

  • DXC version trunk
  • Host Operating System Windows 11

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.