anv: Stop forcing bindless for images
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 17 May 2019 17:08:46 +0000 (12:08 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 17 May 2019 19:58:51 +0000 (19:58 +0000)
This was an unintended artifact of my testing of bindless images.  We
should be choosing bindless or not dynamically.

Fixes: c0d9926df7d "anv: Use bindless handles for images"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_nir_apply_pipeline_layout.c

index 6be725a5cabeb9dd078e7a75274259f2cd249b7d..2777762a322c9b6a746131bc0203eef7b9f53ad8 100644 (file)
@@ -725,6 +725,10 @@ lower_image_intrinsic(nir_intrinsic_instr *intrin,
    nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
    nir_variable *var = nir_deref_instr_get_variable(deref);
 
+   unsigned set = var->data.descriptor_set;
+   unsigned binding = var->data.binding;
+   unsigned binding_offset = state->set[set].surface_offsets[binding];
+
    nir_builder *b = &state->builder;
    b->cursor = nir_before_instr(&intrin->instr);
 
@@ -742,7 +746,7 @@ lower_image_intrinsic(nir_intrinsic_instr *intrin,
                                intrin->dest.ssa.bit_size, state);
 
       nir_ssa_def_rewrite_uses(&intrin->dest.ssa, nir_src_for_ssa(desc));
-   } else if (use_bindless) {
+   } else if (binding_offset > MAX_BINDING_TABLE_SIZE) {
       const bool write_only =
          (var->data.image.access & ACCESS_NON_READABLE) != 0;
       nir_ssa_def *desc =
@@ -750,9 +754,6 @@ lower_image_intrinsic(nir_intrinsic_instr *intrin,
       nir_ssa_def *handle = nir_channel(b, desc, write_only ? 1 : 0);
       nir_rewrite_image_intrinsic(intrin, handle, true);
    } else {
-      unsigned set = var->data.descriptor_set;
-      unsigned binding = var->data.binding;
-      unsigned binding_offset = state->set[set].surface_offsets[binding];
       unsigned array_size =
          state->layout->set[set].layout->binding[binding].array_size;