diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-02 11:06:21 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-12 12:42:59 -0700 |
commit | fa68740187cfd6938bd5a64f295efe19915856b6 (patch) | |
tree | 60d4034639d67ac8650077610ba8c0d15138ce79 /src | |
parent | 60d80157d17a015d54c117e2e488b3272174cee5 (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')
-rw-r--r-- | src/panfrost/midgard/compiler.h | 3 | ||||
-rw-r--r-- | src/panfrost/midgard/midgard_compile.c | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index da9e17f29c3..c466ad6a3ab 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -535,6 +535,9 @@ emit_ubo_read( unsigned index); void +emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override); + +void midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr); void 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"); |