From f5e7d5fbbcc6fbb1c09779f300cfc6f052ca94ad Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 26 Jun 2023 00:56:35 +0900 Subject: [PATCH] [vulkan] Clean out the old vkparse support functions Lots and lots of deletions. --- libs/video/renderer/vulkan/vkgen/vkalias.r | 10 +- libs/video/renderer/vulkan/vkgen/vkstruct.r | 2 +- libs/video/renderer/vulkan/vkparse.c | 683 -------------------- libs/video/renderer/vulkan/vkparse.h | 32 - libs/video/renderer/vulkan/vkparse.plist | 224 +------ 5 files changed, 10 insertions(+), 941 deletions(-) diff --git a/libs/video/renderer/vulkan/vkgen/vkalias.r b/libs/video/renderer/vulkan/vkgen/vkalias.r index f6c2f17e4..91098ce83 100644 --- a/libs/video/renderer/vulkan/vkgen/vkalias.r +++ b/libs/video/renderer/vulkan/vkgen/vkalias.r @@ -47,11 +47,11 @@ if (!type) { // pointer to opaque struct. Probably // VK_DEFINE_NON_DISPATCHABLE_HANDLE or VK_DEFINE_HANDLE - string createInfo = name + "CreateInfo"; - id structObj = (id) Hash_Find (available_types, createInfo); - if (structObj) { - [structObj addToQueue]; - } + //string createInfo = name + "CreateInfo"; + //id structObj = (id) Hash_Find (available_types, createInfo); + //if (structObj) { + // [structObj addToQueue]; + //} } else if ([type class] == [Alias class]) { type = [type resolveType]; if ([type class] == [Struct class]) { diff --git a/libs/video/renderer/vulkan/vkgen/vkstruct.r b/libs/video/renderer/vulkan/vkgen/vkstruct.r index 1b8c9a1f2..f7257de8b 100644 --- a/libs/video/renderer/vulkan/vkgen/vkstruct.r +++ b/libs/video/renderer/vulkan/vkgen/vkstruct.r @@ -374,7 +374,7 @@ write_table (Struct *self, PLItem *field_dict, Array *field_defs, if (have_pNext) { fprintf (output_file, "\t{\"@next\", field_offset (%s, pNext), " - "QFArray, parse_next, 0},", [self outname]); + "QFArray, parse_next, 0},\n", [self outname]); } for (int i = [field_defs count]; i-- > 0; ) { FieldDef *field_def = [field_defs objectAtIndex:i]; diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index 516829da8..d0e0d2609 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -603,55 +603,6 @@ QFV_AddHandle (hashtab_t *tab, const char *name, uint64_t handle) Hash_Add (tab, hr); } -static const char * -resource_path (vulkan_ctx_t *ctx, const char *prefix, const char *name) -{ - if (name[0] != '$') { - if (prefix) { - name = va (ctx->va_ctx, "$"QFV_PROPERTIES".%s.%s", prefix, name); - } else { - name = va (ctx->va_ctx, "$"QFV_PROPERTIES".%s", name); - } - } - return name; -} - -static int -parse_VkRenderPass (const plitem_t *item, void **data, - plitem_t *messages, parsectx_t *pctx) -{ - __auto_type handle = (VkRenderPass *) data[0]; - int ret = 1; - exprctx_t ectx = *pctx->ectx; - vulkan_ctx_t *ctx = pctx->vctx; - scriptctx_t *sctx = ctx->script_context; - - const char *name = PL_String (item); - const char *path = resource_path (ctx, 0, name); - Sys_MaskPrintf (SYS_vulkan_parse, "parse_VkRenderPass: %s\n", path); - - *handle = (VkRenderPass) QFV_GetHandle (sctx->renderpasses, path); - if (*handle) { - return 1; - } - - plitem_t *setItem = 0; - exprval_t result = { &cexpr_plitem, &setItem }; - ectx.result = &result; - ectx.item = item; - ret = !cexpr_eval_string (path, &ectx); - if (ret) { - VkRenderPass setLayout; - setLayout = QFV_ParseRenderPass (ctx, setItem, pctx->properties); - *handle = (VkRenderPass) setLayout; - - // path not guaranteed to survive cexpr_eval_string due to va - path = resource_path (ctx, 0, name); - QFV_AddHandle (sctx->renderpasses, path, (uint64_t) setLayout); - } - return ret; -} - static int parse_VkShaderModule (const plitem_t *item, void **data, plitem_t *messages, parsectx_t *pctx) @@ -677,81 +628,6 @@ parse_VkShaderModule (const plitem_t *item, void **data, return 1; } -static int -parse_VkDescriptorSetLayout (const plfield_t *field, const plitem_t *item, - void *data, plitem_t *messages, void *context) -{ - __auto_type handle = (VkDescriptorSetLayout *) data; - int ret = 1; - parsectx_t *pctx = context; - exprctx_t ectx = *pctx->ectx; - vulkan_ctx_t *ctx = pctx->vctx; - scriptctx_t *sctx = ctx->script_context; - - const char *name = PL_String (item); - const char *path = resource_path (ctx, "setLayouts", name); - Sys_MaskPrintf (SYS_vulkan_parse, "parse_VkDescriptorSetLayout: %s\n", - path); - - *handle = (VkDescriptorSetLayout) QFV_GetHandle (sctx->setLayouts, path); - if (*handle) { - return 1; - } - - plitem_t *setItem = 0; - exprval_t result = { &cexpr_plitem, &setItem }; - ectx.result = &result; - ectx.item = item; - ret = !cexpr_eval_string (path, &ectx); - if (ret) { - VkDescriptorSetLayout setLayout; - setLayout = QFV_ParseDescriptorSetLayout (ctx, setItem, - pctx->properties); - *handle = (VkDescriptorSetLayout) setLayout; - - // path not guaranteed to survive cexpr_eval_string due to va - path = resource_path (ctx, "setLayouts", name); - QFV_AddHandle (sctx->setLayouts, path, (uint64_t) setLayout); - } - return ret; -} - -static int -parse_VkPipelineLayout (const plitem_t *item, void **data, - plitem_t *messages, parsectx_t *pctx) -{ - __auto_type handle = (VkPipelineLayout *) data[0]; - int ret = 1; - exprctx_t ectx = *pctx->ectx; - vulkan_ctx_t *ctx = pctx->vctx; - scriptctx_t *sctx = ctx->script_context; - - const char *name = PL_String (item); - const char *path = resource_path (ctx, "pipelineLayouts", name); - Sys_MaskPrintf (SYS_vulkan_parse, "parse_VkPipelineLayout: %s\n", path); - - *handle = (VkPipelineLayout) QFV_GetHandle (sctx->pipelineLayouts, path); - if (*handle) { - return 1; - } - - plitem_t *setItem = 0; - exprval_t result = { &cexpr_plitem, &setItem }; - ectx.result = &result; - ectx.item = item; - ret = !cexpr_eval_string (path, &ectx); - if (ret) { - VkPipelineLayout layout; - layout = QFV_ParsePipelineLayout (ctx, setItem, pctx->properties); - *handle = (VkPipelineLayout) layout; - - // path not guaranteed to survive cexpr_eval_string due to va - path = resource_path (ctx, "pipelineLayouts", name); - QFV_AddHandle (sctx->pipelineLayouts, path, (uint64_t) layout); - } - return ret; -} - exprtype_t VkImage_type = { .name = "VkImage", .size = sizeof (VkImage), @@ -768,94 +644,6 @@ exprtype_t VkImageView_type = { .data = 0 }; -static int -parse_VkImage (const plitem_t *item, void **data, plitem_t *messages, - parsectx_t *pctx) -{ - __auto_type handle = (VkImage *) data[0]; - int ret = 1; - exprctx_t ectx = *pctx->ectx; - vulkan_ctx_t *ctx = pctx->vctx; - scriptctx_t *sctx = ctx->script_context; - - const char *name = PL_String (item); - const char *path = resource_path (ctx, "images", name); - Sys_MaskPrintf (SYS_vulkan_parse, "parse_VkImage: %s\n", path); - - *handle = (VkImage) QFV_GetHandle (sctx->images, path); - if (*handle) { - return 1; - } - - exprval_t result = { }; - ectx.result = &result; - ectx.item = item; - ret = !cexpr_eval_string (path, &ectx); - if (ret) { - if (result.type == &cexpr_plitem) { - plitem_t *imageItem = *(plitem_t **) result.value; - VkImage image; - image = QFV_ParseImage (ctx, imageItem, pctx->properties); - *handle = (VkImage) image; - - // path not guaranteed to survive cexpr_eval_string due to va - path = resource_path (ctx, "images", name); - QFV_AddHandle (sctx->images, path, (uint64_t) image); - } else if (result.type == &VkImage_type) { - *handle = *(VkImage *) result.value; - } else { - ret = 0; - } - } - return ret; -} - -static int -parse_VkImageView (const plfield_t *field, const plitem_t *item, void *data, - plitem_t *messages, void *context) -{ - parsectx_t *pctx = context; - __auto_type handle = (VkImageView *) data; - int ret = 1; - exprctx_t ectx = *pctx->ectx; - vulkan_ctx_t *ctx = pctx->vctx; - scriptctx_t *sctx = ctx->script_context; - - const char *name = PL_String (item); - const char *path = resource_path (ctx, "imageViews", name); - Sys_MaskPrintf (SYS_vulkan_parse, "parse_VkImageView: %s\n", path); - - *handle = (VkImageView) QFV_GetHandle (sctx->imageViews, path); - if (*handle) { - return 1; - } - - exprval_t *value = 0; - exprval_t result = { &cexpr_exprval, &value }; - ectx.result = &result; - ectx.item = item; - ret = !cexpr_eval_string (path, &ectx); - - plitem_t *imageViewItem = 0; - if (ret) { - VkImageView imageView; - if (value->type == &VkImageView_type) { - imageView = *(VkImageView *) value->value; - } else if (value->type == &cexpr_plitem) { - imageView = QFV_ParseImageView (ctx, imageViewItem, - pctx->properties); - // path not guaranteed to survive cexpr_eval_string due to va - path = resource_path (ctx, "imageViews", name); - QFV_AddHandle (sctx->imageViews, path, (uint64_t) imageView); - } else { - PL_Message (messages, item, "not a VkImageView"); - return 0; - } - *handle = (VkImageView) imageView; - } - return ret; -} - static const char * handleref_getkey (const void *hr, void *unused) { @@ -1000,15 +788,6 @@ renderpass_free (void *hr, void *_ctx) static hashtab_t *enum_symtab; -static int -parse_BasePipeline (const plitem_t *item, void **data, - plitem_t *messages, parsectx_t *pctx) -{ - *(VkPipeline *) data = 0; - PL_Message (messages, item, "not implemented"); - return 0; -} - typedef struct data_array_s DARRAY_TYPE(byte) data_array_t; static void data_array (const exprval_t **params, exprval_t *result, exprctx_t *context) @@ -1287,239 +1066,6 @@ parse_object (vulkan_ctx_t *ctx, memsuper_t *memsuper, plitem_t *plist, return 1; } -VkRenderPass -QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties) -{ - memsuper_t *memsuper = new_memsuper (); - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - - VkRenderPassCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkRenderPassCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkRenderPass renderpass; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseRenderPass: %d", - PL_Line (plist))); - dfunc->vkCreateRenderPass (device->dev, &cInfo, 0, &renderpass); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return renderpass; -} - -VkPipeline -QFV_ParseComputePipeline (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties) -{ - memsuper_t *memsuper = new_memsuper (); - qfv_device_t *device = ctx->device; - - __auto_type cInfo = QFV_AllocComputePipelineCreateInfoSet (1, alloca); - memset (&cInfo->a[0], 0, sizeof (cInfo->a[0])); - - if (!parse_object (ctx, memsuper, plist, parse_VkComputePipelineCreateInfo, - &cInfo->a[0], properties)) { - delete_memsuper (memsuper); - return 0; - } - - qfvPushDebug (ctx, va (ctx->va_ctx, - "QFV_ParseComputePipeline: %d", PL_Line (plist))); - - __auto_type plSet = QFV_CreateComputePipelines (device, 0, cInfo); - qfvPopDebug (ctx); - VkPipeline pipeline = plSet->a[0]; - free (plSet); - delete_memsuper (memsuper); - return pipeline; -} - -VkPipeline -QFV_ParseGraphicsPipeline (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties) -{ - memsuper_t *memsuper = new_memsuper (); - qfv_device_t *device = ctx->device; - - __auto_type cInfo = QFV_AllocGraphicsPipelineCreateInfoSet (1, alloca); - memset (&cInfo->a[0], 0, sizeof (cInfo->a[0])); - - if (!parse_object (ctx, memsuper, plist, parse_VkGraphicsPipelineCreateInfo, - &cInfo->a[0], properties)) { - delete_memsuper (memsuper); - return 0; - } - - qfvPushDebug (ctx, va (ctx->va_ctx, - "QFV_ParsePipeline: %d", PL_Line (plist))); - - __auto_type plSet = QFV_CreateGraphicsPipelines (device, 0, cInfo); - qfvPopDebug (ctx); - VkPipeline pipeline = plSet->a[0]; - free (plSet); - delete_memsuper (memsuper); - return pipeline; -} - -VkDescriptorPool -QFV_ParseDescriptorPool (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkDescriptorPoolCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkDescriptorPoolCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkDescriptorPool pool; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseDescriptorPool: %d", PL_Line (plist))); - dfunc->vkCreateDescriptorPool (device->dev, &cInfo, 0, &pool); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return pool; -} - -VkDescriptorSetLayout -QFV_ParseDescriptorSetLayout (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkDescriptorSetLayoutCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, - parse_VkDescriptorSetLayoutCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkDescriptorSetLayout setLayout; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseDescriptorSetLayout: %d", PL_Line (plist))); - dfunc->vkCreateDescriptorSetLayout (device->dev, &cInfo, 0, &setLayout); - QFV_duSetObjectName (device, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, - setLayout, va (ctx->va_ctx, "descriptorSetLayout:%d", - PL_Line (plist))); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return setLayout; -} - -VkPipelineLayout -QFV_ParsePipelineLayout (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkPipelineLayoutCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkPipelineLayoutCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkPipelineLayout layout; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParsePipelineLayout: %d", PL_Line (plist))); - dfunc->vkCreatePipelineLayout (device->dev, &cInfo, 0, &layout); - QFV_duSetObjectName (device, VK_OBJECT_TYPE_PIPELINE_LAYOUT, - layout, va (ctx->va_ctx, "pipelineLayout:%d", - PL_Line (plist))); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return layout; -} - -VkSampler -QFV_ParseSampler (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkSamplerCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkSamplerCreateInfo, &cInfo, - properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkSampler sampler; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseSampler: %d", PL_Line (plist))); - dfunc->vkCreateSampler (device->dev, &cInfo, 0, &sampler); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return sampler; -} - -VkImage -QFV_ParseImage (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkImageCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkImageCreateInfo, &cInfo, - properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkImage image; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseImage: %d", PL_Line (plist))); - dfunc->vkCreateImage (device->dev, &cInfo, 0, &image); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return image; -} - -VkImageView -QFV_ParseImageView (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkImageViewCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkImageViewCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkImageView imageView; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseImageView: %d", PL_Line (plist))); - dfunc->vkCreateImageView (device->dev, &cInfo, 0, &imageView); - qfvPopDebug (ctx); - - delete_memsuper (memsuper); - return imageView; -} - typedef struct { uint32_t count; VkImageCreateInfo *info; @@ -1530,192 +1076,6 @@ typedef struct { VkImageViewCreateInfo *info; } imageviewcreate_t; -static plelement_t qfv_imagecreate_dict = { - QFDictionary, - sizeof (VkImageCreateInfo), - vkparse_alloc, - parse_VkImageCreateInfo, -}; - -static plelement_t qfv_imageviewcreate_dict = { - QFDictionary, - sizeof (VkImageViewCreateInfo), - vkparse_alloc, - parse_VkImageViewCreateInfo, -}; - -static int -parse_imagecreate_dict (const plfield_t *field, const plitem_t *item, - void *data, plitem_t *messages, void *context) -{ - plfield_t f = { "images", 0, QFArray, parse_array, - &qfv_imagecreate_dict }; - typedef struct arr_s DARRAY_TYPE(byte) arr_t; - arr_t *arr = 0; - int ret; - - if ((ret = PL_ParseLabeledArray (&f, item, &arr, messages, context))) { - imagecreate_t *imagecreate = data; - imagecreate->count = arr->size; - imagecreate->info = (VkImageCreateInfo *) arr->a; - } - return ret; -} - -static int -parse_imageviewcreate_dict (const plfield_t *field, const plitem_t *item, - void *data, plitem_t *messages, void *context) -{ - plfield_t f = { "images", 0, QFArray, parse_array, - &qfv_imageviewcreate_dict }; - typedef struct arr_s DARRAY_TYPE(byte) arr_t; - arr_t *arr = 0; - int ret; - - if ((ret = PL_ParseLabeledArray (&f, item, &arr, messages, context))) { - imageviewcreate_t *imageviewcreate = data; - imageviewcreate->count = arr->size; - imageviewcreate->info = (VkImageViewCreateInfo *) arr->a; - } else { - //FIXME leaky boat when succeeds - if (arr) { - free (arr); - } - } - return ret; -} - -qfv_imageset_t * -QFV_ParseImageSet (vulkan_ctx_t *ctx, plitem_t *item, plitem_t *properties) -{ - scriptctx_t *sctx = ctx->script_context; - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - imagecreate_t create = {}; - - pltype_t type = PL_Type (item); - - if (type == QFDictionary) { - if (!parse_object (ctx, memsuper, item, parse_imagecreate_dict, - &create, properties)) { - delete_memsuper (memsuper); - return 0; - } - } else { - Sys_MaskPrintf (SYS_vulkan_parse, "Neither array nor dictionary: %d\n", - PL_Line (item)); - delete_memsuper (memsuper); - return 0; - } - - __auto_type set = QFV_AllocImages (create.count, malloc); - for (uint32_t i = 0; i < create.count; i++) { - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseImageSet: %d", PL_Line (item))); - dfunc->vkCreateImage (device->dev, &create.info[i], 0, &set->a[i]); - - const char *name = PL_KeyAtIndex (item, i); - QFV_duSetObjectName (device, VK_OBJECT_TYPE_IMAGE, set->a[i], - va (ctx->va_ctx, "image:%s", name)); - qfvPopDebug (ctx); - name = resource_path (ctx, "images", name); - QFV_AddHandle (sctx->images, name, (uint64_t) set->a[i]); - } - - delete_memsuper (memsuper); - return set; -} - -qfv_imageviewset_t * -QFV_ParseImageViewSet (vulkan_ctx_t *ctx, plitem_t *item, - plitem_t *properties) -{ - scriptctx_t *sctx = ctx->script_context; - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - imageviewcreate_t create = {}; - - pltype_t type = PL_Type (item); - - if (type == QFDictionary) { - if (!parse_object (ctx, memsuper, item, parse_imageviewcreate_dict, - &create, properties)) { - delete_memsuper (memsuper); - return 0; - } - } else { - Sys_Printf ("Neither array nor dictionary: %d\n", PL_Line (item)); - delete_memsuper (memsuper); - return 0; - } - - __auto_type set = QFV_AllocImageViews (create.count, malloc); - for (uint32_t i = 0; i < create.count; i++) { - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseImageViewSet: %d", PL_Line (item))); - dfunc->vkCreateImageView (device->dev, &create.info[i], 0, &set->a[i]); - qfvPopDebug (ctx); - - const char *name = PL_KeyAtIndex (item, i); - name = resource_path (ctx, "imageViews", name); - QFV_AddHandle (sctx->imageViews, name, (uint64_t) set->a[i]); - } - - delete_memsuper (memsuper); - return set; -} - -VkFramebuffer -QFV_ParseFramebuffer (vulkan_ctx_t *ctx, plitem_t *plist, plitem_t *properties) -{ - qfv_device_t *device = ctx->device; - qfv_devfuncs_t *dfunc = device->funcs; - memsuper_t *memsuper = new_memsuper (); - - VkFramebufferCreateInfo cInfo = {}; - - if (!parse_object (ctx, memsuper, plist, parse_VkFramebufferCreateInfo, - &cInfo, properties)) { - delete_memsuper (memsuper); - return 0; - } - - VkFramebuffer framebuffer; - qfvPushDebug (ctx, va (ctx->va_ctx, "QFV_ParseFramebuffer: %d", PL_Line (plist))); - dfunc->vkCreateFramebuffer (device->dev, &cInfo, 0, &framebuffer); - qfvPopDebug (ctx); - Sys_MaskPrintf (SYS_vulkan_parse, "framebuffer, renderPass: %#zx, %#zx\n", - (size_t) framebuffer, (size_t) cInfo.renderPass); - - delete_memsuper (memsuper); - return framebuffer; -} - -static int -parse_rgba (const plfield_t *field, const plitem_t *item, void *data, - plitem_t *messages, void *context) -{ - return parse_RGBA (item, &data, messages, context); -} - -int -QFV_ParseRGBA (vulkan_ctx_t *ctx, float *rgba, plitem_t *plist, - plitem_t *properties) -{ - memsuper_t *memsuper = new_memsuper (); - int ret = 0; - vec4f_t color; - - if (parse_object (ctx, memsuper, plist, parse_rgba, &color, properties)) { - memcpy (rgba, &color, sizeof (color)); - ret = 1; - } - delete_memsuper (memsuper); - return ret; -} - int QFV_ParseOutput (vulkan_ctx_t *ctx, qfv_output_t *output, plitem_t *plist, plitem_t *properties) @@ -1886,23 +1246,6 @@ delete_configs (void) free (builtin_plists); } -static plitem_t * -qfv_load_pipeline (vulkan_ctx_t *ctx, const char *name) -{ - scriptctx_t *sctx = ctx->script_context; - if (!sctx->pipelineDef) { - sctx->pipelineDef = Vulkan_GetConfig (ctx, "quake_deferred"); - } - - plitem_t *item = sctx->pipelineDef; - if (!item || !(item = PL_ObjectForKey (item, name))) { - Sys_Printf ("error loading %s\n", name); - } else { - Sys_MaskPrintf (SYS_vulkan_parse, "Found %s def\n", name); - } - return item; -} - plitem_t * Vulkan_GetConfig (vulkan_ctx_t *ctx, const char *name) { @@ -1997,32 +1340,6 @@ void Vulkan_Script_SetOutput (vulkan_ctx_t *ctx, qfv_output_t *output) sctx->output = *output; } -VkSampler -Vulkan_CreateSampler (vulkan_ctx_t *ctx, const char *name) -{ - scriptctx_t *sctx = ctx->script_context; - hashtab_t *tab = sctx->samplers; - const char *path; - path = va (ctx->va_ctx, "$"QFV_PROPERTIES".samplers.%s", name); - __auto_type sampler = (VkSampler) QFV_GetHandle (tab, path); - if (sampler) { - return sampler; - } - - plitem_t *item = qfv_load_pipeline (ctx, "samplers"); - if (!(item = PL_ObjectForKey (item, name))) { - Sys_Printf ("error loading sampler %s\n", name); - return 0; - } else { - Sys_MaskPrintf (SYS_vulkan_parse, "Found sampler def %s\n", name); - } - sampler = QFV_ParseSampler (ctx, item, sctx->pipelineDef); - QFV_AddHandle (tab, path, (uint64_t) sampler); - QFV_duSetObjectName (ctx->device, VK_OBJECT_TYPE_SAMPLER, sampler, - va (ctx->va_ctx, "sampler:%s", name)); - return sampler; -} - exprtab_t * QFV_CreateSymtab (plitem_t *dict, const char *properties, const char **extra_items, exprsym_t *extra_syms, diff --git a/libs/video/renderer/vulkan/vkparse.h b/libs/video/renderer/vulkan/vkparse.h index a12be0701..edb86615a 100644 --- a/libs/video/renderer/vulkan/vkparse.h +++ b/libs/video/renderer/vulkan/vkparse.h @@ -42,38 +42,6 @@ exprenum_t *QFV_GetEnum (const char *name); uint64_t QFV_GetHandle (struct hashtab_s *tab, const char *name); void QFV_AddHandle (struct hashtab_s *tab, const char *name, uint64_t handle); -VkRenderPass QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkPipeline QFV_ParseComputePipeline (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkPipeline QFV_ParseGraphicsPipeline (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkDescriptorPool QFV_ParseDescriptorPool (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkDescriptorSetLayout QFV_ParseDescriptorSetLayout (vulkan_ctx_t *ctx, - plitem_t *plist, - plitem_t *properties); -VkPipelineLayout QFV_ParsePipelineLayout (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkSampler QFV_ParseSampler (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkImage QFV_ParseImage (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -VkImageView QFV_ParseImageView (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -struct qfv_imageset_s *QFV_ParseImageSet (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); -struct qfv_imageviewset_s *QFV_ParseImageViewSet (vulkan_ctx_t *ctx, - plitem_t *plist, - plitem_t *properties); -VkFramebuffer QFV_ParseFramebuffer (vulkan_ctx_t *ctx, plitem_t *plist, - plitem_t *properties); - -struct qfv_subpassset_s *QFV_ParseSubpasses (vulkan_ctx_t *ctx, - plitem_t *plist, - plitem_t *properties); -int QFV_ParseRGBA (vulkan_ctx_t *ctx, float *rgba, plitem_t *plist, - plitem_t *properties); int QFV_ParseOutput (vulkan_ctx_t *ctx, qfv_output_t *output, plitem_t *plist, plitem_t *properties); exprtab_t *QFV_CreateSymtab (plitem_t *dict, const char *properties, diff --git a/libs/video/renderer/vulkan/vkparse.plist b/libs/video/renderer/vulkan/vkparse.plist index be33db563..7d8212c2f 100644 --- a/libs/video/renderer/vulkan/vkparse.plist +++ b/libs/video/renderer/vulkan/vkparse.plist @@ -1,9 +1,6 @@ search = ( - VkAttachmentDescription, VkDebugUtilsMessageSeverityFlagBitsEXT, VkPresentModeKHR, - VkSubpassDescription, - VkSubpassDependency, VkSpecializationInfo, VkPipelineShaderStageCreateInfo, VkPipelineVertexInputStateCreateInfo, @@ -15,19 +12,8 @@ search = ( VkPipelineColorBlendStateCreateInfo, VkPipelineDynamicStateCreateInfo, VkDescriptorSetLayoutBinding, - VkDescriptorSetLayoutCreateInfo, - VkPushConstantRange, - VkPipelineLayoutCreateInfo, - VkGraphicsPipelineCreateInfo, - VkComputePipelineCreateInfo, - VkDescriptorPoolCreateInfo, - VkSamplerCreateInfo, - VkImageCreateInfo, - VkImageViewCreateInfo, - VkFramebufferCreateInfo, VkClearValue, VkPhysicalDeviceLimits, - VkRenderPassCreateInfo, VkRenderPassMultiviewCreateInfo, qfv_output_t, @@ -58,53 +44,7 @@ search = ( qfv_samplerinfo_t, ); parse = { - VkSubpassDescription = { - flags = auto; - pipelineBindPoint = auto; - inputAttachments = { - type = (array, VkAttachmentReference); - size = inputAttachmentCount; - values = pInputAttachments; - }; - colorAttachments = { - type = (array, VkAttachmentReference); - size = colorAttachmentCount; - values = pColorAttachments; - }; - resolveAttachments = { - type = (array, VkAttachmentReference); - values = pResolveAttachments; - matchSize = colorAttachments; - }; - depthStencilAttachment = { - type = (single, VkAttachmentReference); - value = pDepthStencilAttachment; - }; - preserveAttachments = { - type = (array, uint32_t); - size = preserveAttachmentCount; - values = pPreserveAttachments; - }; - }; VkPhysicalDeviceLimits = readonly; - VkRenderPassCreateInfo = { - //flags = auto; reserved for future use (Bits enum does not exist) - attachments = { - type = (array, VkAttachmentDescription); - size = attachmentCount; - values = pAttachments; - }; - subpasses = { - type = (array, VkSubpassDescription); - size = subpassCount; - values = pSubpasses; - }; - dependencies = { - type = (array, VkSubpassDependency); - size = dependencyCount; - values = pDependencies; - }; - }; VkSpecializationInfo = { mapEntries = { type = (array, VkSpecializationMapEntry); @@ -141,23 +81,6 @@ parse = { stageFlags = auto; // skip pImmutableSamplers (default to 0) until I know how it works }; - VkDescriptorSetLayoutCreateInfo = { - flags = auto; - bindings = { - type = (array, VkDescriptorSetLayoutBinding); - size = bindingCount; - 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 = { @@ -246,140 +169,10 @@ parse = { values = pDynamicStates; }; }; - VkPipelineLayoutCreateInfo = { - //flags = auto; reserved for future use (Bits enum does not exist) - setLayouts = { - type = (array, { - parse_type = (QFDictionary, QFString); - type = VkDescriptorSetLayout; - parser = parse_VkDescriptorSetLayout; - }); - size = setLayoutCount; - values = pSetLayouts; - }; - pushConstantRanges = { - type = (array, VkPushConstantRange); - size = pushConstantRangeCount; - values = pPushConstantRanges; - }; - }; VkPipelineTessellationStateCreateInfo = { //flags = auto; reserved for future use (Bits enum does not exist) patchControlPoints = auto; }; - VkGraphicsPipelineCreateInfo = { - flags = auto; - stages = { - type = (array, VkPipelineShaderStageCreateInfo); - size = stageCount; - values = pStages; - }; - vertexInput = { - type = (single, VkPipelineVertexInputStateCreateInfo); - value = pVertexInputState; - }; - inputAssembly = { - type = (single, VkPipelineInputAssemblyStateCreateInfo); - value = pInputAssemblyState; - }; - tessellation = { - type = (single, VkPipelineTessellationStateCreateInfo); - value = pTessellationState; - }; - viewport = { - type = (single, VkPipelineViewportStateCreateInfo); - value = pViewportState; - }; - rasterization = { - type = (single, VkPipelineRasterizationStateCreateInfo); - value = pRasterizationState; - }; - multisample = { - type = (single, VkPipelineMultisampleStateCreateInfo); - value = pMultisampleState; - }; - depthStencil = { - type = (single, VkPipelineDepthStencilStateCreateInfo); - value = pDepthStencilState; - }; - colorBlend = { - type = (single, VkPipelineColorBlendStateCreateInfo); - value = pColorBlendState; - }; - dynamic = { - type = (single, VkPipelineDynamicStateCreateInfo); - value = pDynamicState; - }; - layout = { - type = (custom, QFString, parse_VkPipelineLayout); - fields = (layout); - }; - renderPass = { - type = (custom, QFString, parse_VkRenderPass); - fields = (renderPass); - }; - subpass = auto; - basePipelineHandle = { - type = (custom, QFString, parse_BasePipeline); - fields = (basePipelineHandle); - }; - basePipelineIndex = auto; - }; - VkComputePipelineCreateInfo = { - flags = auto; - stage = auto; - layout = { - type = (custom, QFString, parse_VkPipelineLayout); - fields = (layout); - }; - basePipelineHandle = { - type = (custom, QFString, parse_BasePipeline); - fields = (basePipelineHandle); - }; - basePipelineIndex = auto; - }; - VkImageCreateInfo = { - flags = auto; - imageType = auto; - format = auto; - extent = auto; - mipLevels = auto; - arrayLayers = auto; - samples = auto; - tiling = auto; - usage = auto; - sharingMode = skip; // FIXME for now - queueFamilyIndexCount = skip; // FIXME for now - pQueueFamilyIndices = skip; // FIXME for now - initialLayout = auto; - }; - VkImageViewCreateInfo = { - flags = auto; - image = { - type = (custom, (QFDictionary, QFString), - parse_VkImage); - fields = (image); - }; - viewType = auto; - format = auto; - components = auto; - subresourceRange = auto; - }; - VkFramebufferCreateInfo = { - //flags = auto; reserved for future use (Bits enum does not exist) - renderPass = { - type = (custom, QFString, parse_VkRenderPass); - fields = (renderPass); - }; - attachments = { - type = (array, VkImageView); - size = attachmentCount; - values = pAttachments; - }; - width = auto; - height = auto; - layers = auto; - }; VkClearColorValue = skip; VkClearValue = { color = { @@ -406,28 +199,19 @@ parse = { }; }; - qfv_osubpass_s = { - .name = qfv_osubpass_t; - color = { - type = (custom, QFString, parse_RGBA); - fields = (color); - }; - name = { - type = string; - string = name; - }; - }; qfv_output_s = { .name = qfv_output_t; extent = auto; - image = { + image = ignore; + view = ignore; +/* image = { type = (readonly, VkImage); value = image; }; view = { type = (readonly, VkImageView); value = view; - }; + };*/ format = auto; frames = auto; finalLayout = auto;