Skip to content

Commit daa5714

Browse files
committed
update Root Signature Version flag
1 parent 1b1c37d commit daa5714

File tree

14 files changed

+43
-23
lines changed

14 files changed

+43
-23
lines changed

clang/include/clang/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ class LangOptions : public LangOptionsBase {
550550

551551
/// The HLSL root signature version for dxil.
552552
llvm::dxbc::RootSignatureVersion HLSLRootSigVer =
553-
llvm::dxbc::RootSignatureVersion::V1_1;
553+
llvm::dxbc::RootSignatureVersion::V1_2;
554554

555555
/// The HLSL root signature that will be used to overide the root signature
556556
/// used for the shader entry point.

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,7 +9456,7 @@ def target_profile : DXCJoinedOrSeparate<"T">, MetaVarName<"<profile>">,
94569456
"lib_6_3, lib_6_4, lib_6_5, lib_6_6, lib_6_7, lib_6_x,"
94579457
"ms_6_5, ms_6_6, ms_6_7,"
94589458
"as_6_5, as_6_6, as_6_7,"
9459-
"rootsig_1_0, rootsig_1_1">;
9459+
"rootsig_1_0, rootsig_1_1, rootsig_1_2">;
94609460
def emit_pristine_llvm : DXCFlag<"emit-pristine-llvm">,
94619461
HelpText<"Emit pristine LLVM IR from the frontend by not running any LLVM passes at all."
94629462
"Same as -S + -emit-llvm + -disable-llvm-passes.">;
@@ -9469,10 +9469,10 @@ def fdx_rootsignature_version :
94699469
Group<dxc_Group>,
94709470
Visibility<[ClangOption, CC1Option]>,
94719471
HelpText<"Root Signature Version">,
9472-
Values<"rootsig_1_0,rootsig_1_1">,
9472+
Values<"rootsig_1_0,rootsig_1_1,rootsig_1_2">,
94739473
NormalizedValuesScope<"llvm::dxbc::RootSignatureVersion">,
9474-
NormalizedValues<["V1_0", "V1_1"]>,
9475-
MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "V1_1">;
9474+
NormalizedValues<["V1_0", "V1_1", "V1_2"]>,
9475+
MarshallingInfoEnum<LangOpts<"HLSLRootSigVer">, "V1_2">;
94769476
def dxc_rootsig_ver :
94779477
Separate<["/", "-"], "force-rootsig-ver">,
94789478
Alias<fdx_rootsignature_version>,

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,6 +3095,9 @@ void TextNodeDumper::VisitHLSLRootSignatureDecl(
30953095
case llvm::dxbc::RootSignatureVersion::V1_1:
30963096
OS << "1.1";
30973097
break;
3098+
case llvm::dxbc::RootSignatureVersion::V1_2:
3099+
OS << "1.2";
3100+
break;
30983101
}
30993102
OS << ", ";
31003103
llvm::hlsl::rootsig::dumpRootElements(OS, D->getRootElements());

clang/lib/Driver/ToolChains/HLSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool isLegalShaderModel(Triple &T) {
6464
} break;
6565
case Triple::EnvironmentType::RootSignature:
6666
VersionTuple MinVer(1, 0);
67-
VersionTuple MaxVer(1, 1);
67+
VersionTuple MaxVer(1, 2);
6868
return MinVer <= Version && Version <= MaxVer;
6969
}
7070
return false;
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-rootsignature -ast-dump \
2+
// RUN: -fdx-rootsignature-version=rootsig_1_1 \
23
// RUN: -hlsl-entry EntryRootSig -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_1
34

45
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-rootsignature -ast-dump \
56
// RUN: -fdx-rootsignature-version=rootsig_1_0 \
67
// RUN: -hlsl-entry EntryRootSig -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_0
78

9+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-rootsignature -ast-dump \
10+
// RUN: -fdx-rootsignature-version=rootsig_1_2 \
11+
// RUN: -hlsl-entry EntryRootSig -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_2
12+
13+
814
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-rootsignature -ast-dump \
915
// RUN: -D CmdRS='"UAV(u0)"'\
1016
// RUN: -hlsl-entry CmdRS -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CMD
1117

1218
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[ENTRY_RS_DECL:__hlsl_rootsig_decl_\d*]]
1319
// CHECK-V1_0-SAME: version: 1.0,
1420
// CHECK-V1_1-SAME: version: 1.1,
21+
// CHECK-V1_2-SAME: version: 1.2,
1522
// CHECK-SAME: RootElements{
1623
// CHECK-SAME: RootCBV(b0,
1724
// CHECK-SAME: space = 0, visibility = All,
1825
// CHECK-V1_0-SAME: flags = DataVolatile
1926
// CHECK-V1_1-SAME: flags = DataStaticWhileSetAtExecute
27+
// CHECK-V1_2-SAME: flags = DataStaticWhileSetAtExecute
2028
// CHECK-SAME: )
2129
// CHECK-SAME: }
2230
#define EntryRootSig "CBV(b0)"
2331

