[llvm] Set shader analysis flags EnableRawAndStructuredBuffers and ComputeShadersPlusRawAndStructuredBuffers for RWBuffers (PR #114449)

Tex Riddell via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 11:58:58 PDT 2024


================
@@ -36,8 +39,35 @@ static void updateFlags(ComputedShaderFlags &Flags, const Instruction &I) {
   }
 }
 
-ComputedShaderFlags ComputedShaderFlags::computeFlags(Module &M) {
+static void updateResourceFlags(ComputedShaderFlags &Flags, Module &M,
+                                ModuleAnalysisManager *AM) {
+  if (!AM)
+    return;
+
+  const DXILResourceMap &DRM = AM->getResult<DXILResourceAnalysis>(M);
+  if (DRM.empty())
+    return;
+
+  const dxil::ModuleMetadataInfo &MMDI = AM->getResult<DXILMetadataAnalysis>(M);
+  VersionTuple SM = MMDI.ShaderModelVersion;
+  Triple::EnvironmentType SP = MMDI.ShaderProfile;
+
+  // RWBuffer
+  for (const ResourceInfo &RI : DRM.uavs()) {
+    if (RI.getResourceKind() == ResourceKind::TypedBuffer) {
----------------
tex3d wrote:

This looks wrong.  It should only set this if it's a `StructuredBuffer` or `ByteAddressBuffer` (aka. raw buffer), but not if it's a `TypedBuffer`.

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


More information about the llvm-commits mailing list