nir/lower_amul: Add a variable mode check
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 20 Jul 2020 22:31:04 +0000 (17:31 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:38:58 +0000 (17:38 +0000)
This loop should only apply to UBOs and SSBOs because max_slot is never
used for normal uniforms.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

src/compiler/nir/nir_lower_amul.c

index 191f204aea0942c87a9f048f9e52362d908099cf..561cf77af33f61163559d4fc8fa3608156680500 100644 (file)
@@ -236,6 +236,9 @@ nir_lower_amul(nir_shader *shader,
    int max_slot = 0;
 
    nir_foreach_variable (var, &shader->uniforms) {
+      if (!(var->data.mode & (nir_var_mem_ubo | nir_var_mem_ssbo)))
+         continue;
+
       int base = var->data.binding;
       int size = MAX2(1, glsl_array_size(var->type));