diff --git a/include/vid_vulkan.h b/include/vid_vulkan.h index d34e067fe..6aff7ea32 100644 --- a/include/vid_vulkan.h +++ b/include/vid_vulkan.h @@ -48,6 +48,7 @@ typedef struct vulkan_ctx_s { struct hashtab_s *shaderModules; struct hashtab_s *setLayouts; struct hashtab_s *pipelineLayouts; + struct hashtab_s *descriptorPools; VkCommandPool cmdpool; VkCommandBuffer cmdbuffer; diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index b74d9af7d..d7060d237 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -456,6 +456,21 @@ pipelineLayout_free (void *hr, void *_ctx) handleref_free (handleref, ctx); } +static void +descriptorPool_free (void *hr, void *_ctx) +{ + __auto_type handleref = (handleref_t *) hr; + __auto_type pool = (VkDescriptorPool) handleref->handle; + __auto_type ctx = (vulkan_ctx_t *) _ctx; + qfv_device_t *device = ctx->device; + qfv_devfuncs_t *dfunc = device->funcs; + + if (pool) { + dfunc->vkDestroyDescriptorPool (device->dev, pool, 0); + }; + handleref_free (handleref, ctx); +} + static hashtab_t *enum_symtab; static int @@ -560,6 +575,9 @@ QFV_ParseResources (vulkan_ctx_t *ctx, plitem_t *pipelinedef) ctx->pipelineLayouts = Hash_NewTable (23, handleref_getkey, pipelineLayout_free, ctx, &ctx->hashlinks); + ctx->descriptorPools = Hash_NewTable (23, handleref_getkey, + descriptorPool_free, + ctx, &ctx->hashlinks); } for (parseres_t *res = parse_resources; res->name; res++) { diff --git a/libs/video/renderer/vulkan/vkparse.plist b/libs/video/renderer/vulkan/vkparse.plist index f6c92e110..fc406b4c4 100644 --- a/libs/video/renderer/vulkan/vkparse.plist +++ b/libs/video/renderer/vulkan/vkparse.plist @@ -18,6 +18,7 @@ VkPushConstantRange, VkPipelineLayoutCreateInfo, VkGraphicsPipelineCreateInfo, + VkDescriptorPoolCreateInfo, ); handles = { VkShaderModule = { @@ -25,6 +26,11 @@ class = "shader module"; custom = parse_VkShaderModule_resource; }; + VkDescriptorPool = { + symtab = descriptorPools; + class = "descriptor pool"; + create = vkCreateDescriptorPool; + }; VkDescriptorSetLayout = { symtab = setLayouts; class = "set layout"; @@ -150,6 +156,15 @@ values = pBindings; }; }; + VkDescriptorPoolCreateInfo = { + flags = auto; + maxSets = auto; + bindings = { + type = (array, VkDescriptorPoolSize); + size = poolSizeCount; + values = pPoolSizes; + }; + }; VkPipelineVertexInputStateCreateInfo = { //flags = auto; reserved for future use (Bits enum does not exist) bindings = {