@@ -160,41 +160,6 @@ tripleToVisibility(llvm::Triple::EnvironmentType ET) {
160
160
}
161
161
}
162
162
163
- static void reportIfDeniedShaderStageAccess (Module &M,
164
- const dxbc::RootFlags &Flags,
165
- const dxbc::RootFlags &Mask) {
166
- if ((Flags & Mask) != Mask)
167
- return ;
168
-
169
- SmallString<128 > Message;
170
- raw_svector_ostream OS (Message);
171
- OS << " Shader has root bindings but root signature uses a DENY flag to "
172
- " disallow root binding access to the shader stage." ;
173
- M.getContext ().diagnose (DiagnosticInfoGeneric (Message));
174
- }
175
-
176
- static std::optional<dxbc::RootFlags>
177
- getEnvironmentDenyFlagMask (Triple::EnvironmentType ShaderProfile) {
178
- switch (ShaderProfile) {
179
- case Triple::Pixel:
180
- return dxbc::RootFlags::DenyPixelShaderRootAccess;
181
- case Triple::Vertex:
182
- return dxbc::RootFlags::DenyVertexShaderRootAccess;
183
- case Triple::Geometry:
184
- return dxbc::RootFlags::DenyGeometryShaderRootAccess;
185
- case Triple::Hull:
186
- return dxbc::RootFlags::DenyHullShaderRootAccess;
187
- case Triple::Domain:
188
- return dxbc::RootFlags::DenyDomainShaderRootAccess;
189
- case Triple::Mesh:
190
- return dxbc::RootFlags::DenyMeshShaderRootAccess;
191
- case Triple::Amplification:
192
- return dxbc::RootFlags::DenyAmplificationShaderRootAccess;
193
- default :
194
- return std::nullopt ;
195
- }
196
- }
197
-
198
163
static void validateRootSignature (Module &M,
199
164
const mcdxbc::RootSignatureDesc &RSD,
200
165
dxil::ModuleMetadataInfo &MMI,
@@ -260,9 +225,7 @@ static void validateRootSignature(Module &M,
260
225
Builder.findOverlapping (ReportedBinding);
261
226
reportOverlappingRegisters (M, ReportedBinding, Overlaping);
262
227
});
263
-
264
228
const hlsl::BoundRegs &BoundRegs = Builder.takeBoundRegs ();
265
- bool HasBindings = false ;
266
229
for (const ResourceInfo &RI : DRM) {
267
230
const ResourceInfo::ResourceBinding &Binding = RI.getBinding ();
268
231
const dxil::ResourceTypeInfo &RTI = DRTM[RI.getHandleTy ()];
@@ -273,33 +236,22 @@ static void validateRootSignature(Module &M,
273
236
BoundRegs.findBoundReg (RC, Binding.Space , Binding.LowerBound ,
274
237
Binding.LowerBound + Binding.Size - 1 );
275
238
276
- if (!Reg) {
277
- reportRegNotBound (M, RC, Binding);
278
- continue ;
279
- }
239
+ if (Reg != nullptr ) {
240
+ const auto *ParamInfo =
241
+ static_cast <const mcdxbc::RootParameterInfo *>(Reg->Cookie );
242
+
243
+ if (RC != ResourceClass::SRV && RC != ResourceClass::UAV)
244
+ continue ;
280
245
281
- const auto * ParamInfo =
282
- static_cast < const mcdxbc::RootParameterInfo *>(Reg-> Cookie ) ;
246
+ if ( ParamInfo-> Type == dxbc::RootParameterType::DescriptorTable)
247
+ continue ;
283
248
284
- bool IsSRVOrUAV = RC == ResourceClass::SRV || RC == ResourceClass::UAV;
285
- bool IsDescriptorTable =
286
- ParamInfo->Type == dxbc::RootParameterType::DescriptorTable;
287
- bool IsRawOrStructuredBuffer =
288
- RK != ResourceKind::RawBuffer && RK != ResourceKind::StructuredBuffer;
289
- if (IsSRVOrUAV && !IsDescriptorTable && IsRawOrStructuredBuffer) {
290
- reportInvalidHandleTyError (M, RC, Binding);
291
- continue ;
249
+ if (RK != ResourceKind::RawBuffer && RK != ResourceKind::StructuredBuffer)
250
+ reportInvalidHandleTyError (M, RC, Binding);
251
+ } else {
252
+ reportRegNotBound (M, RC, Binding);
292
253
}
293
-
294
- HasBindings = true ;
295
254
}
296
-
297
- if (!HasBindings)
298
- return ;
299
-
300
- if (std::optional<dxbc::RootFlags> Mask =
301
- getEnvironmentDenyFlagMask (MMI.ShaderProfile ))
302
- reportIfDeniedShaderStageAccess (M, dxbc::RootFlags (RSD.Flags ), *Mask);
303
255
}
304
256
305
257
static mcdxbc::RootSignatureDesc *
0 commit comments