Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/DXIL/DxilSignatureElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ void DxilSignatureElement::Initialize(llvm::StringRef Name,
if (!IndexVector.empty())
m_SemanticStartIndex = IndexVector[0];
// Find semantic in the table.
m_pSemantic = Semantic::GetByName(m_SemanticName, m_sigPointKind);
// Replace semantic name with canonical name if it's a system value.
if (!m_pSemantic->IsInvalid() && !m_pSemantic->IsArbitrary())
m_SemanticName = m_pSemantic->GetName();
SetKind(Semantic::GetByName(m_SemanticName)->GetKind());
SetCompType(ElementType);
m_InterpMode = InterpMode;
m_SemanticIndex = IndexVector;
Expand Down Expand Up @@ -136,6 +133,9 @@ void DxilSignatureElement::SetKind(Semantic::Kind kind) {
// recover the original SigPointKind if necessary (for Shadow element).
m_sigPointKind = SigPoint::RecoverKind(kind, m_sigPointKind);
m_pSemantic = Semantic::Get(kind, m_sigPointKind);
// Replace semantic name with canonical name if it's a system value.
if (!m_pSemantic->IsInvalid() && !m_pSemantic->IsArbitrary())
m_SemanticName = m_pSemantic->GetName();
}

Semantic::Kind DxilSignatureElement::GetKind() const {
Expand Down
20 changes: 20 additions & 0 deletions tools/clang/test/DXC/link-gs-primitiveid.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// RUN: %dxc -T lib_6_3 %s -Fo %t.dxl
// RUN: %dxl %t.dxl -T gs_6_3 -E GS | FileCheck %s

// Make sure link succeeds and produces correct system value for SV_PrimitiveID
// i8 10 = DXIL::SemanticKind::PrimitiveID
// CHECK: !{i32 1, !"SV_PrimitiveID", i8 5, i8 10, !{{[0-9]+}}, i8 0, i32 1, i8 1, i32 -1, i8 -1, null}

struct GSINOUT {
uint id : ID;
};

[maxvertexcount(3)]
[shader("geometry")]
void GS(point GSINOUT input[1],
uint j : SV_PrimitiveID,
inout PointStream<GSINOUT> outStream) {
GSINOUT output = input[0];
output.id += j;
outStream.Append(output);
}