@@ -129,66 +129,26 @@ static raw_ostream &operator<<(raw_ostream &OS,
129
129
return OS;
130
130
}
131
131
132
+ static const EnumEntry<RootFlags> RootFlagNames[] = {
133
+ {" AllowInputAssemblerInputLayout" ,
134
+ RootFlags::AllowInputAssemblerInputLayout},
135
+ {" DenyVertexShaderRootAccess" , RootFlags::DenyVertexShaderRootAccess},
136
+ {" DenyHullShaderRootAccess" , RootFlags::DenyHullShaderRootAccess},
137
+ {" DenyDomainShaderRootAccess" , RootFlags::DenyDomainShaderRootAccess},
138
+ {" DenyGeometryShaderRootAccess" , RootFlags::DenyGeometryShaderRootAccess},
139
+ {" DenyPixelShaderRootAccess" , RootFlags::DenyPixelShaderRootAccess},
140
+ {" AllowStreamOutput" , RootFlags::AllowStreamOutput},
141
+ {" LocalRootSignature" , RootFlags::LocalRootSignature},
142
+ {" DenyAmplificationShaderRootAccess" ,
143
+ RootFlags::DenyAmplificationShaderRootAccess},
144
+ {" DenyMeshShaderRootAccess" , RootFlags::DenyMeshShaderRootAccess},
145
+ {" CBVSRVUAVHeapDirectlyIndexed" , RootFlags::CBVSRVUAVHeapDirectlyIndexed},
146
+ {" SamplerHeapDirectlyIndexed" , RootFlags::SamplerHeapDirectlyIndexed},
147
+ };
148
+
132
149
raw_ostream &operator <<(raw_ostream &OS, const RootFlags &Flags) {
133
150
OS << " RootFlags(" ;
134
- bool FlagSet = false ;
135
- unsigned Remaining = llvm::to_underlying (Flags);
136
- while (Remaining) {
137
- unsigned Bit = 1u << llvm::countr_zero (Remaining);
138
- if (Remaining & Bit) {
139
- if (FlagSet)
140
- OS << " | " ;
141
-
142
- switch (static_cast <RootFlags>(Bit)) {
143
- case RootFlags::AllowInputAssemblerInputLayout:
144
- OS << " AllowInputAssemblerInputLayout" ;
145
- break ;
146
- case RootFlags::DenyVertexShaderRootAccess:
147
- OS << " DenyVertexShaderRootAccess" ;
148
- break ;
149
- case RootFlags::DenyHullShaderRootAccess:
150
- OS << " DenyHullShaderRootAccess" ;
151
- break ;
152
- case RootFlags::DenyDomainShaderRootAccess:
153
- OS << " DenyDomainShaderRootAccess" ;
154
- break ;
155
- case RootFlags::DenyGeometryShaderRootAccess:
156
- OS << " DenyGeometryShaderRootAccess" ;
157
- break ;
158
- case RootFlags::DenyPixelShaderRootAccess:
159
- OS << " DenyPixelShaderRootAccess" ;
160
- break ;
161
- case RootFlags::AllowStreamOutput:
162
- OS << " AllowStreamOutput" ;
163
- break ;
164
- case RootFlags::LocalRootSignature:
165
- OS << " LocalRootSignature" ;
166
- break ;
167
- case RootFlags::DenyAmplificationShaderRootAccess:
168
- OS << " DenyAmplificationShaderRootAccess" ;
169
- break ;
170
- case RootFlags::DenyMeshShaderRootAccess:
171
- OS << " DenyMeshShaderRootAccess" ;
172
- break ;
173
- case RootFlags::CBVSRVUAVHeapDirectlyIndexed:
174
- OS << " CBVSRVUAVHeapDirectlyIndexed" ;
175
- break ;
176
- case RootFlags::SamplerHeapDirectlyIndexed:
177
- OS << " SamplerHeapDirectlyIndexed" ;
178
- break ;
179
- default :
180
- OS << " invalid: " << Bit;
181
- break ;
182
- }
183
-
184
- FlagSet = true ;
185
- }
186
- Remaining &= ~Bit;
187
- }
188
-
189
- if (!FlagSet)
190
- OS << " None" ;
191
-
151
+ printFlags (OS, Flags, ArrayRef (RootFlagNames));
192
152
OS << " )" ;
193
153
194
154
return OS;
0 commit comments