From e12698724e51a989c719b905fb82d3d758944f6c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 4 Mar 2022 12:52:04 +0200 Subject: [PATCH] anv: rename host only descriptor internal flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We add an assert to verify that those are not bound. v2: Drop != 0 (Tapani) Signed-off-by: Lionel Landwerlin Reviewed-by: Rohan Garg Reviewed-by: Tapani Pälli Part-of: --- src/intel/vulkan/anv_cmd_buffer.c | 11 +++++++++++ src/intel/vulkan/anv_descriptor_set.c | 18 +++++++++--------- src/intel/vulkan/anv_private.h | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 1d012adbcb8..78f8728c29a 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -993,6 +993,17 @@ anv_cmd_buffer_bind_descriptor_set(struct anv_cmd_buffer *cmd_buffer, uint32_t *dynamic_offset_count, const uint32_t **dynamic_offsets) { + /* Either we have no pool because it's a push descriptor or the pool is not + * host only : + * + * VUID-vkCmdBindDescriptorSets-pDescriptorSets-04616: + * + * "Each element of pDescriptorSets must not have been allocated from a + * VkDescriptorPool with the + * VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE flag set" + */ + assert(!set->pool || !set->pool->host_only); + struct anv_descriptor_set_layout *set_layout = layout->set[set_index].layout; diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 733cea867ba..6b277fd8f81 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -944,7 +944,7 @@ VkResult anv_CreateDescriptorPool( pool->size = pool_size; pool->next = 0; pool->free_list = EMPTY; - pool->allocate_surface_states = (pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE) == 0; + pool->host_only = pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE; if (descriptor_bo_size > 0) { VkResult result = anv_device_alloc_bo(device, @@ -1091,7 +1091,7 @@ struct surface_state_free_list_entry { static struct anv_state anv_descriptor_pool_alloc_state(struct anv_descriptor_pool *pool) { - assert(pool->allocate_surface_states); + assert(!pool->host_only); struct surface_state_free_list_entry *entry = pool->surface_state_free_list; @@ -1174,7 +1174,7 @@ anv_descriptor_set_create(struct anv_device *device, anv_isl_format_for_descriptor_type(device, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); - if (pool->allocate_surface_states) { + if (!pool->host_only) { set->desc_surface_state = anv_descriptor_pool_alloc_state(pool); anv_fill_buffer_surface_state(device, set->desc_surface_state, format, ISL_SURF_USAGE_CONSTANT_BUFFER_BIT, @@ -1230,7 +1230,7 @@ anv_descriptor_set_create(struct anv_device *device, /* Allocate null surface state for the buffer views since * we lazy allocate this in the write anyway. */ - if (pool->allocate_surface_states) { + if (!pool->host_only) { for (uint32_t b = 0; b < set->buffer_view_count; b++) { set->buffer_views[b].surface_state = anv_descriptor_pool_alloc_state(pool); @@ -1259,7 +1259,7 @@ anv_descriptor_set_destroy(struct anv_device *device, anv_descriptor_pool_free_state(pool, set->desc_surface_state); } - if (pool->allocate_surface_states) { + if (!pool->host_only) { for (uint32_t b = 0; b < set->buffer_view_count; b++) { if (set->buffer_views[b].surface_state.alloc_size) anv_descriptor_pool_free_state(pool, set->buffer_views[b].surface_state); @@ -1417,7 +1417,7 @@ anv_descriptor_set_write_image_view(struct anv_device *device, .sampler = sampler, }; - if (set->pool && !set->pool->allocate_surface_states) + if (set->pool && set->pool->host_only) return; void *desc_map = set->desc_mem.map + bind_layout->descriptor_offset + @@ -1522,7 +1522,7 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device, .buffer_view = buffer_view, }; - if (set->pool && !set->pool->allocate_surface_states) + if (set->pool && set->pool->host_only) return; enum anv_descriptor_data data = @@ -1590,7 +1590,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device, .buffer = buffer, }; - if (set->pool && !set->pool->allocate_surface_states) + if (set->pool && set->pool->host_only) return; void *desc_map = set->desc_mem.map + bind_layout->descriptor_offset + @@ -1693,7 +1693,7 @@ anv_descriptor_set_write_acceleration_structure(struct anv_device *device, .accel_struct = accel, }; - if (set->pool && !set->pool->allocate_surface_states) + if (set->pool && set->pool->host_only) return; struct anv_address_range_descriptor desc_data = { }; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 90ec212386d..95e8d8bb94e 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2021,7 +2021,7 @@ struct anv_descriptor_pool { struct list_head desc_sets; - bool allocate_surface_states; + bool host_only; char data[0]; };