Skip to content

Commit dd56693

Browse files
authored
Revert "[HLSL][RootSignature] Implement serialization of RootConstants and RootFlags" (#142005)
The commit caused build failures, [here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to a missing linked llvm library (HLSLFrontend) into `clang/unittests/Parse/CMakeLists.txt`. While it seems like the fix is straightforwardly to just add this library, I will revert now to build and verify locally it correctly fixes it. Reverts #141130
1 parent 159646c commit dd56693

File tree

3 files changed

+0
-146
lines changed

3 files changed

+0
-146
lines changed

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ enum class RootFlags : uint32_t {
4646
ValidFlags = 0x00000fff
4747
};
4848

49-
raw_ostream &operator<<(raw_ostream &OS, const RootFlags &Flags);
50-
5149
enum class RootDescriptorFlags : unsigned {
5250
None = 0,
5351
DataVolatile = 0x2,
@@ -95,8 +93,6 @@ struct RootConstants {
9593
ShaderVisibility Visibility = ShaderVisibility::All;
9694
};
9795

98-
raw_ostream &operator<<(raw_ostream &OS, const RootConstants &Constants);
99-
10096
enum class DescriptorType : uint8_t { SRV = 0, UAV, CBuffer };
10197
// Models RootDescriptor : CBV | SRV | UAV, by collecting like parameters
10298
struct RootDescriptor {

llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -132,79 +132,6 @@ static raw_ostream &operator<<(raw_ostream &OS,
132132
return OS;
133133
}
134134

135-
raw_ostream &operator<<(raw_ostream &OS, const RootFlags &Flags) {
136-
OS << "RootFlags(";
137-
bool FlagSet = false;
138-
unsigned Remaining = llvm::to_underlying(Flags);
139-
while (Remaining) {
140-
unsigned Bit = 1u << llvm::countr_zero(Remaining);
141-
if (Remaining & Bit) {
142-
if (FlagSet)
143-
OS << " | ";
144-
145-
switch (static_cast<RootFlags>(Bit)) {
146-
case RootFlags::AllowInputAssemblerInputLayout:
147-
OS << "AllowInputAssemblerInputLayout";
148-
break;
149-
case RootFlags::DenyVertexShaderRootAccess:
150-
OS << "DenyVertexShaderRootAccess";
151-
break;
152-
case RootFlags::DenyHullShaderRootAccess:
153-
OS << "DenyHullShaderRootAccess";
154-
break;
155-
case RootFlags::DenyDomainShaderRootAccess:
156-
OS << "DenyDomainShaderRootAccess";
157-
break;
158-
case RootFlags::DenyGeometryShaderRootAccess:
159-
OS << "DenyGeometryShaderRootAccess";
160-
break;
161-
case RootFlags::DenyPixelShaderRootAccess:
162-
OS << "DenyPixelShaderRootAccess";
163-
break;
164-
case RootFlags::AllowStreamOutput:
165-
OS << "AllowStreamOutput";
166-
break;
167-
case RootFlags::LocalRootSignature:
168-
OS << "LocalRootSignature";
169-
break;
170-
case RootFlags::DenyAmplificationShaderRootAccess:
171-
OS << "DenyAmplificationShaderRootAccess";
172-
break;
173-
case RootFlags::DenyMeshShaderRootAccess:
174-
OS << "DenyMeshShaderRootAccess";
175-
break;
176-
case RootFlags::CBVSRVUAVHeapDirectlyIndexed:
177-
OS << "CBVSRVUAVHeapDirectlyIndexed";
178-
break;
179-
case RootFlags::SamplerHeapDirectlyIndexed:
180-
OS << "SamplerHeapDirectlyIndexed";
181-
break;
182-
default:
183-
OS << "invalid: " << Bit;
184-
break;
185-
}
186-
187-
FlagSet = true;
188-
}
189-
Remaining &= ~Bit;
190-
}
191-
192-
if (!FlagSet)
193-
OS << "None";
194-
195-
OS << ")";
196-
197-
return OS;
198-
}
199-
200-
raw_ostream &operator<<(raw_ostream &OS, const RootConstants &Constants) {
201-
OS << "RootConstants(num32BitConstants = " << Constants.Num32BitConstants
202-
<< ", " << Constants.Reg << ", space = " << Constants.Space
203-
<< ", visibility = " << Constants.Visibility << ")";
204-
205-
return OS;
206-
}
207-
208135
raw_ostream &operator<<(raw_ostream &OS, const DescriptorTable &Table) {
209136
OS << "DescriptorTable(numClauses = " << Table.NumClauses
210137
<< ", visibility = " << Table.Visibility << ")";

llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -108,73 +108,4 @@ TEST(HLSLRootSignatureTest, DescriptorTableDump) {
108108
EXPECT_EQ(Out, Expected);
109109
}
110110

111-
TEST(HLSLRootSignatureTest, DefaultRootConstantsDump) {
112-
RootConstants Constants;
113-
Constants.Num32BitConstants = 1;
114-
Constants.Reg = {RegisterType::BReg, 3};
115-
116-
std::string Out;
117-
llvm::raw_string_ostream OS(Out);
118-
OS << Constants;
119-
OS.flush();
120-
121-
std::string Expected = "RootConstants(num32BitConstants = 1, b3, space = 0, "
122-
"visibility = All)";
123-
EXPECT_EQ(Out, Expected);
124-
}
125-
126-
TEST(HLSLRootSignatureTest, SetRootConstantsDump) {
127-
RootConstants Constants;
128-
Constants.Num32BitConstants = 983;
129-
Constants.Reg = {RegisterType::BReg, 34593};
130-
Constants.Space = 7;
131-
Constants.Visibility = ShaderVisibility::Pixel;
132-
133-
std::string Out;
134-
llvm::raw_string_ostream OS(Out);
135-
OS << Constants;
136-
OS.flush();
137-
138-
std::string Expected = "RootConstants(num32BitConstants = 983, b34593, "
139-
"space = 7, visibility = Pixel)";
140-
EXPECT_EQ(Out, Expected);
141-
}
142-
143-
TEST(HLSLRootSignatureTest, NoneRootFlagsDump) {
144-
RootFlags Flags = RootFlags::None;
145-
146-
std::string Out;
147-
llvm::raw_string_ostream OS(Out);
148-
OS << Flags;
149-
OS.flush();
150-
151-
std::string Expected = "RootFlags(None)";
152-
EXPECT_EQ(Out, Expected);
153-
}
154-
155-
TEST(HLSLRootSignatureTest, AllRootFlagsDump) {
156-
RootFlags Flags = RootFlags::ValidFlags;
157-
158-
std::string Out;
159-
llvm::raw_string_ostream OS(Out);
160-
OS << Flags;
161-
OS.flush();
162-
163-
std::string Expected = "RootFlags("
164-
"AllowInputAssemblerInputLayout | "
165-
"DenyVertexShaderRootAccess | "
166-
"DenyHullShaderRootAccess | "
167-
"DenyDomainShaderRootAccess | "
168-
"DenyGeometryShaderRootAccess | "
169-
"DenyPixelShaderRootAccess | "
170-
"AllowStreamOutput | "
171-
"LocalRootSignature | "
172-
"DenyAmplificationShaderRootAccess | "
173-
"DenyMeshShaderRootAccess | "
174-
"CBVSRVUAVHeapDirectlyIndexed | "
175-
"SamplerHeapDirectlyIndexed)";
176-
177-
EXPECT_EQ(Out, Expected);
178-
}
179-
180111
} // namespace

0 commit comments

Comments
 (0)