From 76fcc2f1a95896a379e56560c7f87d3a7b4c9302 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 9 Jan 2025 17:49:20 +0900 Subject: [PATCH] [qfcc] Support nil expressions in spir-v --- tools/qfcc/source/target_spirv.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/qfcc/source/target_spirv.c b/tools/qfcc/source/target_spirv.c index 4bf3dd9ed..3daca95b2 100644 --- a/tools/qfcc/source/target_spirv.c +++ b/tools/qfcc/source/target_spirv.c @@ -1276,6 +1276,18 @@ spirv_matrix_value (const ex_value_t *value, spirvctx_t *ctx) return id; } +static unsigned +spirv_nil (const expr_t *e, spirvctx_t *ctx) +{ + unsigned tid = type_id (e->nil, ctx); + unsigned id = spirv_id (ctx); + auto globals = ctx->module->globals; + auto insn = spirv_new_insn (SpvOpConstantNull, 3, globals); + INSN (insn, 1) = tid; + INSN (insn, 2) = id; + return id; +} + static unsigned spirv_value (const expr_t *e, spirvctx_t *ctx) { @@ -1798,6 +1810,7 @@ spirv_emit_expr (const expr_t *e, spirvctx_t *ctx) [ex_uexpr] = spirv_uexpr, [ex_symbol] = spirv_symbol, [ex_temp] = spirv_temp,//FIXME don't want + [ex_nil] = spirv_nil, [ex_value] = spirv_value, [ex_vector] = spirv_vector, [ex_compound] = spirv_compound,