Module: Mesa
Branch: main
Commit: 49201fe8c10dbce04929caf19b3aed0f5fdc6001
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49201fe8c10dbce04929caf19b3aed0f5fdc6001

Author: Jason Ekstrand <[email protected]>
Date:   Fri Sep  2 23:40:48 2022 -0500

hasvk: Drop bindless image support

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19852>

---

 src/intel/vulkan_hasvk/anv_descriptor_set.c        | 19 ++------
 src/intel/vulkan_hasvk/anv_device.c                | 56 ++++++++-------------
 .../vulkan_hasvk/anv_nir_apply_pipeline_layout.c   | 57 ++++++++--------------
 src/intel/vulkan_hasvk/anv_private.h               |  2 -
 4 files changed, 45 insertions(+), 89 deletions(-)

diff --git a/src/intel/vulkan_hasvk/anv_descriptor_set.c 
b/src/intel/vulkan_hasvk/anv_descriptor_set.c
index b05ab03336d..9e0df3c933d 100644
--- a/src/intel/vulkan_hasvk/anv_descriptor_set.c
+++ b/src/intel/vulkan_hasvk/anv_descriptor_set.c
@@ -52,15 +52,13 @@ anv_descriptor_data_for_type(const struct 
anv_physical_device *device,
    case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
       data = ANV_DESCRIPTOR_SURFACE_STATE |
              ANV_DESCRIPTOR_SAMPLER_STATE;
-      if (device->has_bindless_images || device->has_bindless_samplers)
+      if (device->has_bindless_samplers)
          data |= ANV_DESCRIPTOR_SAMPLED_IMAGE;
       break;
 
    case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
    case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
       data = ANV_DESCRIPTOR_SURFACE_STATE;
-      if (device->has_bindless_images)
-         data |= ANV_DESCRIPTOR_SAMPLED_IMAGE;
       break;
 
    case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
@@ -70,10 +68,7 @@ anv_descriptor_data_for_type(const struct 
anv_physical_device *device,
    case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
    case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
       data = ANV_DESCRIPTOR_SURFACE_STATE;
-      if (device->info.ver < 9)
-         data |= ANV_DESCRIPTOR_IMAGE_PARAM;
-      if (device->has_bindless_images)
-         data |= ANV_DESCRIPTOR_STORAGE_IMAGE;
+      data |= ANV_DESCRIPTOR_IMAGE_PARAM;
       break;
 
    case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
@@ -252,14 +247,8 @@ anv_descriptor_data_supports_bindless(const struct 
anv_physical_device *pdevice,
    }
 
    if (data & ANV_DESCRIPTOR_SAMPLED_IMAGE) {
-      assert(pdevice->has_bindless_images || pdevice->has_bindless_samplers);
-      return sampler ? pdevice->has_bindless_samplers :
-                       pdevice->has_bindless_images;
-   }
-
-   if (data & ANV_DESCRIPTOR_STORAGE_IMAGE) {
-      assert(pdevice->has_bindless_images);
-      return true;
+      assert(pdevice->has_bindless_samplers);
+      return sampler && pdevice->has_bindless_samplers;
    }
 
    return false;
diff --git a/src/intel/vulkan_hasvk/anv_device.c 
b/src/intel/vulkan_hasvk/anv_device.c
index 3e24468c712..401ffa7e242 100644
--- a/src/intel/vulkan_hasvk/anv_device.c
+++ b/src/intel/vulkan_hasvk/anv_device.c
@@ -268,8 +268,6 @@ get_device_extensions(const struct anv_physical_device 
*device,
       .EXT_depth_clamp_zero_one              = true,
       .EXT_depth_clip_control                = true,
       .EXT_depth_clip_enable                 = true,
-      .EXT_descriptor_indexing               = device->has_a64_buffer_access &&
-                                               device->has_bindless_images,
 #ifdef VK_USE_PLATFORM_DISPLAY_KHR
       .EXT_display_control                   = true,
 #endif
@@ -494,8 +492,6 @@ anv_physical_device_init_uuids(struct anv_physical_device 
*device)
                      sizeof(device->always_use_bindless));
    _mesa_sha1_update(&sha1_ctx, &device->has_a64_buffer_access,
                      sizeof(device->has_a64_buffer_access));
-   _mesa_sha1_update(&sha1_ctx, &device->has_bindless_images,
-                     sizeof(device->has_bindless_images));
    _mesa_sha1_update(&sha1_ctx, &device->has_bindless_samplers,
                      sizeof(device->has_bindless_samplers));
    _mesa_sha1_final(&sha1_ctx, sha1);
@@ -857,10 +853,6 @@ anv_physical_device_try_create(struct vk_instance 
*vk_instance,
    device->has_a64_buffer_access = device->info.ver >= 8 &&
                                    device->use_softpin;
 
-   /* We first get bindless image access on Skylake.
-    */
-   device->has_bindless_images = device->info.ver >= 9;
-
    /* We've had bindless samplers since Ivy Bridge (forever in Vulkan terms)
     * because it's just a matter of setting the sampler address in the sample
     * message header.  However, we've not bothered to wire it up for vec4 so
@@ -1194,29 +1186,27 @@ anv_get_physical_device_features_1_2(struct 
anv_physical_device *pdevice,
    f->shaderFloat16                       = pdevice->info.ver >= 8;
    f->shaderInt8                          = pdevice->info.ver >= 8;
 
-   bool descIndexing = pdevice->has_a64_buffer_access &&
-                       pdevice->has_bindless_images;
-   f->descriptorIndexing                                 = descIndexing;
+   f->descriptorIndexing                                 = false;
    f->shaderInputAttachmentArrayDynamicIndexing          = false;
-   f->shaderUniformTexelBufferArrayDynamicIndexing       = descIndexing;
-   f->shaderStorageTexelBufferArrayDynamicIndexing       = descIndexing;
+   f->shaderUniformTexelBufferArrayDynamicIndexing       = false;
+   f->shaderStorageTexelBufferArrayDynamicIndexing       = false;
    f->shaderUniformBufferArrayNonUniformIndexing         = false;
-   f->shaderSampledImageArrayNonUniformIndexing          = descIndexing;
-   f->shaderStorageBufferArrayNonUniformIndexing         = descIndexing;
-   f->shaderStorageImageArrayNonUniformIndexing          = descIndexing;
+   f->shaderSampledImageArrayNonUniformIndexing          = false;
+   f->shaderStorageBufferArrayNonUniformIndexing         = false;
+   f->shaderStorageImageArrayNonUniformIndexing          = false;
    f->shaderInputAttachmentArrayNonUniformIndexing       = false;
-   f->shaderUniformTexelBufferArrayNonUniformIndexing    = descIndexing;
-   f->shaderStorageTexelBufferArrayNonUniformIndexing    = descIndexing;
-   f->descriptorBindingUniformBufferUpdateAfterBind      = descIndexing;
-   f->descriptorBindingSampledImageUpdateAfterBind       = descIndexing;
-   f->descriptorBindingStorageImageUpdateAfterBind       = descIndexing;
-   f->descriptorBindingStorageBufferUpdateAfterBind      = descIndexing;
-   f->descriptorBindingUniformTexelBufferUpdateAfterBind = descIndexing;
-   f->descriptorBindingStorageTexelBufferUpdateAfterBind = descIndexing;
-   f->descriptorBindingUpdateUnusedWhilePending          = descIndexing;
-   f->descriptorBindingPartiallyBound                    = descIndexing;
-   f->descriptorBindingVariableDescriptorCount           = descIndexing;
-   f->runtimeDescriptorArray                             = descIndexing;
+   f->shaderUniformTexelBufferArrayNonUniformIndexing    = false;
+   f->shaderStorageTexelBufferArrayNonUniformIndexing    = false;
+   f->descriptorBindingUniformBufferUpdateAfterBind      = false;
+   f->descriptorBindingSampledImageUpdateAfterBind       = false;
+   f->descriptorBindingStorageImageUpdateAfterBind       = false;
+   f->descriptorBindingStorageBufferUpdateAfterBind      = false;
+   f->descriptorBindingUniformTexelBufferUpdateAfterBind = false;
+   f->descriptorBindingStorageTexelBufferUpdateAfterBind = false;
+   f->descriptorBindingUpdateUnusedWhilePending          = false;
+   f->descriptorBindingPartiallyBound                    = false;
+   f->descriptorBindingVariableDescriptorCount           = false;
+   f->runtimeDescriptorArray                             = false;
 
    f->samplerFilterMinmax                 = pdevice->info.ver >= 9;
    f->scalarBlockLayout                   = true;
@@ -1654,20 +1644,16 @@ void anv_GetPhysicalDeviceProperties(
    const struct intel_device_info *devinfo = &pdevice->info;
 
    const uint32_t max_ssbos = pdevice->has_a64_buffer_access ? UINT16_MAX : 64;
-   const uint32_t max_textures =
-      pdevice->has_bindless_images ? UINT16_MAX : 128;
+   const uint32_t max_textures = 128;
    const uint32_t max_samplers =
       pdevice->has_bindless_samplers ? UINT16_MAX :
       (devinfo->verx10 >= 75) ? 128 : 16;
-   const uint32_t max_images =
-      pdevice->has_bindless_images ? UINT16_MAX : MAX_IMAGES;
+   const uint32_t max_images = MAX_IMAGES;
 
    /* If we can use bindless for everything, claim a high per-stage limit,
     * otherwise use the binding table size, minus the slots reserved for
     * render targets and one slot for the descriptor buffer. */
-   const uint32_t max_per_stage =
-      pdevice->has_bindless_images && pdevice->has_a64_buffer_access
-      ? UINT32_MAX : MAX_BINDING_TABLE_SIZE - MAX_RTS - 1;
+   const uint32_t max_per_stage = MAX_BINDING_TABLE_SIZE - MAX_RTS - 1;
 
    const uint32_t max_workgroup_size =
       MIN2(1024, 32 * devinfo->max_cs_workgroup_threads);
diff --git a/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c 
b/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
index 04cf15b740d..0b2695d6588 100644
--- a/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan_hasvk/anv_nir_apply_pipeline_layout.c
@@ -967,12 +967,9 @@ lower_image_intrinsic(nir_builder *b, nir_intrinsic_instr 
*intrin,
 
    b->cursor = nir_before_instr(&intrin->instr);
 
-   ASSERTED const bool use_bindless = state->pdevice->has_bindless_images;
-
    if (intrin->intrinsic == nir_intrinsic_image_deref_load_param_intel) {
       b->cursor = nir_instr_remove(&intrin->instr);
 
-      assert(!use_bindless); /* Otherwise our offsets would be wrong */
       const unsigned param = nir_intrinsic_base(intrin);
 
       nir_ssa_def *desc =
@@ -981,13 +978,6 @@ lower_image_intrinsic(nir_builder *b, nir_intrinsic_instr 
*intrin,
                                              intrin->dest.ssa.bit_size, state);
 
       nir_ssa_def_rewrite_uses(&intrin->dest.ssa, desc);
-   } else if (binding_offset > MAX_BINDING_TABLE_SIZE) {
-      const unsigned desc_comp =
-         image_binding_needs_lowered_surface(var) ? 1 : 0;
-      nir_ssa_def *desc =
-         build_load_var_deref_descriptor_mem(b, deref, 0, 2, 32, state);
-      nir_ssa_def *handle = nir_channel(b, desc, desc_comp);
-      nir_rewrite_image_intrinsic(intrin, handle, true);
    } else {
       unsigned array_size =
          state->layout->set[set].layout->binding[binding].array_size;
@@ -1472,40 +1462,33 @@ anv_nir_apply_pipeline_layout(nir_shader *shader,
          state.has_dynamic_buffers = true;
 
       if (binding->data & ANV_DESCRIPTOR_SURFACE_STATE) {
-         if (map->surface_count + array_size > MAX_BINDING_TABLE_SIZE ||
-             anv_descriptor_requires_bindless(pdevice, binding, false)) {
-            /* If this descriptor doesn't fit in the binding table or if it
-             * requires bindless for some reason, flag it as bindless.
-             */
-            assert(anv_descriptor_supports_bindless(pdevice, binding, false));
-            state.set[set].surface_offsets[b] = BINDLESS_OFFSET;
-         } else {
-            state.set[set].surface_offsets[b] = map->surface_count;
-            if (binding->dynamic_offset_index < 0) {
-               struct anv_sampler **samplers = binding->immutable_samplers;
-               for (unsigned i = 0; i < binding->array_size; i++) {
-                  uint8_t planes = samplers ? samplers[i]->n_planes : 1;
-                  for (uint8_t p = 0; p < planes; p++) {
-                     map->surface_to_descriptor[map->surface_count++] =
-                        (struct anv_pipeline_binding) {
-                           .set = set,
-                           .index = binding->descriptor_index + i,
-                           .plane = p,
-                        };
-                  }
-               }
-            } else {
-               for (unsigned i = 0; i < binding->array_size; i++) {
+         assert(map->surface_count + array_size <= MAX_BINDING_TABLE_SIZE);
+         assert(!anv_descriptor_requires_bindless(pdevice, binding, false));
+         state.set[set].surface_offsets[b] = map->surface_count;
+         if (binding->dynamic_offset_index < 0) {
+            struct anv_sampler **samplers = binding->immutable_samplers;
+            for (unsigned i = 0; i < binding->array_size; i++) {
+               uint8_t planes = samplers ? samplers[i]->n_planes : 1;
+               for (uint8_t p = 0; p < planes; p++) {
                   map->surface_to_descriptor[map->surface_count++] =
                      (struct anv_pipeline_binding) {
                         .set = set,
                         .index = binding->descriptor_index + i,
-                        .dynamic_offset_index =
-                           layout->set[set].dynamic_offset_start +
-                           binding->dynamic_offset_index + i,
+                        .plane = p,
                      };
                }
             }
+         } else {
+            for (unsigned i = 0; i < binding->array_size; i++) {
+               map->surface_to_descriptor[map->surface_count++] =
+                  (struct anv_pipeline_binding) {
+                     .set = set,
+                     .index = binding->descriptor_index + i,
+                     .dynamic_offset_index =
+                        layout->set[set].dynamic_offset_start +
+                        binding->dynamic_offset_index + i,
+                  };
+            }
          }
          assert(map->surface_count <= MAX_BINDING_TABLE_SIZE);
       }
diff --git a/src/intel/vulkan_hasvk/anv_private.h 
b/src/intel/vulkan_hasvk/anv_private.h
index 48e5df17e07..d7b043c3058 100644
--- a/src/intel/vulkan_hasvk/anv_private.h
+++ b/src/intel/vulkan_hasvk/anv_private.h
@@ -943,8 +943,6 @@ struct anv_physical_device {
 
     /** True if we can access buffers using A64 messages */
     bool                                        has_a64_buffer_access;
-    /** True if we can use bindless access for images */
-    bool                                        has_bindless_images;
     /** True if we can use bindless access for samplers */
     bool                                        has_bindless_samplers;
     /** True if we can use timeline semaphores through execbuf */

Reply via email to