summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_meta.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-11 22:46:28 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-22 17:13:51 -0800
commit2570a58bcdf30d699b89323fef60692093dee7ea (patch)
treed27100ecad296a746182c96e6cc5aa3e5998b491 /src/intel/vulkan/anv_meta.c
parent353d5bf286e1509af9ec2f1b8152d1f64790b52c (diff)
anv: Implement descriptor pools
Descriptor pools are an optimization that lets applications allocate descriptor sets through an externally synchronized object (that is, unlocked). In our case it's also plugging a memory leak, since we didn't track all allocated sets and failed to free them in vkResetDescriptorPool() and vkDestroyDescriptorPool().
Diffstat (limited to 'src/intel/vulkan/anv_meta.c')
-rw-r--r--src/intel/vulkan/anv_meta.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_meta.c b/src/intel/vulkan/anv_meta.c
index 82944ea1a92..683a1623cc3 100644
--- a/src/intel/vulkan/anv_meta.c
+++ b/src/intel/vulkan/anv_meta.c
@@ -138,6 +138,27 @@ anv_device_init_meta(struct anv_device *device)
.pfnFree = meta_free,
};
+ const VkDescriptorPoolCreateInfo create_info = {
+ .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
+ .pNext = NULL,
+ .flags = 0,
+ .maxSets = 1,
+ .poolSizeCount = 1,
+ .pPoolSizes = (VkDescriptorPoolSize[]) {
+ {
+ .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+ .descriptorCount = 1
+ },
+ }
+ };
+
+ result = anv_CreateDescriptorPool(anv_device_to_handle(device),
+ &create_info,
+ &device->meta_state.alloc,
+ &device->meta_state.desc_pool);
+ if (result != VK_SUCCESS)
+ goto fail_desc_pool;
+
result = anv_device_init_meta_clear_state(device);
if (result != VK_SUCCESS)
goto fail_clear;
@@ -157,6 +178,10 @@ fail_blit:
fail_resolve:
anv_device_finish_meta_clear_state(device);
fail_clear:
+ anv_DestroyDescriptorPool(anv_device_to_handle(device),
+ device->meta_state.desc_pool,
+ &device->meta_state.alloc);
+fail_desc_pool:
return result;
}