Skip to content

Commit 5ff9cbc

Browse files
authored
[Sema] Add and test new Subobject Attribute (#7258)
This PR adds and tests a new subobject attribute. It will be useful for checking if a given decl is a subobject decl. This functionality will be used in #7239 We need an attribute in order to determine whether to check its initializer for availability attributes or not. Fixes #7257
1 parent eb16959 commit 5ff9cbc

File tree

4 files changed

+181
-65
lines changed

4 files changed

+181
-65
lines changed

tools/clang/include/clang/Basic/Attr.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,13 @@ def HLSLRayQueryObject : InheritableAttr {
11571157
let Documentation = [Undocumented];
11581158
}
11591159

1160+
def HLSLSubObject : InheritableAttr {
1161+
let Spellings = []; // No spellings!
1162+
let Subjects = SubjectList<[CXXRecord]>;
1163+
let Documentation = [Undocumented];
1164+
let Args = [UnsignedArgument<"SubObjKindUint">, UnsignedArgument<"HitGroupType">];
1165+
}
1166+
11601167
// HLSL HitObject Attribute
11611168

11621169
def HLSLHitObject : InheritableAttr {

tools/clang/lib/AST/HlslTypes.cpp

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -684,64 +684,20 @@ bool DoesTypeDefineOverloadedOperator(clang::QualType typeWithOperator,
684684
bool GetHLSLSubobjectKind(clang::QualType type,
685685
DXIL::SubobjectKind &subobjectKind,
686686
DXIL::HitGroupType &hgType) {
687-
hgType = (DXIL::HitGroupType)(-1);
688687
type = type.getCanonicalType();
689688
if (const RecordType *RT = type->getAs<RecordType>()) {
690-
StringRef name = RT->getDecl()->getName();
691-
switch (name.size()) {
692-
case 17:
693-
return name == "StateObjectConfig"
694-
? (subobjectKind = DXIL::SubobjectKind::StateObjectConfig,
695-
true)
696-
: false;
697-
case 18:
698-
return name == "LocalRootSignature"
699-
? (subobjectKind = DXIL::SubobjectKind::LocalRootSignature,
700-
true)
701-
: false;
702-
case 19:
703-
return name == "GlobalRootSignature"
704-
? (subobjectKind = DXIL::SubobjectKind::GlobalRootSignature,
705-
true)
706-
: false;
707-
case 29:
708-
return name == "SubobjectToExportsAssociation"
709-
? (subobjectKind =
710-
DXIL::SubobjectKind::SubobjectToExportsAssociation,
711-
true)
712-
: false;
713-
case 22:
714-
return name == "RaytracingShaderConfig"
715-
? (subobjectKind = DXIL::SubobjectKind::RaytracingShaderConfig,
716-
true)
717-
: false;
718-
case 24:
719-
return name == "RaytracingPipelineConfig"
720-
? (subobjectKind =
721-
DXIL::SubobjectKind::RaytracingPipelineConfig,
722-
true)
723-
: false;
724-
case 25:
725-
return name == "RaytracingPipelineConfig1"
726-
? (subobjectKind =
727-
DXIL::SubobjectKind::RaytracingPipelineConfig1,
728-
true)
729-
: false;
730-
case 16:
731-
if (name == "TriangleHitGroup") {
732-
subobjectKind = DXIL::SubobjectKind::HitGroup;
733-
hgType = DXIL::HitGroupType::Triangle;
734-
return true;
735-
}
736-
return false;
737-
case 27:
738-
if (name == "ProceduralPrimitiveHitGroup") {
739-
subobjectKind = DXIL::SubobjectKind::HitGroup;
740-
hgType = DXIL::HitGroupType::ProceduralPrimitive;
741-
return true;
742-
}
689+
RecordDecl *RD = RT->getDecl();
690+
if (!RD->hasAttr<HLSLSubObjectAttr>()) {
743691
return false;
744692
}
693+
694+
HLSLSubObjectAttr *Attr = RD->getAttr<HLSLSubObjectAttr>();
695+
subobjectKind = static_cast<DXIL::SubobjectKind>(Attr->getSubObjKindUint());
696+
hgType = static_cast<DXIL::HitGroupType>(Attr->getHitGroupType());
697+
if (subobjectKind == DXIL::SubobjectKind::HitGroup)
698+
DXASSERT(DXIL::IsValidHitGroupType(hgType), "invalid hit group type");
699+
700+
return true;
745701
}
746702
return false;
747703
}

tools/clang/lib/Sema/SemaHLSL.cpp

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2785,13 +2785,17 @@ AddBuiltInTriangleIntersectionAttributes(ASTContext &context,
27852785
//
27862786
// Subobjects
27872787

2788-
static CXXRecordDecl *StartSubobjectDecl(ASTContext &context,
2789-
const char *name) {
2788+
static CXXRecordDecl *
2789+
StartSubobjectDecl(ASTContext &context, const char *name,
2790+
DXIL::SubobjectKind Kind,
2791+
DXIL::HitGroupType HGT = DXIL::HitGroupType::LastEntry) {
27902792
IdentifierInfo &id =
27912793
context.Idents.get(StringRef(name), tok::TokenKind::identifier);
27922794
CXXRecordDecl *decl = CXXRecordDecl::Create(
27932795
context, TagTypeKind::TTK_Struct, context.getTranslationUnitDecl(), NoLoc,
27942796
NoLoc, &id, nullptr, DelayTypeCreationTrue);
2797+
decl->addAttr(HLSLSubObjectAttr::CreateImplicit(
2798+
context, static_cast<unsigned>(Kind), static_cast<unsigned>(HGT)));
27952799
decl->addAttr(FinalAttr::CreateImplicit(context, FinalAttr::Keyword_final));
27962800
decl->startDefinition();
27972801
return decl;
@@ -2808,7 +2812,8 @@ void FinishSubobjectDecl(ASTContext &context, CXXRecordDecl *decl) {
28082812
// uint32_t Flags;
28092813
// };
28102814
static CXXRecordDecl *CreateSubobjectStateObjectConfig(ASTContext &context) {
2811-
CXXRecordDecl *decl = StartSubobjectDecl(context, "StateObjectConfig");
2815+
CXXRecordDecl *decl = StartSubobjectDecl(
2816+
context, "StateObjectConfig", DXIL::SubobjectKind::StateObjectConfig);
28122817
CreateSimpleField(context, decl, "Flags", context.UnsignedIntTy,
28132818
AccessSpecifier::AS_private);
28142819
FinishSubobjectDecl(context, decl);
@@ -2822,7 +2827,10 @@ static CXXRecordDecl *CreateSubobjectStateObjectConfig(ASTContext &context) {
28222827
static CXXRecordDecl *CreateSubobjectRootSignature(ASTContext &context,
28232828
bool global) {
28242829
CXXRecordDecl *decl = StartSubobjectDecl(
2825-
context, global ? "GlobalRootSignature" : "LocalRootSignature");
2830+
context, global ? "GlobalRootSignature" : "LocalRootSignature",
2831+
global ? DXIL::SubobjectKind::GlobalRootSignature
2832+
: DXIL::SubobjectKind::LocalRootSignature);
2833+
28262834
CreateSimpleField(context, decl, "Data", context.HLSLStringTy,
28272835
AccessSpecifier::AS_private);
28282836
FinishSubobjectDecl(context, decl);
@@ -2837,7 +2845,8 @@ static CXXRecordDecl *CreateSubobjectRootSignature(ASTContext &context,
28372845
static CXXRecordDecl *
28382846
CreateSubobjectSubobjectToExportsAssoc(ASTContext &context) {
28392847
CXXRecordDecl *decl =
2840-
StartSubobjectDecl(context, "SubobjectToExportsAssociation");
2848+
StartSubobjectDecl(context, "SubobjectToExportsAssociation",
2849+
DXIL::SubobjectKind::SubobjectToExportsAssociation);
28412850
CreateSimpleField(context, decl, "Subobject", context.HLSLStringTy,
28422851
AccessSpecifier::AS_private);
28432852
CreateSimpleField(context, decl, "Exports", context.HLSLStringTy,
@@ -2853,7 +2862,9 @@ CreateSubobjectSubobjectToExportsAssoc(ASTContext &context) {
28532862
// };
28542863
static CXXRecordDecl *
28552864
CreateSubobjectRaytracingShaderConfig(ASTContext &context) {
2856-
CXXRecordDecl *decl = StartSubobjectDecl(context, "RaytracingShaderConfig");
2865+
CXXRecordDecl *decl =
2866+
StartSubobjectDecl(context, "RaytracingShaderConfig",
2867+
DXIL::SubobjectKind::RaytracingShaderConfig);
28572868
CreateSimpleField(context, decl, "MaxPayloadSizeInBytes",
28582869
context.UnsignedIntTy, AccessSpecifier::AS_private);
28592870
CreateSimpleField(context, decl, "MaxAttributeSizeInBytes",
@@ -2868,7 +2879,9 @@ CreateSubobjectRaytracingShaderConfig(ASTContext &context) {
28682879
// };
28692880
static CXXRecordDecl *
28702881
CreateSubobjectRaytracingPipelineConfig(ASTContext &context) {
2871-
CXXRecordDecl *decl = StartSubobjectDecl(context, "RaytracingPipelineConfig");
2882+
CXXRecordDecl *decl =
2883+
StartSubobjectDecl(context, "RaytracingPipelineConfig",
2884+
DXIL::SubobjectKind::RaytracingPipelineConfig);
28722885
CreateSimpleField(context, decl, "MaxTraceRecursionDepth",
28732886
context.UnsignedIntTy, AccessSpecifier::AS_private);
28742887
FinishSubobjectDecl(context, decl);
@@ -2883,7 +2896,8 @@ CreateSubobjectRaytracingPipelineConfig(ASTContext &context) {
28832896
static CXXRecordDecl *
28842897
CreateSubobjectRaytracingPipelineConfig1(ASTContext &context) {
28852898
CXXRecordDecl *decl =
2886-
StartSubobjectDecl(context, "RaytracingPipelineConfig1");
2899+
StartSubobjectDecl(context, "RaytracingPipelineConfig1",
2900+
DXIL::SubobjectKind::RaytracingPipelineConfig1);
28872901
CreateSimpleField(context, decl, "MaxTraceRecursionDepth",
28882902
context.UnsignedIntTy, AccessSpecifier::AS_private);
28892903
CreateSimpleField(context, decl, "Flags", context.UnsignedIntTy,
@@ -2898,7 +2912,9 @@ CreateSubobjectRaytracingPipelineConfig1(ASTContext &context) {
28982912
// string ClosestHit;
28992913
// };
29002914
static CXXRecordDecl *CreateSubobjectTriangleHitGroup(ASTContext &context) {
2901-
CXXRecordDecl *decl = StartSubobjectDecl(context, "TriangleHitGroup");
2915+
CXXRecordDecl *decl = StartSubobjectDecl(context, "TriangleHitGroup",
2916+
DXIL::SubobjectKind::HitGroup,
2917+
DXIL::HitGroupType::Triangle);
29022918
CreateSimpleField(context, decl, "AnyHit", context.HLSLStringTy,
29032919
AccessSpecifier::AS_private);
29042920
CreateSimpleField(context, decl, "ClosestHit", context.HLSLStringTy,
@@ -2915,8 +2931,9 @@ static CXXRecordDecl *CreateSubobjectTriangleHitGroup(ASTContext &context) {
29152931
// };
29162932
static CXXRecordDecl *
29172933
CreateSubobjectProceduralPrimitiveHitGroup(ASTContext &context) {
2918-
CXXRecordDecl *decl =
2919-
StartSubobjectDecl(context, "ProceduralPrimitiveHitGroup");
2934+
CXXRecordDecl *decl = StartSubobjectDecl(
2935+
context, "ProceduralPrimitiveHitGroup", DXIL::SubobjectKind::HitGroup,
2936+
DXIL::HitGroupType::ProceduralPrimitive);
29202937
CreateSimpleField(context, decl, "AnyHit", context.HLSLStringTy,
29212938
AccessSpecifier::AS_private);
29222939
CreateSimpleField(context, decl, "ClosestHit", context.HLSLStringTy,
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// RUN: %dxc -T lib_6_9 -ast-dump-implicit %s | FileCheck -check-prefix=ASTIMPL %s
2+
// RUN: %dxc -T lib_6_9 -ast-dump %s | FileCheck -check-prefix=AST %s
3+
// The HLSL source is just a copy of
4+
// tools\clang\test\HLSLFileCheck\shader_targets\raytracing\subobjects_raytracingPipelineConfig1.hlsl
5+
6+
// This test tests that the HLSLSubObjectAttr attribute is present on all
7+
// HLSL subobjects, and tests the ast representation of subobjects
8+
9+
// ASTIMPL: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct StateObjectConfig definition
10+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 0 2
11+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
12+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Flags 'unsigned int'
13+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct GlobalRootSignature definition
14+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 1 2
15+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
16+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Data 'string'
17+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct LocalRootSignature definition
18+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 2 2
19+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
20+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Data 'string'
21+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct SubobjectToExportsAssociation definition
22+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 8 2
23+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
24+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Subobject 'string'
25+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Exports 'string'
26+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct RaytracingShaderConfig definition
27+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 9 2
28+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
29+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit MaxPayloadSizeInBytes 'unsigned int'
30+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit MaxAttributeSizeInBytes 'unsigned int'
31+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit struct RaytracingPipelineConfig definition
32+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 10 2
33+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
34+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit MaxTraceRecursionDepth 'unsigned int'
35+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct TriangleHitGroup definition
36+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 11 0
37+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
38+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit AnyHit 'string'
39+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit ClosestHit 'string'
40+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct ProceduralPrimitiveHitGroup definition
41+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 11 1
42+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
43+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit AnyHit 'string'
44+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit ClosestHit 'string'
45+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Intersection 'string'
46+
// ASTIMPL-NEXT: CXXRecordDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit referenced struct RaytracingPipelineConfig1 definition
47+
// ASTIMPL-NEXT: HLSLSubObjectAttr 0x{{.+}} <<invalid sloc>> Implicit 12 2
48+
// ASTIMPL-NEXT: FinalAttr 0x{{.+}} <<invalid sloc>> Implicit final
49+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit MaxTraceRecursionDepth 'unsigned int'
50+
// ASTIMPL-NEXT: FieldDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> implicit Flags 'unsigned int'
51+
52+
// AST: VarDecl 0x{{.+}} grs 'GlobalRootSignature' static cinit
53+
// AST-NEXT: InitListExpr 0x{{.+}} 'GlobalRootSignature'
54+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
55+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "CBV(b0)"
56+
// AST-NEXT: VarDecl 0x{{.+}} soc 'StateObjectConfig' static cinit
57+
// AST-NEXT: InitListExpr 0x{{.+}} 'StateObjectConfig'
58+
// AST-NEXT: BinaryOperator 0x{{.+}} 'unsigned int' '|'
59+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <LValueToRValue>
60+
// AST-NEXT: DeclRefExpr 0x{{.+}} 'const unsigned int' lvalue Var 0x{{.+}} 'STATE_OBJECT_FLAGS_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS' 'const unsigned int'
61+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <LValueToRValue>
62+
// AST-NEXT: DeclRefExpr 0x{{.+}} 'const unsigned int' lvalue Var 0x{{.+}} 'STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS' 'const unsigned int'
63+
// AST-NEXT: VarDecl 0x{{.+}} lrs 'LocalRootSignature' static cinit
64+
// AST-NEXT: InitListExpr 0x{{.+}} 'LocalRootSignature'
65+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
66+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "UAV(u0, visibility = SHADER_VISIBILITY_GEOMETRY), RootFlags(LOCAL_ROOT_SIGNATURE)"
67+
// AST-NEXT: VarDecl 0x{{.+}} sea 'SubobjectToExportsAssociation' static cinit
68+
// AST-NEXT: InitListExpr 0x{{.+}} 'SubobjectToExportsAssociation'
69+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
70+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "grs"
71+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
72+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "a;b;foo;c"
73+
// AST-NEXT: VarDecl 0x{{.+}} sea2 'SubobjectToExportsAssociation' static cinit
74+
// AST-NEXT: InitListExpr 0x{{.+}} 'SubobjectToExportsAssociation'
75+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
76+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "grs"
77+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
78+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue ";"
79+
// AST-NEXT: VarDecl 0x{{.+}} sea3 'SubobjectToExportsAssociation' static cinit
80+
// AST-NEXT: InitListExpr 0x{{.+}} 'SubobjectToExportsAssociation'
81+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
82+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "grs"
83+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
84+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue ""
85+
// AST-NEXT: VarDecl 0x{{.+}} rsc 'RaytracingShaderConfig' static cinit
86+
// AST-NEXT: InitListExpr 0x{{.+}} 'RaytracingShaderConfig'
87+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <IntegralCast>
88+
// AST-NEXT: IntegerLiteral 0x{{.+}} 'literal int' 128
89+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <IntegralCast>
90+
// AST-NEXT: IntegerLiteral 0x{{.+}} 'literal int' 64
91+
// AST-NEXT: VarDecl 0x{{.+}} rpc 'RaytracingPipelineConfig1' static cinit
92+
// AST-NEXT: InitListExpr 0x{{.+}} 'RaytracingPipelineConfig1'
93+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <IntegralCast>
94+
// AST-NEXT: IntegerLiteral 0x{{.+}} 'literal int' 32
95+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <LValueToRValue>
96+
// AST-NEXT: DeclRefExpr 0x{{.+}} 'const unsigned int' lvalue Var 0x{{.+}} 'RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES' 'const unsigned int'
97+
// AST-NEXT: VarDecl 0x{{.+}} sea4 'SubobjectToExportsAssociation' static cinit
98+
// AST-NEXT: InitListExpr 0x{{.+}} 'SubobjectToExportsAssociation'
99+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
100+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "rpc"
101+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
102+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue ";"
103+
// AST-NEXT: VarDecl 0x{{.+}} rpc2 'RaytracingPipelineConfig1' static cinit
104+
// AST-NEXT: InitListExpr 0x{{.+}} 'RaytracingPipelineConfig1'
105+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <IntegralCast>
106+
// AST-NEXT: IntegerLiteral 0x{{.+}} 'literal int' 32
107+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'unsigned int' <LValueToRValue>
108+
// AST-NEXT: DeclRefExpr 0x{{.+}} 'const unsigned int' lvalue Var 0x{{.+}} 'RAYTRACING_PIPELINE_FLAG_NONE' 'const unsigned int'
109+
// AST-NEXT: VarDecl 0x{{.+}} trHitGt 'TriangleHitGroup' static cinit
110+
// AST-NEXT: InitListExpr 0x{{.+}} 'TriangleHitGroup'
111+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
112+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "a"
113+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
114+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "b"
115+
// AST-NEXT: VarDecl 0x{{.+}} ppHitGt 'ProceduralPrimitiveHitGroup' static cinit
116+
// AST-NEXT: InitListExpr 0x{{.+}} 'ProceduralPrimitiveHitGroup'
117+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
118+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "a"
119+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
120+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "b"
121+
// AST-NEXT: ImplicitCastExpr 0x{{.+}} 'const string' <ArrayToPointerDecay>
122+
// AST-NEXT: StringLiteral 0x{{.+}} 'literal string' lvalue "c"
123+
124+
GlobalRootSignature grs = {"CBV(b0)"};
125+
StateObjectConfig soc = { STATE_OBJECT_FLAGS_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITONS | STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS };
126+
LocalRootSignature lrs = {"UAV(u0, visibility = SHADER_VISIBILITY_GEOMETRY), RootFlags(LOCAL_ROOT_SIGNATURE)"};
127+
SubobjectToExportsAssociation sea = { "grs", "a;b;foo;c" };
128+
// Empty association is well-defined: it creates a default association
129+
SubobjectToExportsAssociation sea2 = { "grs", ";" };
130+
SubobjectToExportsAssociation sea3 = { "grs", "" };
131+
RaytracingShaderConfig rsc = { 128, 64 };
132+
RaytracingPipelineConfig1 rpc = { 32, RAYTRACING_PIPELINE_FLAG_SKIP_TRIANGLES };
133+
SubobjectToExportsAssociation sea4 = {"rpc", ";"};
134+
RaytracingPipelineConfig1 rpc2 = {32, RAYTRACING_PIPELINE_FLAG_NONE };
135+
TriangleHitGroup trHitGt = {"a", "b"};
136+
ProceduralPrimitiveHitGroup ppHitGt = { "a", "b", "c"};

0 commit comments

Comments
 (0)