From e281b608e1bc3dbf972a2fa2d2022c2c39dc7a35 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 10 Jan 2021 01:38:31 +0900 Subject: [PATCH] [vulkan] Provide access to swapchain image count This necessitated hand-writing qfv_swapchain_t's descriptors as I don't feel like getting that complicated with vkgen at this stage and it's not really appropriate anyway? qfv_swapchain_t is meant to be read-only and not parsed from a plist. --- libs/video/renderer/vulkan/vkparse.c | 32 ++++++++++++++++++++++++ libs/video/renderer/vulkan/vkparse.plist | 5 ---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index 45236c7ff..b74d9af7d 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -469,6 +469,36 @@ parse_BasePipeline (const plitem_t *item, void **data, #include "libs/video/renderer/vulkan/vkparse.cinc" +static exprsym_t imageset_symbols[] = { + {"size", &cexpr_size_t, (void *)field_offset (qfv_imageset_t, size)}, + { } +}; +static exprtab_t imageset_symtab = { + imageset_symbols, +}; +exprtype_t imageset_type = { + "imageset", + sizeof (qfv_imageset_t *), + cexpr_struct_pointer_binops, + 0, + &imageset_symtab, +}; +static exprsym_t qfv_swapchain_t_symbols[] = { + {"format", &VkFormat_type, (void *)field_offset (qfv_swapchain_t, format)}, + {"images", &imageset_type, (void *)field_offset (qfv_swapchain_t, images)}, + { } +}; +static exprtab_t qfv_swapchain_t_symtab = { + qfv_swapchain_t_symbols, +}; +exprtype_t qfv_swapchain_t_type = { + "qfv_swapchain_t", + sizeof (qfv_swapchain_t), + cexpr_struct_binops, + 0, + &qfv_swapchain_t_symtab, +}; + typedef struct qfv_renderpass_s { qfv_attachmentdescription_t *attachments; qfv_subpassparametersset_t *subpasses; @@ -566,6 +596,8 @@ QFV_InitParse (vulkan_ctx_t *ctx) &ctx->hashlinks); context.hashlinks = &ctx->hashlinks; vkgen_init_symtabs (&context); + cexpr_init_symtab (&qfv_swapchain_t_symtab, &context); + cexpr_init_symtab (&imageset_symtab, &context); } exprenum_t * diff --git a/libs/video/renderer/vulkan/vkparse.plist b/libs/video/renderer/vulkan/vkparse.plist index 97e767676..f6c92e110 100644 --- a/libs/video/renderer/vulkan/vkparse.plist +++ b/libs/video/renderer/vulkan/vkparse.plist @@ -18,7 +18,6 @@ VkPushConstantRange, VkPipelineLayoutCreateInfo, VkGraphicsPipelineCreateInfo, - qfv_swapchain_t, ); handles = { VkShaderModule = { @@ -61,10 +60,6 @@ }, ); parse = { - qfv_swapchain_s = { - .name = qfv_swapchain_t; - format = auto; - }; VkSubpassDescription = { flags = auto; pipelineBindPoint = auto;