anv: rename host only descriptor internal flag

We add an assert to verify that those are not bound.

v2: Drop != 0 (Tapani)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15241>
This commit is contained in:
Lionel Landwerlin
2022-03-04 12:52:04 +02:00
committed by Marge Bot
parent 87f59b18cf
commit e12698724e
3 changed files with 21 additions and 10 deletions

View File

@@ -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;

View File

@@ -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 = { };

View File

@@ -2021,7 +2021,7 @@ struct anv_descriptor_pool {
struct list_head desc_sets;
bool allocate_surface_states;
bool host_only;
char data[0];
};