[llvm] [DirectX] Implement Shader Flag Analysis for `UAVsAtEveryStage` (PR #137085)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 10:23:19 PDT 2025


================
@@ -32,6 +32,35 @@
 using namespace llvm;
 using namespace llvm::dxil;
 
+static bool hasUAVsAtEveryStage(DXILResourceMap &DRM,
+                                const ModuleMetadataInfo &MMDI) {
+  if (DRM.uavs().empty())
+    return false;
+
+  switch (MMDI.ShaderProfile) {
+  default:
+    return false;
+  case Triple::EnvironmentType::Compute:
+  case Triple::EnvironmentType::Pixel:
+    return false;
+  case Triple::EnvironmentType::Vertex:
+  case Triple::EnvironmentType::Geometry:
+  case Triple::EnvironmentType::Hull:
+  case Triple::EnvironmentType::Domain:
+    return true;
----------------
Icohedron wrote:

I think the real potential issue is if in the future we get new shader types, the UAVsAtEveryStage flag will not get assigned to the new shader type when the DXIL version is < 1.8

https://github.com/llvm/llvm-project/pull/137085


More information about the llvm-commits mailing list