From fde5c903c072d79304e6d47339398537ad0a6b25 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 30 Aug 2022 19:55:53 -0700 Subject: [PATCH] anv: Delete has_bindless_images and has_bindless_samples flags These are always true now. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_descriptor_set.c | 38 +++++----------- src/intel/vulkan/anv_device.c | 63 ++++++++++----------------- src/intel/vulkan/anv_private.h | 4 -- src/intel/vulkan/genX_state.c | 18 ++++---- 4 files changed, 43 insertions(+), 80 deletions(-) diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index c147b725163..0b4e9ffe914 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -44,23 +44,20 @@ anv_descriptor_data_for_type(const struct anv_physical_device *device, switch (type) { case VK_DESCRIPTOR_TYPE_SAMPLER: - data = ANV_DESCRIPTOR_SAMPLER_STATE; - if (device->has_bindless_samplers) - data |= ANV_DESCRIPTOR_SAMPLED_IMAGE; + data = ANV_DESCRIPTOR_SAMPLER_STATE | + ANV_DESCRIPTOR_SAMPLED_IMAGE; break; 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) - data |= ANV_DESCRIPTOR_SAMPLED_IMAGE; + ANV_DESCRIPTOR_SAMPLER_STATE | + 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; + data = ANV_DESCRIPTOR_SURFACE_STATE | + ANV_DESCRIPTOR_SAMPLED_IMAGE; break; case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: @@ -69,9 +66,8 @@ 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->has_bindless_images) - data |= ANV_DESCRIPTOR_STORAGE_IMAGE; + data = ANV_DESCRIPTOR_SURFACE_STATE | + ANV_DESCRIPTOR_STORAGE_IMAGE; break; case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: @@ -235,21 +231,9 @@ anv_descriptor_data_supports_bindless(const struct anv_physical_device *pdevice, enum anv_descriptor_data data, bool sampler) { - if (data & ANV_DESCRIPTOR_ADDRESS_RANGE) - return true; - - 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; - } - - return false; + return data & (ANV_DESCRIPTOR_ADDRESS_RANGE | + ANV_DESCRIPTOR_SAMPLED_IMAGE | + ANV_DESCRIPTOR_STORAGE_IMAGE); } bool diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index bca39fccebb..64a34eb40ad 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -263,7 +263,7 @@ get_device_extensions(const struct anv_physical_device *device, .EXT_custom_border_color = true, .EXT_depth_clip_control = true, .EXT_depth_clip_enable = true, - .EXT_descriptor_indexing = device->has_bindless_images, + .EXT_descriptor_indexing = true, #ifdef VK_USE_PLATFORM_DISPLAY_KHR .EXT_display_control = true, #endif @@ -563,10 +563,6 @@ anv_physical_device_init_uuids(struct anv_physical_device *device) sizeof(device->info.pci_device_id)); _mesa_sha1_update(&sha1_ctx, &device->always_use_bindless, sizeof(device->always_use_bindless)); - _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); memcpy(device->pipeline_cache_uuid, sha1, VK_UUID_SIZE); @@ -900,9 +896,6 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, device->use_call_secondary = !env_var_as_boolean("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false); - device->has_bindless_images = true; - device->has_bindless_samplers = true; - device->has_implicit_ccs = device->info.has_aux_map || device->info.verx10 >= 125; @@ -1237,28 +1230,27 @@ anv_get_physical_device_features_1_2(struct anv_physical_device *pdevice, f->shaderFloat16 = true; f->shaderInt8 = true; - bool descIndexing = pdevice->has_bindless_images; - f->descriptorIndexing = descIndexing; + f->descriptorIndexing = true; f->shaderInputAttachmentArrayDynamicIndexing = false; - f->shaderUniformTexelBufferArrayDynamicIndexing = descIndexing; - f->shaderStorageTexelBufferArrayDynamicIndexing = descIndexing; + f->shaderUniformTexelBufferArrayDynamicIndexing = true; + f->shaderStorageTexelBufferArrayDynamicIndexing = true; f->shaderUniformBufferArrayNonUniformIndexing = false; - f->shaderSampledImageArrayNonUniformIndexing = descIndexing; - f->shaderStorageBufferArrayNonUniformIndexing = descIndexing; - f->shaderStorageImageArrayNonUniformIndexing = descIndexing; + f->shaderSampledImageArrayNonUniformIndexing = true; + f->shaderStorageBufferArrayNonUniformIndexing = true; + f->shaderStorageImageArrayNonUniformIndexing = true; 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 = true; + f->shaderStorageTexelBufferArrayNonUniformIndexing = true; + f->descriptorBindingUniformBufferUpdateAfterBind = true; + f->descriptorBindingSampledImageUpdateAfterBind = true; + f->descriptorBindingStorageImageUpdateAfterBind = true; + f->descriptorBindingStorageBufferUpdateAfterBind = true; + f->descriptorBindingUniformTexelBufferUpdateAfterBind = true; + f->descriptorBindingStorageTexelBufferUpdateAfterBind = true; + f->descriptorBindingUpdateUnusedWhilePending = true; + f->descriptorBindingPartiallyBound = true; + f->descriptorBindingVariableDescriptorCount = true; + f->runtimeDescriptorArray = true; f->samplerFilterMinmax = true; f->scalarBlockLayout = true; @@ -1713,19 +1705,12 @@ void anv_GetPhysicalDeviceProperties( const struct intel_device_info *devinfo = &pdevice->info; const uint32_t max_ssbos = UINT16_MAX; - const uint32_t max_textures = - pdevice->has_bindless_images ? UINT16_MAX : 128; - const uint32_t max_samplers = - pdevice->has_bindless_samplers ? UINT16_MAX : 128; - const uint32_t max_images = - pdevice->has_bindless_images ? UINT16_MAX : MAX_IMAGES; + const uint32_t max_textures = UINT16_MAX; + const uint32_t max_samplers = UINT16_MAX; + const uint32_t max_images = UINT16_MAX; - /* 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 - ? UINT32_MAX : MAX_BINDING_TABLE_SIZE - MAX_RTS - 1; + /* Claim a high per-stage limit since we have bindless. */ + const uint32_t max_per_stage = UINT32_MAX; const uint32_t max_workgroup_size = MIN2(1024, 32 * devinfo->max_cs_workgroup_threads); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 3241d2defd6..eef8ed7e6f2 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -916,10 +916,6 @@ struct anv_physical_device { bool always_use_bindless; bool use_call_secondary; - /** 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 */ bool has_exec_timeline; diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c index 1bbd978617b..f0551cff93f 100644 --- a/src/intel/vulkan/genX_state.c +++ b/src/intel/vulkan/genX_state.c @@ -916,16 +916,14 @@ VkResult genX(CreateSampler)( assert((sampler->custom_border_color.map == NULL) || has_custom_color); - if (device->physical->has_bindless_samplers) { - /* If we have bindless, allocate enough samplers. We allocate 32 bytes - * for each sampler instead of 16 bytes because we want all bindless - * samplers to be 32-byte aligned so we don't have to use indirect - * sampler messages on them. - */ - sampler->bindless_state = - anv_state_pool_alloc(&device->dynamic_state_pool, - sampler->n_planes * 32, 32); - } + /* If we have bindless, allocate enough samplers. We allocate 32 bytes + * for each sampler instead of 16 bytes because we want all bindless + * samplers to be 32-byte aligned so we don't have to use indirect + * sampler messages on them. + */ + sampler->bindless_state = + anv_state_pool_alloc(&device->dynamic_state_pool, + sampler->n_planes * 32, 32); const bool seamless_cube = !(pCreateInfo->flags & VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT);