Skip to content

[0036] Deprecate extra, ignored semantic annotations in HLSL 202x #535

@tex3d

Description

@tex3d

Which proposal does this relate to?
0036-202x-deprecations.md

Also related: 0020-hlsl-202x-202y.md

Describe the issue or outstanding question.
Currently, HLSL allows multiple semantic annotations (: SV_Position : MySemantic2 : ...) on a single declaration. The language ignores all but the last one (though there's a bug where DXC ignores all but the first one for SPIR-V targets).

Note: This is not referring to annotations like bindings or pack offsets which have a similar syntax (: register(...)), since there should be separate rules for these.

Duplicate, ignored semantic annotations doesn't seem like a useful feature, and could easily lead to confusion and bugs, as was the case with the SPIR-V implementation.

I propose we add a warning to DXC when this is detected, making this an error for HLSL language version 202x or above. For the warning, we should assign a group to allow the warning to be disabled for compatibility.

Additional context
This inconsistency between SPIR-V and DXIL behavior is pointed out here:
llvm/wg-hlsl#296 (comment)
https://godbolt.org/z/cx8dG97rP

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status
    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions