Skip to content

Commit cc38687

Browse files
committed
review: use enumerations in DumpTest file
1 parent e98ee3b commit cc38687

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,20 @@ TEST(HLSLRootSignatureTest, DescriptorSRVClauseDump) {
5050
}
5151

5252
TEST(HLSLRootSignatureTest, DescriptorUAVClauseDump) {
53+
using llvm::dxbc::DescriptorRangeFlags;
5354
DescriptorTableClause Clause;
5455
Clause.Type = ClauseType::UAV;
5556
Clause.Reg = {RegisterType::UReg, 92374};
5657
Clause.NumDescriptors = 3298;
5758
Clause.Space = 932847;
5859
Clause.Offset = 1;
59-
Clause.Flags = llvm::dxbc::DescriptorRangeFlags(0x1000f);
60+
auto ValidDescriptorRangeFlags =
61+
DescriptorRangeFlags::DescriptorsVolatile |
62+
DescriptorRangeFlags::DataVolatile |
63+
DescriptorRangeFlags::DataStaticWhileSetAtExecute |
64+
DescriptorRangeFlags::DataStatic |
65+
DescriptorRangeFlags::DescriptorsStaticKeepingBufferBoundsChecks;
66+
Clause.Flags = ValidDescriptorRangeFlags;
6067

6168
std::string Out;
6269
llvm::raw_string_ostream OS(Out);
@@ -144,12 +151,17 @@ TEST(HLSLRootSignatureTest, RootSRVDump) {
144151
}
145152

146153
TEST(HLSLRootSignatureTest, RootUAVDump) {
154+
using llvm::dxbc::RootDescriptorFlags;
147155
RootDescriptor Descriptor;
148156
Descriptor.Type = DescriptorType::UAV;
149157
Descriptor.Reg = {RegisterType::UReg, 92374};
150158
Descriptor.Space = 932847;
151159
Descriptor.Visibility = llvm::dxbc::ShaderVisibility::Hull;
152-
Descriptor.Flags = llvm::dxbc::RootDescriptorFlags(0xe);
160+
auto ValidRootDescriptorFlags =
161+
RootDescriptorFlags::DataVolatile |
162+
RootDescriptorFlags::DataStaticWhileSetAtExecute |
163+
RootDescriptorFlags::DataStatic;
164+
Descriptor.Flags = ValidRootDescriptorFlags;
153165

154166
std::string Out;
155167
llvm::raw_string_ostream OS(Out);
@@ -274,11 +286,23 @@ TEST(HLSLRootSignatureTest, NoneRootFlagsDump) {
274286
}
275287

276288
TEST(HLSLRootSignatureTest, AllRootFlagsDump) {
277-
llvm::dxbc::RootFlags Flags = llvm::dxbc::RootFlags(0xfff);
289+
using llvm::dxbc::RootFlags;
290+
auto ValidRootFlags = RootFlags::AllowInputAssemblerInputLayout |
291+
RootFlags::DenyVertexShaderRootAccess |
292+
RootFlags::DenyHullShaderRootAccess |
293+
RootFlags::DenyDomainShaderRootAccess |
294+
RootFlags::DenyGeometryShaderRootAccess |
295+
RootFlags::DenyPixelShaderRootAccess |
296+
RootFlags::AllowStreamOutput |
297+
RootFlags::LocalRootSignature |
298+
RootFlags::DenyAmplificationShaderRootAccess |
299+
RootFlags::DenyMeshShaderRootAccess |
300+
RootFlags::CBVSRVUAVHeapDirectlyIndexed |
301+
RootFlags::SamplerHeapDirectlyIndexed;
278302

279303
std::string Out;
280304
llvm::raw_string_ostream OS(Out);
281-
OS << Flags;
305+
OS << ValidFlags;
282306
OS.flush();
283307

284308
std::string Expected = "RootFlags("

0 commit comments

Comments
 (0)