Skip to content

Commit a4ba17e

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2586)
2 parents 8a14135 + 2200d17 commit a4ba17e

File tree

167 files changed

+3741
-1785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+3741
-1785
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,6 +4901,13 @@ def HLSLResourceBinding: InheritableAttr {
49014901
}];
49024902
}
49034903

4904+
def HLSLSV_Position : HLSLAnnotationAttr {
4905+
let Spellings = [HLSLAnnotation<"sv_position">];
4906+
let Subjects = SubjectList<[ParmVar, Field]>;
4907+
let LangOpts = [HLSL];
4908+
let Documentation = [HLSLSV_PositionDocs];
4909+
}
4910+
49044911
def HLSLPackOffset: HLSLAnnotationAttr {
49054912
let Spellings = [HLSLAnnotation<"packoffset">];
49064913
let LangOpts = [HLSL];

clang/include/clang/Basic/AttrDocs.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8529,6 +8529,20 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo
85298529
}];
85308530
}
85318531

8532+
def HLSLSV_PositionDocs : Documentation {
8533+
let Category = DocCatFunction;
8534+
let Content = [{
8535+
The ``SV_Position`` semantic, when applied to an input parameter in a pixel
8536+
shader, contains the location of the pixel center (x, y) in screen space.
8537+
This semantic can be applied to the parameter, or a field in a struct used
8538+
as an input parameter.
8539+
This attribute is supported as an input in pixel, hull, domain and mesh shaders.
8540+
This attribute is supported as an output in vertex, geometry and domain shaders.
8541+
8542+
The full documentation is available here: https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics
8543+
}];
8544+
}
8545+
85328546
def HLSLGroupSharedAddressSpaceDocs : Documentation {
85338547
let Category = DocCatVariable;
85348548
let Content = [{

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class SemaHLSL : public SemaBase {
125125
void handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL);
126126
void handleSV_GroupThreadIDAttr(Decl *D, const ParsedAttr &AL);
127127
void handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL);
128+
void handleSV_PositionAttr(Decl *D, const ParsedAttr &AL);
128129
void handlePackOffsetAttr(Decl *D, const ParsedAttr &AL);
129130
void handleShaderAttr(Decl *D, const ParsedAttr &AL);
130131
void handleResourceBindingAttr(Decl *D, const ParsedAttr &AL);
@@ -146,6 +147,7 @@ class SemaHLSL : public SemaBase {
146147

147148
// Diagnose whether the input ID is uint/unit2/uint3 type.
148149
bool diagnoseInputIDType(QualType T, const ParsedAttr &AL);
150+
bool diagnosePositionType(QualType T, const ParsedAttr &AL);
149151

150152
bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
151153
bool ContainsBitField(QualType BaseTy);

clang/lib/Basic/Targets/SPIR.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static const unsigned SPIRDefIsPrivMap[] = {
4646
0, // ptr32_sptr
4747
0, // ptr32_uptr
4848
0, // ptr64
49-
0, // hlsl_groupshared
49+
3, // hlsl_groupshared
5050
12, // hlsl_constant
5151
10, // hlsl_private
5252
11, // hlsl_device
@@ -82,7 +82,7 @@ static const unsigned SPIRDefIsGenMap[] = {
8282
0, // ptr32_sptr
8383
0, // ptr32_uptr
8484
0, // ptr64
85-
0, // hlsl_groupshared
85+
3, // hlsl_groupshared
8686
0, // hlsl_constant
8787
10, // hlsl_private
8888
11, // hlsl_device

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,30 @@ static Value *buildVectorInput(IRBuilder<> &B, Function *F, llvm::Type *Ty) {
384384
return B.CreateCall(F, {B.getInt32(0)});
385385
}
386386

387+
static void addSPIRVBuiltinDecoration(llvm::GlobalVariable *GV,
388+
unsigned BuiltIn) {
389+
LLVMContext &Ctx = GV->getContext();
390+
IRBuilder<> B(GV->getContext());
391+
MDNode *Operands = MDNode::get(
392+
Ctx,
393+
{ConstantAsMetadata::get(B.getInt32(/* Spirv::Decoration::BuiltIn */ 11)),
394+
ConstantAsMetadata::get(B.getInt32(BuiltIn))});
395+
MDNode *Decoration = MDNode::get(Ctx, {Operands});
396+
GV->addMetadata("spirv.Decorations", *Decoration);
397+
}
398+
399+
static llvm::Value *createSPIRVBuiltinLoad(IRBuilder<> &B, llvm::Module &M,
400+
llvm::Type *Ty, const Twine &Name,
401+
unsigned BuiltInID) {
402+
auto *GV = new llvm::GlobalVariable(
403+
M, Ty, /* isConstant= */ true, llvm::GlobalValue::ExternalLinkage,
404+
/* Initializer= */ nullptr, Name, /* insertBefore= */ nullptr,
405+
llvm::GlobalVariable::GeneralDynamicTLSModel,
406+
/* AddressSpace */ 7, /* isExternallyInitialized= */ true);
407+
addSPIRVBuiltinDecoration(GV, BuiltInID);
408+
return B.CreateLoad(Ty, GV);
409+
}
410+
387411
llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
388412
const ParmVarDecl &D,
389413
llvm::Type *Ty) {
@@ -407,6 +431,12 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
407431
llvm::Function *GroupIDIntrinsic = CGM.getIntrinsic(getGroupIdIntrinsic());
408432
return buildVectorInput(B, GroupIDIntrinsic, Ty);
409433
}
434+
if (D.hasAttr<HLSLSV_PositionAttr>()) {
435+
if (getArch() == llvm::Triple::spirv)
436+
return createSPIRVBuiltinLoad(B, CGM.getModule(), Ty, "sv_position",
437+
/* BuiltIn::Position */ 0);
438+
llvm_unreachable("SV_Position semantic not implemented for this target.");
439+
}
410440
assert(false && "Unhandled parameter attribute");
411441
return nullptr;
412442
}
@@ -626,16 +656,8 @@ void CGHLSLRuntime::initializeBufferFromBinding(const HLSLBufferDecl *BufDecl,
626656

627657
void CGHLSLRuntime::handleGlobalVarDefinition(const VarDecl *VD,
628658
llvm::GlobalVariable *GV) {
629-
if (auto Attr = VD->getAttr<HLSLVkExtBuiltinInputAttr>()) {
630-
LLVMContext &Ctx = GV->getContext();
631-
IRBuilder<> B(GV->getContext());
632-
MDNode *Operands = MDNode::get(
633-
Ctx, {ConstantAsMetadata::get(
634-
B.getInt32(/* Spirv::Decoration::BuiltIn */ 11)),
635-
ConstantAsMetadata::get(B.getInt32(Attr->getBuiltIn()))});
636-
MDNode *Decoration = MDNode::get(Ctx, {Operands});
637-
GV->addMetadata("spirv.Decorations", *Decoration);
638-
}
659+
if (auto Attr = VD->getAttr<HLSLVkExtBuiltinInputAttr>())
660+
addSPIRVBuiltinDecoration(GV, Attr->getBuiltIn());
639661
}
640662

641663
llvm::Instruction *CGHLSLRuntime::getConvergenceToken(BasicBlock &BB) {

clang/lib/CodeGen/CGVTables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void resolveTopLevelMetadata(llvm::Function *Fn,
124124
auto *DIS = Fn->getSubprogram();
125125
if (!DIS)
126126
return;
127-
auto *NewDIS = DIS->replaceWithDistinct(DIS->clone());
127+
auto *NewDIS = llvm::MDNode::replaceWithDistinct(DIS->clone());
128128
VMap.MD()[DIS].reset(NewDIS);
129129

130130
// Find all llvm.dbg.declare intrinsics and resolve the DILocalVariable nodes

clang/lib/Driver/Driver.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,28 +1598,27 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
15981598
A->claim();
15991599

16001600
if (Args.hasArg(options::OPT_spirv)) {
1601+
const llvm::StringMap<llvm::Triple::SubArchType> ValidTargets = {
1602+
{"vulkan1.2", llvm::Triple::SPIRVSubArch_v15},
1603+
{"vulkan1.3", llvm::Triple::SPIRVSubArch_v16}};
16011604
llvm::Triple T(TargetTriple);
1602-
T.setArch(llvm::Triple::spirv);
1603-
T.setOS(llvm::Triple::Vulkan);
16041605

1605-
// Set specific Vulkan version if applicable.
1606+
// Set specific Vulkan version. Default to vulkan1.3.
1607+
auto TargetInfo = ValidTargets.find("vulkan1.3");
1608+
assert(TargetInfo != ValidTargets.end());
16061609
if (const Arg *A = Args.getLastArg(options::OPT_fspv_target_env_EQ)) {
1607-
const llvm::StringMap<llvm::Triple::SubArchType> ValidTargets = {
1608-
{"vulkan1.2", llvm::Triple::SPIRVSubArch_v15},
1609-
{"vulkan1.3", llvm::Triple::SPIRVSubArch_v16}};
1610-
1611-
auto TargetInfo = ValidTargets.find(A->getValue());
1612-
if (TargetInfo != ValidTargets.end()) {
1613-
T.setOSName(TargetInfo->getKey());
1614-
T.setArch(llvm::Triple::spirv, TargetInfo->getValue());
1615-
} else {
1610+
TargetInfo = ValidTargets.find(A->getValue());
1611+
if (TargetInfo == ValidTargets.end()) {
16161612
Diag(diag::err_drv_invalid_value)
16171613
<< A->getAsString(Args) << A->getValue();
16181614
}
16191615
A->claim();
16201616
}
1621-
1622-
TargetTriple = T.str();
1617+
if (TargetInfo != ValidTargets.end()) {
1618+
T.setOSName(TargetInfo->getKey());
1619+
T.setArch(llvm::Triple::spirv, TargetInfo->getValue());
1620+
TargetTriple = T.str();
1621+
}
16231622
}
16241623
} else {
16251624
Diag(diag::err_drv_dxc_missing_target_profile);

clang/lib/Parse/ParseHLSL.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs,
289289
case ParsedAttr::AT_HLSLSV_GroupID:
290290
case ParsedAttr::AT_HLSLSV_GroupIndex:
291291
case ParsedAttr::AT_HLSLSV_DispatchThreadID:
292+
case ParsedAttr::AT_HLSLSV_Position:
292293
break;
293294
default:
294295
llvm_unreachable("invalid HLSL Annotation");

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7588,6 +7588,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
75887588
case ParsedAttr::AT_HLSLWaveSize:
75897589
S.HLSL().handleWaveSizeAttr(D, AL);
75907590
break;
7591+
case ParsedAttr::AT_HLSLSV_Position:
7592+
S.HLSL().handleSV_PositionAttr(D, AL);
7593+
break;
75917594
case ParsedAttr::AT_HLSLVkExtBuiltinInput:
75927595
S.HLSL().handleVkExtBuiltinInputAttr(D, AL);
75937596
break;

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,13 @@ void SemaHLSL::CheckSemanticAnnotation(
764764
return;
765765
DiagnoseAttrStageMismatch(AnnotationAttr, ST, {llvm::Triple::Compute});
766766
break;
767+
case attr::HLSLSV_Position:
768+
// TODO(#143523): allow use on other shader types & output once the overall
769+
// semantic logic is implemented.
770+
if (ST == llvm::Triple::Pixel)
771+
return;
772+
DiagnoseAttrStageMismatch(AnnotationAttr, ST, {llvm::Triple::Pixel});
773+
break;
767774
default:
768775
llvm_unreachable("Unknown HLSLAnnotationAttr");
769776
}
@@ -1147,6 +1154,26 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) {
11471154
HLSLSV_DispatchThreadIDAttr(getASTContext(), AL));
11481155
}
11491156

1157+
bool SemaHLSL::diagnosePositionType(QualType T, const ParsedAttr &AL) {
1158+
const auto *VT = T->getAs<VectorType>();
1159+
1160+
if (!T->hasFloatingRepresentation() || (VT && VT->getNumElements() > 4)) {
1161+
Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_type)
1162+
<< AL << "float/float1/float2/float3/float4";
1163+
return false;
1164+
}
1165+
1166+
return true;
1167+
}
1168+
1169+
void SemaHLSL::handleSV_PositionAttr(Decl *D, const ParsedAttr &AL) {
1170+
auto *VD = cast<ValueDecl>(D);
1171+
if (!diagnosePositionType(VD->getType(), AL))
1172+
return;
1173+
1174+
D->addAttr(::new (getASTContext()) HLSLSV_PositionAttr(getASTContext(), AL));
1175+
}
1176+
11501177
void SemaHLSL::handleSV_GroupThreadIDAttr(Decl *D, const ParsedAttr &AL) {
11511178
auto *VD = cast<ValueDecl>(D);
11521179
if (!diagnoseInputIDType(VD->getType(), AL))

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static CXXMethodDecl *LookupSpecialMemberFromXValue(Sema &SemaRef,
105105
switch (OCS.BestViableFunction(SemaRef, LookupLoc, Best)) {
106106
case OR_Success:
107107
case OR_Deleted:
108-
return cast<CXXMethodDecl>(Best->Function);
108+
return cast<CXXMethodDecl>(Best->Function)->getCanonicalDecl();
109109
default:
110110
return nullptr;
111111
}
@@ -164,6 +164,8 @@ static bool IsDefaultMovable(Sema &SemaRef, const CXXRecordDecl *D) {
164164
if (!Dtr)
165165
return true;
166166

167+
Dtr = Dtr->getCanonicalDecl();
168+
167169
if (Dtr->isUserProvided() && (!Dtr->isDefaulted() || Dtr->isDeleted()))
168170
return false;
169171

@@ -2044,11 +2046,13 @@ static void DiagnoseNonDefaultMovable(Sema &SemaRef, SourceLocation Loc,
20442046
<< diag::TraitNotSatisfiedReason::UserProvidedAssign
20452047
<< Decl->isMoveAssignmentOperator() << Decl->getSourceRange();
20462048
}
2047-
CXXDestructorDecl *Dtr = D->getDestructor();
2048-
if (Dtr && Dtr->isUserProvided() && !Dtr->isDefaulted())
2049-
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2050-
<< diag::TraitNotSatisfiedReason::DeletedDtr << /*User Provided*/ 1
2051-
<< Dtr->getSourceRange();
2049+
if (CXXDestructorDecl *Dtr = D->getDestructor()) {
2050+
Dtr = Dtr->getCanonicalDecl();
2051+
if (Dtr->isUserProvided() && !Dtr->isDefaulted())
2052+
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2053+
<< diag::TraitNotSatisfiedReason::DeletedDtr << /*User Provided*/ 1
2054+
<< Dtr->getSourceRange();
2055+
}
20522056
}
20532057

20542058
static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef,

clang/test/CodeGenHLSL/group_shared.hlsl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// RUN: dxil-pc-shadermodel6.3-library %s \
44
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
55

6+
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
7+
// RUN: spirv-unknown-vulkan1.3-compute %s \
8+
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
9+
610
// Make sure groupshared translated into address space 3.
711
// CHECK:@a = addrspace(3) global [10 x float]
812

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -triple spirv-unknown-vulkan1.3-pixel -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s
2+
3+
// CHECK: @sv_position = external thread_local addrspace(7) externally_initialized constant <4 x float>, !spirv.Decorations !0
4+
5+
// CHECK: define void @main() {{.*}} {
6+
float4 main(float4 p : SV_Position) {
7+
// CHECK: %[[#P:]] = load <4 x float>, ptr addrspace(7) @sv_position, align 16
8+
// CHECK: %[[#R:]] = call spir_func <4 x float> @_Z4mainDv4_f(<4 x float> %[[#P]])
9+
return p;
10+
}

clang/test/Driver/dxc_spirv.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %clang_dxc -T cs_6_0 -spirv -fspv-target-env=vulkan1.3 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-VULKAN13
44
// RUN: not %clang_dxc -T cs_6_0 -spirv -fspv-target-env=vulkan1.0 -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
55

6-
// CHECK: "-triple" "spirv-unknown-vulkan-compute"
6+
// CHECK: "-triple" "spirv1.6-unknown-vulkan1.3-compute"
77
// CHECK-SAME: "-x" "hlsl"
88

99
// CHECK-VULKAN12: "-triple" "spirv1.5-unknown-vulkan1.2-compute"

clang/test/SemaCXX/cxx2c-trivially-relocatable.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,24 @@ void do_test__builtin_trivially_relocate() {
388388
// expected-note@-1 {{'test__builtin_trivially_relocate<S *, S *, int>' requested here}}
389389
// expected-error@#reloc1 {{first argument to '__builtin_trivially_relocate' must be relocatable}}
390390
}
391+
392+
393+
namespace GH143599 {
394+
struct A { ~A (); };
395+
A::~A () = default;
396+
397+
static_assert (!__builtin_is_cpp_trivially_relocatable(A));
398+
static_assert (!__builtin_is_replaceable(A));
399+
400+
struct B { B(const B&); };
401+
B::B (const B&) = default;
402+
403+
static_assert (!__builtin_is_cpp_trivially_relocatable(B));
404+
static_assert (!__builtin_is_replaceable(B));
405+
406+
struct C { C& operator=(const C&); };
407+
C& C::operator=(const C&) = default;
408+
409+
static_assert (!__builtin_is_cpp_trivially_relocatable(C));
410+
static_assert (!__builtin_is_replaceable(C));
411+
}

clang/test/SemaCXX/type-traits-unsatisfied-diags.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,29 @@ static_assert(__builtin_is_cpp_trivially_relocatable(UnionOfPolymorphic));
320320

321321
}
322322

323+
struct GH143599 { // expected-note 2 {{'GH143599' defined here}}
324+
~GH143599 ();
325+
GH143599(const GH143599&);
326+
GH143599& operator=(const GH143599&);
327+
};
328+
GH143599::~GH143599 () = default;
329+
GH143599::GH143599 (const GH143599&) = default;
330+
GH143599& GH143599::operator=(const GH143599&) = default;
331+
332+
static_assert (__builtin_is_cpp_trivially_relocatable(GH143599));
333+
// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143599)'}} \
334+
// expected-note@-1 {{'GH143599' is not trivially relocatable}} \
335+
// expected-note@-1 {{because it has a user provided copy constructor}} \
336+
// expected-note@-1 {{because it has a user provided copy assignment operator}} \
337+
// expected-note@-1 {{because it has a user-provided destructor}}
338+
339+
static_assert (__builtin_is_replaceable(GH143599));
340+
// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_replaceable(GH143599)'}} \
341+
// expected-note@-1 {{'GH143599' is not replaceable}} \
342+
// expected-note@-1 {{because it has a user provided copy constructor}} \
343+
// expected-note@-1 {{because it has a user provided copy assignment operator}} \
344+
// expected-note@-1 {{because it has a user-provided destructor}}
345+
323346
namespace trivially_copyable {
324347
struct B {
325348
virtual ~B();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-pixel -x hlsl -finclude-default-header -o - %s -ast-dump | FileCheck %s
2+
3+
float4 main(float4 a : SV_Position) {
4+
// CHECK: FunctionDecl 0x{{[0-9a-fA-F]+}} <{{.*}}> line:[[@LINE-1]]:8 main 'float4 (float4)'
5+
// CHECK-NEXT: ParmVarDecl 0x{{[0-9a-fA-F]+}} <{{.*}}> col:20 a 'float4':'vector<float, 4>'
6+
// CHECK-NEXT: HLSLSV_PositionAttr 0x{{[0-9a-fA-F]+}} <{{.*}}>
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -finclude-default-header -o - %s -verify -verify-ignore-unexpected
2+
// RUN: %clang_cc1 -triple spirv-unknown-vulkan1.3-library -x hlsl -finclude-default-header -o - %s -verify -verify-ignore-unexpected
3+
4+
// expected-error@+1 {{attribute 'SV_Position' only applies to a field or parameter of type 'float/float1/float2/float3/float4'}}
5+
void main(vector<float, 5> a : SV_Position) {
6+
}
7+
8+
// expected-error@+1 {{attribute 'SV_Position' only applies to a field or parameter of type 'float/float1/float2/float3/float4'}}
9+
void main(int2 a : SV_Position) {
10+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-vertex -x hlsl -finclude-default-header -o - %s -verify
2+
3+
// expected-error@+1 {{attribute 'SV_Position' is unsupported in 'vertex' shaders, requires pixel}}
4+
float4 main(float4 a : SV_Position) {
5+
return a;
6+
}

0 commit comments

Comments
 (0)