anv/descriptor_set: Unlink sets from the pool in set_destroy
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 24 Apr 2019 03:13:55 +0000 (22:13 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 24 Apr 2019 05:40:27 +0000 (05:40 +0000)
anv_descriptor_pool_free_set is called on the clean-up path of
anv_descriptor_set_create and the set may not have been added to the
pool's list of sets yet.  While we're here, we move adding it to that
list into set_create for symmetry.

Fixes: 105002bd2d "anv: destroy descriptor sets when pool gets..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_descriptor_set.c

index ac380cb19814a8d535c540c7662c4c0b9e6b232a..a1dd8a3527f3dd8a6b7580843b64a5482a10be0c 100644 (file)
@@ -840,8 +840,6 @@ anv_descriptor_pool_free_set(struct anv_descriptor_pool *pool,
       entry->size = set->size;
       pool->free_list = (char *) entry - pool->data;
    }
-
-   list_del(&set->pool_link);
 }
 
 struct surface_state_free_list_entry {
@@ -971,6 +969,8 @@ anv_descriptor_set_create(struct anv_device *device,
          anv_descriptor_pool_alloc_state(pool);
    }
 
+   list_addtail(&set->pool_link, &pool->desc_sets);
+
    *out_set = set;
 
    return VK_SUCCESS;
@@ -993,6 +993,8 @@ anv_descriptor_set_destroy(struct anv_device *device,
    for (uint32_t b = 0; b < set->buffer_view_count; b++)
       anv_descriptor_pool_free_state(pool, set->buffer_views[b].surface_state);
 
+   list_del(&set->pool_link);
+
    anv_descriptor_pool_free_set(pool, set);
 }
 
@@ -1016,8 +1018,6 @@ VkResult anv_AllocateDescriptorSets(
       if (result != VK_SUCCESS)
          break;
 
-      list_addtail(&set->pool_link, &pool->desc_sets);
-
       pDescriptorSets[i] = anv_descriptor_set_to_handle(set);
    }