diff --git a/include/QF/cexpr.h b/include/QF/cexpr.h index 77e5b0463..ac6eef683 100644 --- a/include/QF/cexpr.h +++ b/include/QF/cexpr.h @@ -94,7 +94,7 @@ typedef struct exprctx_s { struct memsuper_s *memsuper; const struct plitem_s *item; struct plitem_s *messages; - struct hashlink_s *hashlinks; + struct hashlink_s **hashlinks; int errors; } exprctx_t; diff --git a/libs/util/cexpr-vars.c b/libs/util/cexpr-vars.c index 6ec8ce3d9..115f0ba64 100644 --- a/libs/util/cexpr-vars.c +++ b/libs/util/cexpr-vars.c @@ -128,7 +128,7 @@ void cexpr_init_symtab (exprtab_t *symtab, exprctx_t *ctx) { exprsym_t *sym; - symtab->tab = Hash_NewTable (61, expr_getkey, 0, 0, &ctx->hashlinks); + symtab->tab = Hash_NewTable (61, expr_getkey, 0, 0, ctx->hashlinks); for (sym = symtab->symbols; sym->name; sym++) { Hash_Add (symtab->tab, sym); } diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index 55192ad36..394a402d9 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -513,7 +513,7 @@ QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist) exprctx.external_variables = &vars_tab; exprctx.memsuper = new_memsuper (); exprctx.messages = messages; - exprctx.hashlinks = ctx->hashlinks; + exprctx.hashlinks = &ctx->hashlinks; cexpr_init_symtab (&vars_tab, &exprctx); @@ -526,7 +526,6 @@ QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist) } PL_Free (messages); delete_memsuper (exprctx.memsuper); - ctx->hashlinks = exprctx.hashlinks; renderpass = QFV_CreateRenderPass (device, renderpass_data.attachments, @@ -556,17 +555,17 @@ QFV_ParseResources (vulkan_ctx_t *ctx, plitem_t *pipelinedef) exprctx.memsuper = new_memsuper (); exprctx.messages = messages; - exprctx.hashlinks = ctx->hashlinks; + exprctx.hashlinks = &ctx->hashlinks; if (!ctx->setLayouts) { ctx->shaderModules = Hash_NewTable (23, handleref_getkey, shaderModule_free, - ctx, &exprctx.hashlinks); + ctx, &ctx->hashlinks); ctx->setLayouts = Hash_NewTable (23, handleref_getkey, setLayout_free, - ctx, &exprctx.hashlinks); + ctx, &ctx->hashlinks); ctx->pipelineLayouts = Hash_NewTable (23, handleref_getkey, pipelineLayout_free, - ctx, &exprctx.hashlinks); + ctx, &ctx->hashlinks); } for (parseres_t *res = parse_resources; res->name; res++) { @@ -586,7 +585,6 @@ QFV_ParseResources (vulkan_ctx_t *ctx, plitem_t *pipelinedef) PL_Free (messages); delete_memsuper (exprctx.memsuper); - ctx->hashlinks = exprctx.hashlinks; } static const char * @@ -597,11 +595,12 @@ enum_symtab_getkey (const void *e, void *unused) } void -QFV_InitParse (void) +QFV_InitParse (vulkan_ctx_t *ctx) { exprctx_t context = {}; enum_symtab = Hash_NewTable (61, enum_symtab_getkey, 0, 0, - &context.hashlinks); + &ctx->hashlinks); + context.hashlinks = &ctx->hashlinks; vkgen_init_symtabs (&context); } diff --git a/libs/video/renderer/vulkan/vkparse.h b/libs/video/renderer/vulkan/vkparse.h index e63bb44e2..e4fe36774 100644 --- a/libs/video/renderer/vulkan/vkparse.h +++ b/libs/video/renderer/vulkan/vkparse.h @@ -25,7 +25,7 @@ typedef struct handleref_s { VkRenderPass QFV_ParseRenderPass (vulkan_ctx_t *ctx, plitem_t *plist); void QFV_ParseResources (vulkan_ctx_t *ctx, plitem_t *plist); -void QFV_InitParse (void); +void QFV_InitParse (vulkan_ctx_t *ctx); exprenum_t *QFV_GetEnum (const char *name); #endif//__vkparse_h diff --git a/libs/video/renderer/vulkan/vulkan_vid_common.c b/libs/video/renderer/vulkan/vulkan_vid_common.c index fc0a97edf..af24c78eb 100644 --- a/libs/video/renderer/vulkan/vulkan_vid_common.c +++ b/libs/video/renderer/vulkan/vulkan_vid_common.c @@ -140,7 +140,7 @@ void Vulkan_Init_Common (vulkan_ctx_t *ctx) { Sys_Printf ("Vulkan_Init_Common\n"); - QFV_InitParse (); + QFV_InitParse (ctx); Vulkan_Init_Cvars (); ctx->instance = QFV_CreateInstance (ctx, PACKAGE_STRING, 0x000702ff, 0, instance_extensions);//FIXME version } @@ -149,8 +149,9 @@ static void clear_table (hashtab_t **table) { if (*table) { - Hash_DelTable (*table); + hashtab_t *tab = *table; *table = 0; + Hash_DelTable (tab); } } @@ -166,11 +167,11 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx) if (ctx->swapchain) { QFV_DestroySwapchain (ctx->swapchain); } + ctx->instance->funcs->vkDestroySurfaceKHR (ctx->instance->instance, + ctx->surface, 0); clear_table (&ctx->pipelineLayouts); clear_table (&ctx->setLayouts); clear_table (&ctx->shaderModules); - ctx->instance->funcs->vkDestroySurfaceKHR (ctx->instance->instance, - ctx->surface, 0); if (ctx->device) { QFV_DestroyDevice (ctx->device); }