Skip to content

Commit 0a470b5

Browse files
[SPIRV] Remove patch decoration from gl_TessCoord (microsoft#7187) (microsoft#7349)
This PR fixes microsoft#7187. gl_TessCoord is not a per-patch builtin and therefore the SPIRV should not be decorated with Patch. This is clear in the GLSL specification, and a SPIRV spec clarification is online here: https://gitlab.khronos.org/spirv/SPIR-V/-/issues/819
1 parent 10bff13 commit 0a470b5

File tree

4 files changed

+2
-4
lines changed

4 files changed

+2
-4
lines changed

tools/clang/lib/SPIRV/DeclResultIdMapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,8 @@ SpirvVariable *DeclResultIdMapper::createSpirvInterfaceVariable(
35223522
// Decorate with PerPrimitiveNV for per-primitive out variables.
35233523
spvBuilder.decoratePerPrimitiveNV(varInstr,
35243524
varInstr->getSourceLocation());
3525-
} else {
3525+
} else if (stageVar.getSemanticInfo().getKind() !=
3526+
hlsl::Semantic::Kind::DomainLocation) {
35263527
spvBuilder.decoratePatch(varInstr, varInstr->getSourceLocation());
35273528
}
35283529
}

tools/clang/test/CodeGenSPIRV/bezier.domain.hlsl2spv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ DS_OUTPUT BezierEvalDS( HS_CONSTANT_DATA_OUTPUT input,
9696
// CHECK-NEXT: OpDecorate %in_var_TANVCORNER Patch
9797
// CHECK-NEXT: OpDecorate %in_var_TANWEIGHTS Patch
9898
// CHECK-NEXT: OpDecorate %gl_TessCoord BuiltIn TessCoord
99-
// CHECK-NEXT: OpDecorate %gl_TessCoord Patch
10099
// CHECK-NEXT: OpDecorate %gl_Position BuiltIn Position
101100
// CHECK-NEXT: OpDecorate %in_var_BEZIERPOS Location 0
102101
// CHECK-NEXT: OpDecorate %in_var_TANGENT Location 1

tools/clang/test/CodeGenSPIRV/semantic.domain-location.ds.hlsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// CHECK-SAME: %gl_TessCoord
55

66
// CHECK: OpDecorate %gl_TessCoord BuiltIn TessCoord
7-
// CHECK: OpDecorate %gl_TessCoord Patch
87

98
// CHECK: %gl_TessCoord = OpVariable %_ptr_Input_v3float Input
109

tools/clang/test/CodeGenSPIRV/spirv.interface.ds.hlsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ struct DsOut {
8585
// CHECK: OpDecorateString %gl_PointSize UserSemantic "PSIZE"
8686
// CHECK: OpDecorate %gl_TessCoord BuiltIn TessCoord
8787
// CHECK: OpDecorateString %gl_TessCoord UserSemantic "SV_DomainLocation"
88-
// CHECK: OpDecorate %gl_TessCoord Patch
8988
// CHECK: OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter
9089
// CHECK: OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor"
9190
// CHECK: OpDecorate %gl_TessLevelOuter Patch

0 commit comments

Comments
 (0)