2432
// CMD: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CMD_RS_DECL:__hlsl_rootsig_decl_\d*]]
25-
// CMD-SAME: version: 1.1,
33+
// CMD-SAME: version: 1.2,
2634
// CMD-SAME: RootElements{
2735
// CMD-SAME: RootUAV(u0, space = 0, visibility = All, flags = DataVolatile)
2836
// CMD-SAME: }

clang/test/AST/HLSL/RootSignatures-AST.hlsl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
2-
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_1
2+
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_2
33
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
44
// RUN: -fdx-rootsignature-version=rootsig_1_0 \
55
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_0
66
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
77
// RUN: -fdx-rootsignature-version=rootsig_1_1 \
88
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_1
9+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
10+
// RUN: -fdx-rootsignature-version=rootsig_1_2 \
11+
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-V1_2
912

1013
// This test ensures that the sample root signature is parsed without error and
1114
// the Attr AST Node is created succesfully. If an invalid root signature was
@@ -31,6 +34,7 @@
3134
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[SAMPLE_RS_DECL:__hlsl_rootsig_decl_\d*]]
3235
// CHECK-V1_0: version: 1.0,
3336
// CHECK-V1_1: version: 1.1,
37+
// CHECK-V1_2: version: 1.2,
3438
// CHECK-SAME: RootElements{
3539
// CHECK-SAME: RootFlags(AllowInputAssemblerInputLayout | DenyVertexShaderRootAccess),
3640
// CHECK-SAME: RootCBV(b0,
@@ -62,6 +66,7 @@
6266
// CHECK-SAME: s0, numDescriptors = 4, space = 1, offset = DescriptorTableOffsetAppend,
6367
// CHECK-V1_0-SAME: flags = DescriptorsVolatile
6468
// CHECK-V1_1-SAME: flags = None
69+
// CHECK-V1_2-SAME: flags = None
6570
// CHECK-SAME: ),
6671
// CHECK-SAME: DescriptorTable(
6772
// CHECK-SAME: numClauses = 1, visibility = All
@@ -73,6 +78,9 @@
7378
// CHECK-SAME: s1, filter = Anisotropic, addressU = Wrap, addressV = Wrap, addressW = Wrap,
7479
// CHECK-SAME: mipLODBias = 0.000000e+00, maxAnisotropy = 16, comparisonFunc = LessEqual,
7580
// CHECK-SAME: borderColor = OpaqueWhite, minLOD = 0.000000e+00, maxLOD = 3.402823e+38, space = 0, visibility = All
81+
// CHECK-V1_0-SAME: flags = None
82+
// CHECK-V1_1-SAME: flags = None
83+
// CHECK-V1_2-SAME: flags = None
7684
// CHECK-SAME: )}
7785

7886
// CHECK: -RootSignatureAttr 0x{{.*}} {{.*}} [[SAMPLE_RS_DECL]]

clang/test/AST/HLSL/rootsignature-define-ast.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
#define SampleUAV "UAV(u0)"
2222

2323
// CMD: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CMD_DECL:__hlsl_rootsig_decl_\d*]]
24-
// CMD-SAME: version: 1.1, RootElements{
24+
// CMD-SAME: version: 1.2, RootElements{
2525
// CMD-SAME: RootSRV(t0,
2626
// CMD-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute
2727
// CMD-SAME: )}
2828

2929
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CBV_DECL:__hlsl_rootsig_decl_\d*]]
30-
// CHECK-SAME: version: 1.1, RootElements{
30+
// CHECK-SAME: version: 1.2, RootElements{
3131
// CHECK-SAME: RootCBV(b0,
3232
// CHECK-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute
3333
// CHECK-SAME: )}
@@ -41,7 +41,7 @@
4141
void cbv_main() {}
4242

4343
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[UAV_DECL:__hlsl_rootsig_decl_\d*]]
44-
// CHECK-SAME: version: 1.1, RootElements{
44+
// CHECK-SAME: version: 1.2, RootElements{
4545
// CHECK-SAME: RootUAV(u0,
4646
// CHECK-SAME: space = 0, visibility = All, flags = DataVolatile
4747
// CHECK-SAME: )}

clang/test/CodeGenHLSL/RootSignature-Target.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: -hlsl-entry EntryRS -emit-llvm -o - %s | FileCheck %s
33

44
// CHECK: !dx.rootsignatures = !{![[#ENTRY:]]}
5-
// CHECK: ![[#ENTRY]] = !{null, ![[#ENTRY_RS:]], i32 2}
5+
// CHECK: ![[#ENTRY]] = !{null, ![[#ENTRY_RS:]], i32 3}
66
// CHECK: ![[#ENTRY_RS]] = !{![[#ROOT_CBV:]]}
77
// CHECK: ![[#ROOT_CBV]] = !{!"RootCBV", i32 0, i32 0, i32 0, i32 4}
88

