nir: fix gl_nir_lower_images for bindless images
authorMarek Olšák <marek.olsak@amd.com>
Tue, 25 Feb 2020 00:10:21 +0000 (19:10 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 25 Feb 2020 02:30:08 +0000 (02:30 +0000)
Fixes: 7342b859afb5a7e7f9fb1813e7ab3a55a1c8a704
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3938>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3938>

src/compiler/glsl/gl_nir_lower_images.c

index a02e25093683641676732cd4c2f1c772b56865db..7dbefc36d0fa834f3d2102451a4493872fecb34c 100644 (file)
@@ -78,22 +78,21 @@ lower_impl(nir_builder *b, nir_instr *instr, bool bindless_only)
       return false;
    }
 
-   if (bindless_only) {
-      if (deref->mode == nir_var_uniform && !var->data.bindless)
-         return false;
-   }
+   bool bindless = deref->mode != nir_var_uniform || var->data.bindless;
+   if (bindless_only && !bindless)
+      return false;
 
    b->cursor = nir_before_instr(instr);
 
    nir_ssa_def *src;
-   if (var->data.bindless) {
+   if (bindless) {
       src = nir_load_deref(b, deref);
    } else {
       src = nir_iadd_imm(b,
                          nir_build_deref_offset(b, deref, type_size_align_1),
                          var->data.driver_location);
    }
-   nir_rewrite_image_intrinsic(intrinsic, src, var->data.bindless);
+   nir_rewrite_image_intrinsic(intrinsic, src, bindless);
 
    return true;
 }