anv/descriptor_set: add reference counting for descriptor set layouts

The spec states that descriptor set layouts can be destroyed almost
at any time:

   "VkDescriptorSetLayout objects may be accessed by commands that
    operate on descriptor sets allocated using that layout, and those
    descriptor sets must not be updated with vkUpdateDescriptorSets
    after the descriptor set layout has been destroyed. Otherwise,
    descriptor set layouts can be destroyed any time they are not in
    use by an API command."

v2: allocate off the device allocator with DEVICE scope (Jason)

Fixes the following work-in-progress CTS tests:
dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics
dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.compute

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Iago Toral Quiroga
2018-01-25 09:43:22 +01:00
parent e28233a527
commit 14f6275c92
3 changed files with 41 additions and 11 deletions

View File

@@ -913,8 +913,7 @@ void anv_CmdPushDescriptorSetKHR(
assert(_set < MAX_SETS);
const struct anv_descriptor_set_layout *set_layout =
layout->set[_set].layout;
struct anv_descriptor_set_layout *set_layout = layout->set[_set].layout;
struct anv_push_descriptor_set *push_set =
anv_cmd_buffer_get_push_descriptor_set(cmd_buffer,
@@ -1006,8 +1005,7 @@ void anv_CmdPushDescriptorSetWithTemplateKHR(
assert(_set < MAX_PUSH_DESCRIPTORS);
const struct anv_descriptor_set_layout *set_layout =
layout->set[_set].layout;
struct anv_descriptor_set_layout *set_layout = layout->set[_set].layout;
struct anv_push_descriptor_set *push_set =
anv_cmd_buffer_get_push_descriptor_set(cmd_buffer,