[clang] [llvm] [HLSL][SPIR-V] Add support for SV_Target semantic (PR #168743)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 24 05:38:22 PST 2025
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/168743
>From 8305fe297e15890e661efe87576de797e1e603fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= <brioche at google.com>
Date: Wed, 19 Nov 2025 16:51:00 +0100
Subject: [PATCH 1/2] [HLSL][SPIR-V] Add support for SV_Target semantic
This PR adds the support for the SV_Target semantic and improved the
diagnostics when the stage is correct, but the direction is disallowed.
---
.../clang/Basic/DiagnosticSemaKinds.td | 2 +
clang/include/clang/Sema/SemaHLSL.h | 22 ++++++-
clang/lib/CodeGen/CGHLSLRuntime.cpp | 3 +
clang/lib/Sema/SemaHLSL.cpp | 63 ++++++++++++++++---
.../CodeGenHLSL/semantics/SV_Target.ps.hlsl | 19 ++++++
.../test/SemaHLSL/Semantics/position.ps.hlsl | 2 +-
.../SemaHLSL/Semantics/target.ps.input.hlsl | 7 +++
.../SemaHLSL/Semantics/target.vs.input.hlsl | 8 +++
.../SemaHLSL/Semantics/target.vs.output.hlsl | 7 +++
.../test/CodeGen/SPIRV/semantics/target.ps.ll | 33 ++++++++++
10 files changed, 154 insertions(+), 12 deletions(-)
create mode 100644 clang/test/CodeGenHLSL/semantics/SV_Target.ps.hlsl
create mode 100644 clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
create mode 100644 clang/test/SemaHLSL/Semantics/target.vs.input.hlsl
create mode 100644 clang/test/SemaHLSL/Semantics/target.vs.output.hlsl
create mode 100644 llvm/test/CodeGen/SPIRV/semantics/target.ps.ll
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 53aa86a7dabde..1e024258b7c06 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -13231,6 +13231,8 @@ def err_hlsl_semantic_indexing_not_supported
def err_hlsl_init_priority_unsupported : Error<
"initializer priorities are not supported in HLSL">;
def err_hlsl_semantic_index_overlap : Error<"semantic index overlap %0">;
+def err_hlsl_semantic_unsupported_direction_for_stage
+ : Error<"semantic %0 is unsupported as %1 for stage %2">;
def warn_hlsl_user_defined_type_missing_member: Warning<"binding type '%select{t|u|b|s|c}0' only applies to types containing %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric types}0">, InGroup<LegacyConstantRegisterBinding>;
def err_hlsl_binding_type_mismatch: Error<"binding type '%select{t|u|b|s|c}0' only applies to %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric variables in the global scope}0">;
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index 15edb7e77a22b..2ac88f7e82700 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -134,9 +134,6 @@ class SemaHLSL : public SemaBase {
void CheckEntryPoint(FunctionDecl *FD);
bool CheckResourceBinOp(BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr,
SourceLocation Loc);
- void DiagnoseAttrStageMismatch(
- const Attr *A, llvm::Triple::EnvironmentType Stage,
- std::initializer_list<llvm::Triple::EnvironmentType> AllowedStages);
QualType handleVectorBinOpConversion(ExprResult &LHS, ExprResult &RHS,
QualType LHSType, QualType RHSType,
@@ -244,6 +241,17 @@ class SemaHLSL : public SemaBase {
std::optional<uint32_t> Index;
};
+ enum IOType {
+ In = 0b01,
+ Out = 0b10,
+ InOut = 0b11,
+ };
+
+ struct SemanticStageInfo {
+ llvm::Triple::EnvironmentType Stage;
+ IOType Direction;
+ };
+
private:
void collectResourceBindingsOnVarDecl(VarDecl *D);
void collectResourceBindingsOnUserRecordDecl(const VarDecl *VD,
@@ -269,6 +277,14 @@ class SemaHLSL : public SemaBase {
void diagnoseAvailabilityViolations(TranslationUnitDecl *TU);
+ void diagnoseAttrStageMismatch(
+ const Attr *A, llvm::Triple::EnvironmentType Stage,
+ std::initializer_list<llvm::Triple::EnvironmentType> AllowedStages);
+
+ void diagnoseSemanticStageMismatch(
+ const Attr *A, llvm::Triple::EnvironmentType Stage, bool IsInput,
+ std::initializer_list<SemanticStageInfo> AllowedStages);
+
uint32_t getNextImplicitBindingOrderID() {
return ImplicitBindingNextOrderID++;
}
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index f5c07fe2e33ff..e40a2296cbe5c 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -783,6 +783,9 @@ void CGHLSLRuntime::emitSystemSemanticStore(IRBuilder<> &B, llvm::Value *Source,
}
}
+ if (SemanticName == "SV_TARGET")
+ emitUserSemanticStore(B, Source, Decl, Semantic, Index);
+
llvm_unreachable(
"Store hasn't been implemented yet for this system semantic. FIXME");
}
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index ecab3946b58c7..40ba26ab54a7d 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -873,14 +873,14 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) {
case llvm::Triple::Miss:
case llvm::Triple::Callable:
if (const auto *NT = FD->getAttr<HLSLNumThreadsAttr>()) {
- DiagnoseAttrStageMismatch(NT, ST,
+ diagnoseAttrStageMismatch(NT, ST,
{llvm::Triple::Compute,
llvm::Triple::Amplification,
llvm::Triple::Mesh});
FD->setInvalidDecl();
}
if (const auto *WS = FD->getAttr<HLSLWaveSizeAttr>()) {
- DiagnoseAttrStageMismatch(WS, ST,
+ diagnoseAttrStageMismatch(WS, ST,
{llvm::Triple::Compute,
llvm::Triple::Amplification,
llvm::Triple::Mesh});
@@ -954,7 +954,8 @@ void SemaHLSL::checkSemanticAnnotation(
SemanticName == "SV_GROUPID") {
if (ST != llvm::Triple::Compute)
- DiagnoseAttrStageMismatch(SemanticAttr, ST, {llvm::Triple::Compute});
+ diagnoseSemanticStageMismatch(SemanticAttr, ST, IsInput,
+ {{llvm::Triple::Compute, IOType::In}});
if (SemanticAttr->getSemanticIndex() != 0) {
std::string PrettyName =
@@ -969,10 +970,15 @@ void SemaHLSL::checkSemanticAnnotation(
if (SemanticName == "SV_POSITION") {
// SV_Position can be an input or output in vertex shaders,
// but only an input in pixel shaders.
- if (ST == llvm::Triple::Vertex || (ST == llvm::Triple::Pixel && IsInput))
- return;
- DiagnoseAttrStageMismatch(SemanticAttr, ST,
- {llvm::Triple::Pixel, llvm::Triple::Vertex});
+ diagnoseSemanticStageMismatch(SemanticAttr, ST, IsInput,
+ {{llvm::Triple::Vertex, IOType::InOut},
+ {llvm::Triple::Pixel, IOType::In}});
+ return;
+ }
+
+ if (SemanticName == "SV_TARGET") {
+ diagnoseSemanticStageMismatch(SemanticAttr, ST, IsInput,
+ {{llvm::Triple::Pixel, IOType::Out}});
return;
}
@@ -982,7 +988,7 @@ void SemaHLSL::checkSemanticAnnotation(
llvm_unreachable("Unknown SemanticAttr");
}
-void SemaHLSL::DiagnoseAttrStageMismatch(
+void SemaHLSL::diagnoseAttrStageMismatch(
const Attr *A, llvm::Triple::EnvironmentType Stage,
std::initializer_list<llvm::Triple::EnvironmentType> AllowedStages) {
SmallVector<StringRef, 8> StageStrings;
@@ -996,6 +1002,37 @@ void SemaHLSL::DiagnoseAttrStageMismatch(
<< (AllowedStages.size() != 1) << join(StageStrings, ", ");
}
+void SemaHLSL::diagnoseSemanticStageMismatch(
+ const Attr *A, llvm::Triple::EnvironmentType Stage, bool IsInput,
+ std::initializer_list<SemanticStageInfo> Allowed) {
+
+ for (auto &Case : Allowed) {
+ if (Case.Stage != Stage)
+ continue;
+
+ if (IsInput && Case.Direction & IOType::In)
+ return;
+ if (!IsInput && Case.Direction & IOType::Out)
+ return;
+
+ Diag(A->getLoc(), diag::err_hlsl_semantic_unsupported_direction_for_stage)
+ << A->getAttrName() << (IsInput ? "input" : "output")
+ << llvm::Triple::getEnvironmentTypeName(Case.Stage);
+ return;
+ }
+
+ SmallVector<StringRef, 8> StageStrings;
+ llvm::transform(
+ Allowed, std::back_inserter(StageStrings), [](SemanticStageInfo Case) {
+ return StringRef(
+ HLSLShaderAttr::ConvertEnvironmentTypeToStr(Case.Stage));
+ });
+
+ Diag(A->getLoc(), diag::err_hlsl_attr_unsupported_in_stage)
+ << A->getAttrName() << llvm::Triple::getEnvironmentTypeName(Stage)
+ << (Allowed.size() != 1) << join(StageStrings, ", ");
+}
+
template <CastKind Kind>
static void castVector(Sema &S, ExprResult &E, QualType &Ty, unsigned Sz) {
if (const auto *VTy = Ty->getAs<VectorType>())
@@ -1797,6 +1834,16 @@ void SemaHLSL::diagnoseSystemSemanticAttr(Decl *D, const ParsedAttr &AL,
return;
}
+ if (SemanticName == "SV_TARGET") {
+ const auto *VT = ValueType->getAs<VectorType>();
+ if (!ValueType->hasFloatingRepresentation() ||
+ (VT && VT->getNumElements() > 4))
+ Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_type)
+ << AL << "float/float1/float2/float3/float4";
+ D->addAttr(createSemanticAttr<HLSLParsedSemanticAttr>(AL, Index));
+ return;
+ }
+
Diag(AL.getLoc(), diag::err_hlsl_unknown_semantic) << AL;
}
diff --git a/clang/test/CodeGenHLSL/semantics/SV_Target.ps.hlsl b/clang/test/CodeGenHLSL/semantics/SV_Target.ps.hlsl
new file mode 100644
index 0000000000000..4dc622a1eb6bb
--- /dev/null
+++ b/clang/test/CodeGenHLSL/semantics/SV_Target.ps.hlsl
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-pixel -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-pixel -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-DXIL
+
+// CHECK-SPIRV: @SV_Target0 = external hidden thread_local addrspace(8) global <4 x float>, !spirv.Decorations ![[#MD_2:]]
+
+// CHECK: define void @main() {{.*}} {
+float4 main(float4 p : SV_Position) : SV_Target {
+ // CHECK-SPIRV: %[[#R:]] = call spir_func <4 x float> @_Z4mainDv4_f(<4 x float> %[[#]])
+ // CHECK-SPIRV: store <4 x float> %[[#R]], ptr addrspace(8) @SV_Target0, align 16
+
+ // CHECK-DXIL: %[[#TMP:]] = call <4 x float> @_Z4mainDv4_f(<4 x float> %SV_Position0)
+ // CHECK-DXIL: call void @llvm.dx.store.output.v4f32(i32 4, i32 0, i32 0, i8 0, i32 poison, <4 x float> %[[#TMP]])
+ return p;
+}
+
+// CHECK-SPIRV-DAG: ![[#MD_2]] = !{![[#MD_3:]]}
+// CHECK-SPIRV-DAG: ![[#MD_3]] = !{i32 30, i32 0}
+// | `-> Location index
+// `-> SPIR-V decoration 'Location'
diff --git a/clang/test/SemaHLSL/Semantics/position.ps.hlsl b/clang/test/SemaHLSL/Semantics/position.ps.hlsl
index 47d07887911d6..b96aa121d6aef 100644
--- a/clang/test/SemaHLSL/Semantics/position.ps.hlsl
+++ b/clang/test/SemaHLSL/Semantics/position.ps.hlsl
@@ -2,6 +2,6 @@
// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-pixel -finclude-default-header -x hlsl -verify -o - %s
float4 main(float4 a : A) : SV_Position {
-// expected-error at -1 {{attribute 'SV_Position' is unsupported in 'pixel' shaders, requires one of the following: pixel, vertex}}
+// expected-error at -1 {{semantic 'SV_Position' is unsupported as output for stage pixel}}
return a;
}
diff --git a/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl b/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
new file mode 100644
index 0000000000000..6aabff60fac39
--- /dev/null
+++ b/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-pixel -finclude-default-header -x hlsl -verify -o - %s
+// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-pixel -finclude-default-header -x hlsl -verify -o - %s
+
+float4 main(float4 a : SV_Target) : A {
+// expected-error at -1 {{semantic 'SV_Target' is unsupported as input for stage pixel}}
+ return a;
+}
diff --git a/clang/test/SemaHLSL/Semantics/target.vs.input.hlsl b/clang/test/SemaHLSL/Semantics/target.vs.input.hlsl
new file mode 100644
index 0000000000000..add24732fc05a
--- /dev/null
+++ b/clang/test/SemaHLSL/Semantics/target.vs.input.hlsl
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-vertex -finclude-default-header -x hlsl -verify -o - %s
+// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-vertex -finclude-default-header -x hlsl -verify -o - %s
+
+float4 main(float4 a : SV_Target) : A {
+// expected-error at -1 {{attribute 'SV_Target' is unsupported in 'vertex' shaders, requires pixel}}
+ return a;
+}
+
diff --git a/clang/test/SemaHLSL/Semantics/target.vs.output.hlsl b/clang/test/SemaHLSL/Semantics/target.vs.output.hlsl
new file mode 100644
index 0000000000000..0481bcdad0177
--- /dev/null
+++ b/clang/test/SemaHLSL/Semantics/target.vs.output.hlsl
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-vertex -finclude-default-header -x hlsl -verify -o - %s
+// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-vertex -finclude-default-header -x hlsl -verify -o - %s
+
+float4 main(float4 a : SV_Position) : SV_Target {
+// expected-error at -1 {{attribute 'SV_Target' is unsupported in 'vertex' shaders, requires pixel}}
+ return a;
+}
diff --git a/llvm/test/CodeGen/SPIRV/semantics/target.ps.ll b/llvm/test/CodeGen/SPIRV/semantics/target.ps.ll
new file mode 100644
index 0000000000000..249ffc078f158
--- /dev/null
+++ b/llvm/test/CodeGen/SPIRV/semantics/target.ps.ll
@@ -0,0 +1,33 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
+
+; CHECK-DAG: OpDecorate %[[#INPUT:]] BuiltIn FragCoord
+; CHECK-DAG: OpDecorate %[[#OUTPUT:]] Location 0
+
+; CHECK-DAG: %[[#float:]] = OpTypeFloat 32
+; CHECK-DAG: %[[#v4:]] = OpTypeVector %[[#float]] 4
+; CHECK-DAG: %[[#ptr_i:]] = OpTypePointer Input %[[#v4]]
+; CHECK-DAG: %[[#ptr_o:]] = OpTypePointer Output %[[#v4]]
+
+; CHECK-DAG: %[[#INPUT]] = OpVariable %[[#ptr_i]] Input
+; CHECK-DAG: %[[#OUTPUT]] = OpVariable %[[#ptr_o]] Output
+
+ at SV_Position = external hidden thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations !0
+ at SV_Target0 = external hidden thread_local addrspace(8) global <4 x float>, !spirv.Decorations !2
+
+define void @main() #1 {
+entry:
+ %0 = load <4 x float>, ptr addrspace(7) @SV_Position, align 16
+ store <4 x float> %0, ptr addrspace(8) @SV_Target0, align 16
+ ret void
+
+; CHECK: %[[#TMP:]] = OpLoad %[[#v4]] %[[#INPUT]] Aligned 16
+; CHECK: OpStore %[[#OUTPUT]] %[[#TMP]] Aligned 16
+}
+
+!0 = !{!1}
+!1 = !{i32 11, i32 15}
+!2 = !{!3}
+!3 = !{i32 30, i32 0}
+
+
>From 2ebbc2773e585708db5ebb062081e308ffba92e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= <brioche at google.com>
Date: Mon, 24 Nov 2025 13:20:36 +0100
Subject: [PATCH 2/2] pr-feedback
---
.../clang/Basic/DiagnosticSemaKinds.td | 5 +++--
clang/include/clang/Sema/SemaHLSL.h | 2 +-
clang/lib/CodeGen/CGHLSLRuntime.cpp | 4 +++-
clang/lib/Sema/SemaHLSL.cpp | 20 +++++++++++++++----
.../test/SemaHLSL/Semantics/position.ps.hlsl | 2 +-
.../SemaHLSL/Semantics/target.ps.input.hlsl | 2 +-
6 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 1e024258b7c06..48a17df95c1e6 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -13231,8 +13231,9 @@ def err_hlsl_semantic_indexing_not_supported
def err_hlsl_init_priority_unsupported : Error<
"initializer priorities are not supported in HLSL">;
def err_hlsl_semantic_index_overlap : Error<"semantic index overlap %0">;
-def err_hlsl_semantic_unsupported_direction_for_stage
- : Error<"semantic %0 is unsupported as %1 for stage %2">;
+def err_hlsl_semantic_unsupported_iotype_for_stage
+ : Error<"semantic %0 is unsupported in %2 shaders as %1, requires one of "
+ "the following: %3">;
def warn_hlsl_user_defined_type_missing_member: Warning<"binding type '%select{t|u|b|s|c}0' only applies to types containing %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric types}0">, InGroup<LegacyConstantRegisterBinding>;
def err_hlsl_binding_type_mismatch: Error<"binding type '%select{t|u|b|s|c}0' only applies to %select{SRV resources|UAV resources|constant buffer resources|sampler state|numeric variables in the global scope}0">;
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index 2ac88f7e82700..fb18817f2177b 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -249,7 +249,7 @@ class SemaHLSL : public SemaBase {
struct SemanticStageInfo {
llvm::Triple::EnvironmentType Stage;
- IOType Direction;
+ IOType AllowedIOTypesMask;
};
private:
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index e40a2296cbe5c..58a523b853647 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -783,8 +783,10 @@ void CGHLSLRuntime::emitSystemSemanticStore(IRBuilder<> &B, llvm::Value *Source,
}
}
- if (SemanticName == "SV_TARGET")
+ if (SemanticName == "SV_TARGET") {
emitUserSemanticStore(B, Source, Decl, Semantic, Index);
+ return;
+ }
llvm_unreachable(
"Store hasn't been implemented yet for this system semantic. FIXME");
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 40ba26ab54a7d..62153b8e8794a 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -1010,14 +1010,26 @@ void SemaHLSL::diagnoseSemanticStageMismatch(
if (Case.Stage != Stage)
continue;
- if (IsInput && Case.Direction & IOType::In)
+ if (IsInput && Case.AllowedIOTypesMask & IOType::In)
return;
- if (!IsInput && Case.Direction & IOType::Out)
+ if (!IsInput && Case.AllowedIOTypesMask & IOType::Out)
return;
- Diag(A->getLoc(), diag::err_hlsl_semantic_unsupported_direction_for_stage)
+ SmallVector<std::string, 8> ValidCases;
+ llvm::transform(
+ Allowed, std::back_inserter(ValidCases), [](SemanticStageInfo Case) {
+ std::string Type =
+ Case.AllowedIOTypesMask == IOType::InOut
+ ? " inout"
+ : (Case.AllowedIOTypesMask & IOType::In ? " in" : " out");
+ return std::string(
+ HLSLShaderAttr::ConvertEnvironmentTypeToStr(Case.Stage)) +
+ Type;
+ });
+ Diag(A->getLoc(), diag::err_hlsl_semantic_unsupported_iotype_for_stage)
<< A->getAttrName() << (IsInput ? "input" : "output")
- << llvm::Triple::getEnvironmentTypeName(Case.Stage);
+ << llvm::Triple::getEnvironmentTypeName(Case.Stage)
+ << join(ValidCases, ", ");
return;
}
diff --git a/clang/test/SemaHLSL/Semantics/position.ps.hlsl b/clang/test/SemaHLSL/Semantics/position.ps.hlsl
index b96aa121d6aef..af237d8d69ef0 100644
--- a/clang/test/SemaHLSL/Semantics/position.ps.hlsl
+++ b/clang/test/SemaHLSL/Semantics/position.ps.hlsl
@@ -2,6 +2,6 @@
// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-pixel -finclude-default-header -x hlsl -verify -o - %s
float4 main(float4 a : A) : SV_Position {
-// expected-error at -1 {{semantic 'SV_Position' is unsupported as output for stage pixel}}
+// expected-error at -1 {{semantic 'SV_Position' is unsupported in pixel shaders as output, requires one of the following: vertex inout, pixel in}}
return a;
}
diff --git a/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl b/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
index 6aabff60fac39..a77b46c0e9f1a 100644
--- a/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
+++ b/clang/test/SemaHLSL/Semantics/target.ps.input.hlsl
@@ -2,6 +2,6 @@
// RUN: %clang_cc1 -triple spirv-pc-vulkan1.3-pixel -finclude-default-header -x hlsl -verify -o - %s
float4 main(float4 a : SV_Target) : A {
-// expected-error at -1 {{semantic 'SV_Target' is unsupported as input for stage pixel}}
+// expected-error at -1 {{semantic 'SV_Target' is unsupported in pixel shaders as input, requires one of the following: pixel out}}
return a;
}
More information about the llvm-commits
mailing list