clang/test/CodeGenHLSL/RootSignature.hlsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
// CHECK: !dx.rootsignatures = !{![[#EMPTY_ENTRY:]], ![[#DT_ENTRY:]],
44
// CHECK-SAME: ![[#RF_ENTRY:]], ![[#RC_ENTRY:]], ![[#RD_ENTRY:]], ![[#SS_ENTRY:]]}
55

6-
// CHECK: ![[#EMPTY_ENTRY]] = !{ptr @EmptyEntry, ![[#EMPTY:]], i32 2}
6+
// CHECK: ![[#EMPTY_ENTRY]] = !{ptr @EmptyEntry, ![[#EMPTY:]], i32 3}
77
// CHECK: ![[#EMPTY]] = !{}
88

99
[shader("compute"), RootSignature("")]
1010
[numthreads(1,1,1)]
1111
void EmptyEntry() {}
1212

13-
// CHECK: ![[#DT_ENTRY]] = !{ptr @DescriptorTableEntry, ![[#DT_RS:]], i32 2}
13+
// CHECK: ![[#DT_ENTRY]] = !{ptr @DescriptorTableEntry, ![[#DT_RS:]], i32 3}
1414
// CHECK: ![[#DT_RS]] = !{![[#TABLE:]]}
1515
// CHECK: ![[#TABLE]] = !{!"DescriptorTable", i32 0, ![[#CBV:]], ![[#SRV:]]}
1616
// CHECK: ![[#CBV]] = !{!"CBV", i32 1, i32 0, i32 0, i32 -1, i32 4}
@@ -25,7 +25,7 @@ void EmptyEntry() {}
2525
[numthreads(1,1,1)]
2626
void DescriptorTableEntry() {}
2727

28-
// CHECK: ![[#RF_ENTRY]] = !{ptr @RootFlagsEntry, ![[#RF_RS:]], i32 2}
28+
// CHECK: ![[#RF_ENTRY]] = !{ptr @RootFlagsEntry, ![[#RF_RS:]], i32 3}
2929
// CHECK: ![[#RF_RS]] = !{![[#ROOT_FLAGS:]]}
3030
// CHECK: ![[#ROOT_FLAGS]] = !{!"RootFlags", i32 2114}
3131

@@ -38,7 +38,7 @@ void DescriptorTableEntry() {}
3838
[numthreads(1,1,1)]
3939
void RootFlagsEntry() {}
4040

41-
// CHECK: ![[#RC_ENTRY]] = !{ptr @RootConstantsEntry, ![[#RC_RS:]], i32 2}
41+
// CHECK: ![[#RC_ENTRY]] = !{ptr @RootConstantsEntry, ![[#RC_RS:]], i32 3}
4242
// CHECK: ![[#RC_RS]] = !{![[#ROOT_CONSTANTS:]]}
4343
// CHECK: ![[#ROOT_CONSTANTS]] = !{!"RootConstants", i32 5, i32 1, i32 2, i32 1}
4444

@@ -52,7 +52,7 @@ void RootFlagsEntry() {}
5252
[numthreads(1,1,1)]
5353
void RootConstantsEntry() {}
5454

55-
// CHECK: ![[#RD_ENTRY]] = !{ptr @RootDescriptorsEntry, ![[#RD_RS:]], i32 2}
55+
// CHECK: ![[#RD_ENTRY]] = !{ptr @RootDescriptorsEntry, ![[#RD_RS:]], i32 3}
5656
// CHECK: ![[#RD_RS]] = !{![[#ROOT_CBV:]], ![[#ROOT_UAV:]], ![[#ROOT_SRV:]]}
5757
// CHECK: ![[#ROOT_CBV]] = !{!"RootCBV", i32 0, i32 0, i32 0, i32 4}
5858
// CHECK: ![[#ROOT_UAV]] = !{!"RootUAV", i32 0, i32 42, i32 3, i32 2}
@@ -66,7 +66,7 @@ void RootConstantsEntry() {}
6666
[numthreads(1,1,1)]
6767
void RootDescriptorsEntry() {}
6868

69-
// CHECK: ![[#SS_ENTRY]] = !{ptr @StaticSamplerEntry, ![[#SS_RS:]], i32 2}
69+
// CHECK: ![[#SS_ENTRY]] = !{ptr @StaticSamplerEntry, ![[#SS_RS:]], i32 3}
7070
// CHECK: ![[#SS_RS]] = !{![[#STATIC_SAMPLER:]]}
7171

7272
// checking filter = 0x4

clang/test/Driver/dxc_rootsig-define.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define NotEmptyRS "CBV(b0)"
1919

2020
// CHECK: !dx.rootsignatures = !{![[#ENTRY:]]}
21-
// CHECK: ![[#ENTRY]] = !{ptr @main, ![[#RS:]], i32 2}
21+
// CHECK: ![[#ENTRY]] = !{ptr @main, ![[#RS:]], i32 3}
2222

2323
// REG: ![[#RS]] = !{![[#CBV:]]}
2424
// REG: ![[#CBV]] = !{!"RootCBV"

0 commit comments

Comments
 (0)