mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 01:42:04 +00:00
[qfcc] Process block result even when independent
If the block's result is just a variable reference, it won't match any expression in the block's list so it needs to be processed independently in such cases. The `mix(genFType x, genFType y, float a)` inline now gets as far as spir-v code gen although there are still many issues to fix (parameter symbols, `return` handling, etc).
This commit is contained in:
parent
5b13bcf11c
commit
5380c2b04c
2 changed files with 19 additions and 0 deletions
|
@ -486,6 +486,18 @@ print_xvalue (dstring_t *dstr, const expr_t *e, int level, int id,
|
|||
b, '=', a, e->loc.line);
|
||||
}
|
||||
|
||||
static void
|
||||
print_process (dstring_t *dstr, const expr_t *e, int level, int id,
|
||||
const expr_t *next)
|
||||
{
|
||||
int indent = level * 2 + 2;
|
||||
|
||||
_print_expr (dstr, e->process.expr, level, id, next);
|
||||
dasprintf (dstr, "%*se_%p -> \"e_%p\";\n", indent, "", e, e->process.expr);
|
||||
dasprintf (dstr, "%*se_%p [label=\"%s\\n%d\"];\n", indent, "", e,
|
||||
"<process>", e->loc.line);
|
||||
}
|
||||
|
||||
static void
|
||||
print_subexpr (dstring_t *dstr, const expr_t *e, int level, int id, const expr_t *next)
|
||||
{
|
||||
|
@ -947,6 +959,7 @@ _print_expr (dstring_t *dstr, const expr_t *e, int level, int id,
|
|||
[ex_select] = print_select,
|
||||
[ex_intrinsic] = print_intrinsic,
|
||||
[ex_xvalue] = print_xvalue,
|
||||
[ex_process] = print_process,
|
||||
};
|
||||
int indent = level * 2 + 2;
|
||||
|
||||
|
|
|
@ -270,6 +270,12 @@ proc_block (const expr_t *expr, rua_ctx_t *ctx)
|
|||
current_symtab = old_scope;
|
||||
return err;
|
||||
}
|
||||
if (!result && expr->block.result) {
|
||||
result = expr_process (expr->block.result, ctx);
|
||||
if (is_error (result)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
scoped_src_loc (expr);
|
||||
auto block = new_block_expr (nullptr);
|
||||
|
|
Loading…
Reference in a new issue