Skip to content

Semantics declarations on resources, static variables and cbuffer members should be an error/warning #7639

Open

Description

@Maraneshi

Description
There are many places where DXC currently accepts semantic declarations that don't really make much sense. This includes resource declarations, static variables and members of cbuffers. I wouldn't be surprised if I missed some other cases. This works with any semantic name as far as I can tell.

Steps to Reproduce
https://hlsl.godbolt.org/z/n19xv7zsv

Actual Behavior
All of the semantics do nothing in these cases, but there are no diagnostics emitted. It should probably at minimum be a warning like it is in clang. Regarding cbuffers specifically, it should technically still be valid to have a nested struct inside with semantics on its members because that struct could then be reused for a function entry point parameter or return value, but you cannot directly use a cbuffer that way because it is not considered a struct and thus semantic declarations on its direct (non-nested) members should be rejected.

Environment

  • DXC version: 1.6+
  • Host Operating System: All
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions