[gtk+/wip/otte/vulkan: 60/62] vulkan: Don't limit number of descriptor sets
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/vulkan: 60/62] vulkan: Don't limit number of descriptor sets
- Date: Fri, 9 Dec 2016 17:39:59 +0000 (UTC)
commit b3388aaca992564b1b244c1df5adb2859a15bd57
Author: Benjamin Otte <otte redhat com>
Date: Fri Dec 9 06:09:52 2016 +0100
vulkan: Don't limit number of descriptor sets
If we need more than we have reserved as maximum, recreate the
descriptor pool with a higher maximum.
gsk/gskvulkanrender.c | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index 12b390d..8c14519 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -331,11 +331,38 @@ gsk_vulkan_render_prepare_descriptor_sets (GskVulkanRender *self,
needed_sets = g_hash_table_size (self->descriptor_set_indexes);
if (needed_sets > self->n_descriptor_sets)
{
- g_assert (needed_sets < self->descriptor_pool_maxsets);
+ if (needed_sets > self->descriptor_pool_maxsets)
+ {
+ guint added_sets = needed_sets - self->descriptor_pool_maxsets;
+ added_sets = added_sets + DESCRIPTOR_POOL_MAXSETS_INCREASE - 1;
+ added_sets -= added_sets % DESCRIPTOR_POOL_MAXSETS_INCREASE;
+
+ vkDestroyDescriptorPool (device,
+ self->descriptor_pool,
+ NULL);
+ self->descriptor_pool_maxsets += added_sets;
+ GSK_VK_CHECK (vkCreateDescriptorPool, device,
+ &(VkDescriptorPoolCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
+ .maxSets = self->descriptor_pool_maxsets,
+ .poolSizeCount = 1,
+ .pPoolSizes = (VkDescriptorPoolSize[1]) {
+ {
+ .type =
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+ .descriptorCount = 1
+ }
+ }
+ },
+ NULL,
+ &self->descriptor_pool);
+ }
+ else
+ {
+ GSK_VK_CHECK (vkResetDescriptorPool, device,
+ self->descriptor_pool,
+ 0);
+ }
- GSK_VK_CHECK (vkResetDescriptorPool, device,
- self->descriptor_pool,
- 0);
self->n_descriptor_sets = needed_sets;
self->descriptor_sets = g_renew (VkDescriptorSet, self->descriptor_sets, needed_sets);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]