anv: Fix destroying descriptor sets when pool gets reset
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Tue, 12 Mar 2019 15:13:47 +0000 (17:13 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 12 Mar 2019 17:09:37 +0000 (17:09 +0000)
pool->next and pool->free_list were reset before their usage in
anv_descriptor_pool_free_set

Fixes: 775aabdd "anv: destroy descriptor sets when pool gets reset"
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_descriptor_set.c

index f34a44aefd7e8cf00607969b35813b9277b970c9..a648105970d559563b643c4d534c9c708523b6c0 100644 (file)
@@ -627,6 +627,11 @@ VkResult anv_ResetDescriptorPool(
    ANV_FROM_HANDLE(anv_device, device, _device);
    ANV_FROM_HANDLE(anv_descriptor_pool, pool, descriptorPool);
 
+   list_for_each_entry_safe(struct anv_descriptor_set, set,
+                            &pool->desc_sets, pool_link) {
+      anv_descriptor_set_destroy(device, pool, set);
+   }
+
    pool->next = 0;
    pool->free_list = EMPTY;
 
@@ -636,12 +641,6 @@ VkResult anv_ResetDescriptorPool(
    }
 
    anv_state_stream_finish(&pool->surface_state_stream);
-
-   list_for_each_entry_safe(struct anv_descriptor_set, set,
-                            &pool->desc_sets, pool_link) {
-      anv_descriptor_set_destroy(device, pool, set);
-   }
-
    anv_state_stream_init(&pool->surface_state_stream,
                          &device->surface_state_pool, 4096);
    pool->surface_state_free_list = NULL;