diff options
author | Rob Clark <[email protected]> | 2017-05-15 16:42:15 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-05-16 16:34:21 -0400 |
commit | da9a1cb8a684cf4a30e6c292a80e7cab4c89482d (patch) | |
tree | 657e5a2d189f5f114e1b5dc21957fd960f23baa2 /src/gallium/drivers/freedreno/ir3 | |
parent | 8b4588b090826a2da7c1b99497ed07705b149ae1 (diff) |
freedreno/ir3: fix crash with atomics
Atomics can have a result value. And sometimes it is even used.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index dfebb62b16b..a6908033ab3 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -1248,7 +1248,7 @@ emit_intrinsic_store_ssbo(struct ir3_compile *ctx, nir_intrinsic_instr *intr) array_insert(b, b->keeps, stgb); } -static void +static struct ir3_instruction * emit_intrinsic_atomic(struct ir3_compile *ctx, nir_intrinsic_instr *intr) { struct ir3_block *b = ctx->block; @@ -1324,6 +1324,8 @@ emit_intrinsic_atomic(struct ir3_compile *ctx, nir_intrinsic_instr *intr) /* even if nothing consume the result, we can't DCE the instruction: */ array_insert(b, b->keeps, atomic); + + return atomic; } static void add_sysval_input_compmask(struct ir3_compile *ctx, @@ -1438,7 +1440,12 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr) case nir_intrinsic_ssbo_atomic_xor: case nir_intrinsic_ssbo_atomic_exchange: case nir_intrinsic_ssbo_atomic_comp_swap: - emit_intrinsic_atomic(ctx, intr); + if (info->has_dest) { + compile_assert(ctx, intr->num_components == 1); + dst[0] = emit_intrinsic_atomic(ctx, intr); + } else { + emit_intrinsic_atomic(ctx, intr); + } break; case nir_intrinsic_store_output: idx = nir_intrinsic_base(intr); |