aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/midgard_compile.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-02 11:06:21 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-12 12:42:59 -0700
commitfa68740187cfd6938bd5a64f295efe19915856b6 (patch)
tree60d4034639d67ac8650077610ba8c0d15138ce79 /src/panfrost/midgard/midgard_compile.c
parent60d80157d17a015d54c117e2e488b3272174cee5 (diff)
pan/midgard: Allow sysval destination override
Sometimes a sysval is used to facilitate an instruction but is not the instruction itself. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/midgard_compile.c')
-rw-r--r--src/panfrost/midgard/midgard_compile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index c3752784b6b..c0eedb8e1f0 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1218,8 +1218,8 @@ emit_varying_read(
emit_mir_instruction(ctx, ins);
}
-static void
-emit_sysval_read(compiler_context *ctx, nir_instr *instr)
+void
+emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override)
{
unsigned dest = 0;
@@ -1227,6 +1227,9 @@ emit_sysval_read(compiler_context *ctx, nir_instr *instr)
int sysval = sysval_for_instr(ctx, instr, &dest);
void *val = _mesa_hash_table_u64_search(ctx->sysval_to_id, sysval);
+ if (dest_override >= 0)
+ dest = dest_override;
+
/* Sysvals are prefix uniforms */
unsigned uniform = ((uintptr_t) val) - 1;
@@ -1437,7 +1440,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
case nir_intrinsic_load_viewport_scale:
case nir_intrinsic_load_viewport_offset:
- emit_sysval_read(ctx, &instr->instr);
+ emit_sysval_read(ctx, &instr->instr, -1);
break;
default:
@@ -1664,7 +1667,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr)
emit_texop_native(ctx, instr, TEXTURE_OP_TEXEL_FETCH);
break;
case nir_texop_txs:
- emit_sysval_read(ctx, &instr->instr);
+ emit_sysval_read(ctx, &instr->instr, -1);
break;
default:
unreachable("Unhanlded texture op");