Skip to content

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

@keptsecret

Description

@keptsecret

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crashspirvWork related to SPIR-V

    Type

    No type

    Projects

    Status

    For Google

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions