mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
radeonsi: add support for tgsi ATOMDEC_WRAP / ATOMINC_WRAP opcodes
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
704a6b5948
commit
8789248541
1 changed files with 23 additions and 0 deletions
|
|
@ -827,6 +827,19 @@ static void atomic_emit(
|
|||
|
||||
args.data[num_data++] =
|
||||
ac_to_integer(&ctx->ac, lp_build_emit_fetch(bld_base, inst, 2, 0));
|
||||
|
||||
if (inst->Instruction.Opcode == TGSI_OPCODE_ATOMINC_WRAP) {
|
||||
/* ATOMIC_INC instruction does:
|
||||
* value = (value + 1) % (data + 1)
|
||||
* but we want:
|
||||
* value = (value + 1) % data
|
||||
* So replace 'data' by 'data - 1'.
|
||||
*/
|
||||
args.data[0] = LLVMBuildSub(ctx->ac.builder,
|
||||
args.data[0],
|
||||
ctx->ac.i32_1, "");
|
||||
}
|
||||
|
||||
args.cache_policy = get_cache_policy(ctx, inst, true, false, false);
|
||||
|
||||
if (inst->Src[0].Register.File == TGSI_FILE_BUFFER) {
|
||||
|
|
@ -902,6 +915,12 @@ static void atomic_emit(
|
|||
case TGSI_OPCODE_ATOMUMAX: args.atomic = ac_atomic_umax; break;
|
||||
case TGSI_OPCODE_ATOMIMIN: args.atomic = ac_atomic_smin; break;
|
||||
case TGSI_OPCODE_ATOMIMAX: args.atomic = ac_atomic_smax; break;
|
||||
case TGSI_OPCODE_ATOMINC_WRAP:
|
||||
args.atomic = ac_atomic_inc_wrap;
|
||||
break;
|
||||
case TGSI_OPCODE_ATOMDEC_WRAP:
|
||||
args.atomic = ac_atomic_dec_wrap;
|
||||
break;
|
||||
default: unreachable("unhandled image atomic");
|
||||
}
|
||||
}
|
||||
|
|
@ -1821,4 +1840,8 @@ void si_shader_context_init_mem(struct si_shader_context *ctx)
|
|||
bld_base->op_actions[TGSI_OPCODE_ATOMIMIN].intr_name = "smin";
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMIMAX].emit = atomic_emit;
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMIMAX].intr_name = "smax";
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMINC_WRAP].emit = atomic_emit;
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMINC_WRAP].intr_name = "inc";
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMDEC_WRAP].emit = atomic_emit;
|
||||
bld_base->op_actions[TGSI_OPCODE_ATOMDEC_WRAP].intr_name = "dec";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue