Skip to content

Commit 0159366

Browse files
committed
update serialization of root signature to output version
1 parent 3e795b2 commit 0159366

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,6 +3041,16 @@ void TextNodeDumper::VisitHLSLBufferDecl(const HLSLBufferDecl *D) {
30413041
void TextNodeDumper::VisitHLSLRootSignatureDecl(
30423042
const HLSLRootSignatureDecl *D) {
30433043
dumpName(D);
3044+
OS << " version: ";
3045+
switch (D->getVersion()) {
3046+
case llvm::dxil::RootSignatureVersion::rootsig_1_0:
3047+
OS << "1.0";
3048+
break;
3049+
case llvm::dxil::RootSignatureVersion::rootsig_1_1:
3050+
OS << "1.1";
3051+
break;
3052+
}
3053+
OS << ", ";
30443054
llvm::hlsl::rootsig::dumpRootElements(OS, D->getRootElements());
30453055
}
30463056

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
22
// RUN: -disable-llvm-passes -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
4+
// RUN: -hlsl-rootsig-ver rootsig_1_0 \
5+
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-V1_0
6+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \
7+
// RUN: -hlsl-rootsig-ver rootsig_1_1 \
8+
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-V1_1
39

410
// This test ensures that the sample root signature is parsed without error and
511
// the Attr AST Node is created succesfully. If an invalid root signature was
@@ -16,6 +22,8 @@
1622
"DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))"
1723

1824
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[SAMPLE_RS_DECL:__hlsl_rootsig_decl_\d*]]
25+
// CHECK-V1_0: version: 1.0,
26+
// CHECK-V1_1: version: 1.1,
1927
// CHECK-SAME: RootElements{
2028
// CHECK-SAME: CBV(b1, numDescriptors = 1, space = 0,
2129
// CHECK-SAME: offset = DescriptorTableOffsetAppend, flags = DataStaticWhileSetAtExecute),

0 commit comments

Comments
 (0)