mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-11 20:03:11 +00:00
[qfcc] Implement spir-v assignment to vars
Since actual variables are always references, they need to written via OpStore.
This commit is contained in:
parent
6e5b13c6f6
commit
5bf9d3c57c
3 changed files with 14 additions and 1 deletions
|
@ -862,6 +862,8 @@ bool is_math_op (int op) __attribute__((const));
|
|||
*/
|
||||
bool is_logic (int op) __attribute__((const));
|
||||
|
||||
bool is_deref (const expr_t *e) __attribute__((pure));
|
||||
|
||||
bool has_function_call (const expr_t *e) __attribute__((pure));
|
||||
bool is_function_call (const expr_t *e) __attribute__((pure));
|
||||
|
||||
|
|
|
@ -1874,6 +1874,12 @@ is_logic (int op)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
is_deref (const expr_t *e)
|
||||
{
|
||||
return e->type == ex_uexpr && e->expr.op == '.';
|
||||
}
|
||||
|
||||
bool
|
||||
has_function_call (const expr_t *e)
|
||||
{
|
||||
|
|
|
@ -796,7 +796,12 @@ static unsigned
|
|||
spirv_assign (const expr_t *e, spirvctx_t *ctx)
|
||||
{
|
||||
unsigned src = spirv_emit_expr (e->assign.src, ctx);
|
||||
unsigned dst = spirv_emit_expr (e->assign.dst, ctx);
|
||||
unsigned dst = 0;
|
||||
|
||||
if (is_deref (e->assign.dst)) {
|
||||
auto ptr = e->assign.dst->expr.e1;
|
||||
dst = spirv_emit_expr (ptr, ctx);
|
||||
}
|
||||
|
||||
if (!dst) return src;//FIXME workaround for temp
|
||||
|
||||
|
|
Loading…
Reference in a new issue