Skip to content

Conversation

@tex3d
Copy link
Contributor

@tex3d tex3d commented Nov 4, 2025

This fixes a linking bug where the SemanticKind of a SV_PrimitiveID input in a Geometry Shader gets erroneously replaced with SemanticKind::Invalid.

When copying the input signature from the library module to the final module during linking, new signature elements are constructed and initialized using DxilSignatureElement::Initialize (there is no copy constructor). Initialize doesn't have an argument for the original SemanticKind, normally constructing it based on the name and the SigPoint.

However, the SigPoint for this element should be GSIn rather than GSVIn, which is the default for all items in this signature. This causes it to set the SemanticKind to Invalid. There is code to correct for this in DxilSignatureElement::SetKind used when initializing an element from metadata, but that wasn't called in this signature copying code path.

This change updates DxilSignatureElement::Initialize to call SetKind using the semantic looked up only by name. SetKind will correct the SigPoint if necessary and set the semantic by looking it up by SemanticKind and SigPoint. This change also moves system value name canonicalization to SetKind.

Fixes #7625.

This fixes a linking bug where the `SemanticKind` of a `SV_PrimitiveID`
input in a Geometry Shader gets erroneously replaced with
`SemanticKind::Invalid`.

When copying the input signature from the library module to the final
module during linking, new signature elements are constructed and
initialized using `DxilSignatureElement::Initialize` (there is not direct
copy constructor).  Initialize doesn't have an argument for the original
SemanticKind, normally constructing it based on the name and the
`SigPoint`.

However, the `SigPoint` for this element should be `GSIn` rather than
`GSVIn`, which is the default for all items in this signature. This causes
it to set the `SemanticKind` to `Invalid`.  There is code to correct for
this in `DxilSignatureElement::SetKind` used when initializing an element
from metadata, but that wasn't called in this signature copying code path.

This change updates `DxilSignatureElement::Initialize` to call `SetKind`
using the semantic looked up only by name.  `SetKind` will correct the
`SigPoint` if necessary and set the semantic by looking it up by
`SemanticKind` and `SigPoint`. This change also moves system value name
canonicalization to `SetKind`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

lib_ target: SV_PrimitiveID is disallowed during GSVIn

1 participant