|
32 | 32 | using namespace llvm; |
33 | 33 | using namespace llvm::dxil; |
34 | 34 |
|
| 35 | +static bool hasUAVsAtEveryStage(DXILResourceMap &DRM, const ModuleMetadataInfo &MMDI) { |
| 36 | + if (DRM.uavs().empty()) |
| 37 | + return false; |
| 38 | + |
| 39 | + switch (MMDI.ShaderProfile) { |
| 40 | + default: |
| 41 | + return false; |
| 42 | + case Triple::EnvironmentType::Compute: |
| 43 | + case Triple::EnvironmentType::Pixel: |
| 44 | + return false; |
| 45 | + case Triple::EnvironmentType::Vertex: |
| 46 | + case Triple::EnvironmentType::Geometry: |
| 47 | + case Triple::EnvironmentType::Hull: |
| 48 | + case Triple::EnvironmentType::Domain: |
| 49 | + return true; |
| 50 | + case Triple::EnvironmentType::Library: |
| 51 | + case Triple::EnvironmentType::RayGeneration: |
| 52 | + case Triple::EnvironmentType::Intersection: |
| 53 | + case Triple::EnvironmentType::AnyHit: |
| 54 | + case Triple::EnvironmentType::ClosestHit: |
| 55 | + case Triple::EnvironmentType::Miss: |
| 56 | + case Triple::EnvironmentType::Callable: |
| 57 | + case Triple::EnvironmentType::Mesh: |
| 58 | + case Triple::EnvironmentType::Amplification: |
| 59 | + return MMDI.ValidatorVersion < VersionTuple(1, 8); |
| 60 | + } |
| 61 | +} |
| 62 | + |
35 | 63 | static bool checkWaveOps(Intrinsic::ID IID) { |
36 | 64 | // Currently unsupported intrinsics |
37 | 65 | // case Intrinsic::dx_wave_getlanecount: |
@@ -266,25 +294,7 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM, |
266 | 294 | if (NumUAVs > 8) |
267 | 295 | CombinedSFMask.Max64UAVs = true; |
268 | 296 |
|
269 | | - // Set UAVsAtEveryStage flag based on the presence of UAVs, the shader |
270 | | - // model version, and the shader environment |
271 | | - if (!DRM.uavs().empty()) { |
272 | | - if (MMDI.ValidatorVersion < VersionTuple(1, 8)) |
273 | | - CombinedSFMask.UAVsAtEveryStage = |
274 | | - MMDI.ShaderProfile != Triple::EnvironmentType::Compute && |
275 | | - MMDI.ShaderProfile != Triple::EnvironmentType::Pixel; |
276 | | - else // MMDI.ValidatorVersion >= VersionTuple(1, 8) |
277 | | - switch (MMDI.ShaderProfile) { |
278 | | - default: |
279 | | - break; |
280 | | - case Triple::EnvironmentType::Vertex: |
281 | | - case Triple::EnvironmentType::Hull: |
282 | | - case Triple::EnvironmentType::Domain: |
283 | | - case Triple::EnvironmentType::Geometry: |
284 | | - CombinedSFMask.UAVsAtEveryStage = true; |
285 | | - break; |
286 | | - } |
287 | | - } |
| 297 | + CombinedSFMask.UAVsAtEveryStage = hasUAVsAtEveryStage(DRM, MMDI); |
288 | 298 | } |
289 | 299 |
|
290 | 300 | void ComputedShaderFlags::print(raw_ostream &OS) const { |
|
0 commit comments