Fix CI: Move PrimitiveIndex FXC ordering fix to HLSL backend only

The previous commit moved PrimitiveIndex to the top of the BuiltIn enum
to fix FXC ordering (SV_PrimitiveID must appear before other SVs).
However, since BuiltIn derives Ord, this changed the global sort order,
breaking DX12 inter-stage variable matching in CTS tests.

Fix: Restore PrimitiveIndex to its original enum position and handle
the FXC ordering requirement locally in the HLSL backend's InterfaceKey
by giving PrimitiveIndex its own sort key between Location and BuiltIn.

Co-authored-by: cwfitzgerald <7861353+cwfitzgerald@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andcwfitzgerald committed 2026-03-14 16:59:01 +00:00
1 parent 1c88f7e0ce
commit 4efd8cb4e7
2 files changed
+6 -5

No files matched your search

+4
View File
@@ -91,6 +91,9 @@ pub(super) struct EntryPointInterface {
#[derive(Clone, Eq, PartialEq, PartialOrd, Ord)]
enum InterfaceKey {
Location(u32),
// FXC doesn't consider SV_PrimitiveID a system value, so it must appear
// before any other SVs in the struct.
PrimitiveIndex,
BuiltIn(crate::BuiltIn),
Other,
}
@@ -99,6 +102,7 @@ impl InterfaceKey {
const fn new(binding: Option<&crate::Binding>) -> Self {
match binding {
Some(&crate::Binding::Location { location, .. }) => Self::Location(location),
Some(&crate::Binding::BuiltIn(crate::BuiltIn::PrimitiveIndex)) => Self::PrimitiveIndex,
Some(&crate::Binding::BuiltIn(built_in)) => Self::BuiltIn(built_in),
None => Self::Other,
}
+2 -5
View File
@@ -401,11 +401,6 @@ pub enum AddressSpace {
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
pub enum BuiltIn {
// This must be at the top so that it gets sorted to the top. PrimitiveIndex is considered a non SV
// by FXC so it must appear before any other SVs.
/// Read in fragment shaders, written in mesh shaders, read in any and closest hit shaders.
PrimitiveIndex,
/// Written in vertex/mesh shaders, read in fragment shaders
Position { invariant: bool },
/// Read in task, mesh, vertex, and fragment shaders
@@ -434,6 +429,8 @@ pub enum BuiltIn {
PointCoord,
/// Read in fragment shaders
FrontFacing,
/// Read in fragment shaders, written in mesh shaders, read in any and closest hit shaders.
PrimitiveIndex,
/// Read in fragment shaders
Barycentric { perspective: bool },
/// Read in fragment shaders