From 2f941ff9dd52141d68dd22c5c20dc3e731db2b24 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 22 Jan 2025 20:26:11 +0900 Subject: [PATCH] [qfcc] Clear the function queue immediately The function queue needs to be cleared before figuring out the interface symbols otherwise the variables referenced only by called functions will not get into the list of interface symbols. --- tools/qfcc/source/target_spirv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/qfcc/source/target_spirv.c b/tools/qfcc/source/target_spirv.c index 354d424d3..e20c4c6fb 100644 --- a/tools/qfcc/source/target_spirv.c +++ b/tools/qfcc/source/target_spirv.c @@ -838,6 +838,11 @@ spirv_EntryPoint (entrypoint_t *entrypoint, spirvctx_t *ctx) } unsigned func_id = spirv_function (entrypoint->func, ctx); + while (ctx->func_queue.size) { + auto func = DARRAY_REMOVE (&ctx->func_queue); + spirv_function (func, ctx); + } + int len = strlen (entrypoint->name) + 1; int iface_start = 3 + RUP(len, 4) / 4; auto linkage = ctx->module->entry_point_space; @@ -2047,10 +2052,6 @@ spirv_write (struct pr_info_s *pr, const char *filename) for (auto ep = pr->module->entry_points; ep; ep = ep->next) { spirv_EntryPoint (ep, &ctx); - while (ctx.func_queue.size) { - auto func = DARRAY_REMOVE (&ctx.func_queue); - spirv_function (func, &ctx); - } } auto mod = pr->module;