glsl: remove unused buffer objects with packed layout
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 4 May 2023 01:24:07 +0000 (11:24 +1000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Jul 2023 01:21:06 +0000 (01:21 +0000)
These are currently removed by the GLSL IR DCE pass but we will
drop that in a following patch. Also there are scenarios where these
might not be detected as unused until the NIR optimisations have
been run so we really need to do it here too anyway.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>

src/compiler/glsl/gl_nir_linker.c

index 142cc33..b5958d6 100644 (file)
@@ -1298,7 +1298,8 @@ gl_nir_link_glsl(const struct gl_constants *consts,
             .can_remove_var = can_remove_uniform,
          };
          nir_remove_dead_variables(shader->Program->nir,
-                                   nir_var_uniform | nir_var_image,
+                                   nir_var_uniform | nir_var_image |
+                                   nir_var_mem_ubo | nir_var_mem_ssbo,
                                    &opts);
       }
    }