[vulkan] Parse descriptor pools

This commit is contained in:
Bill Currie 2021-01-10 01:53:15 +09:00
parent e281b608e1
commit 01b9c9bf78
3 changed files with 34 additions and 0 deletions

View file

@ -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;

View file

@ -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++) {

View file

@ -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 = {