mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 14:00:16 +01:00
bifrost: Simplify derivatives a bit
Instead of two magic ternary operations, define a new `axis` temporary which is 1 for X and 2 for Y. Then define everything else in terms of this variable. In particular, the mask operation we do on LANE_ID is a mask so it makes more sense to use ~axis than 1/2 but in the other order. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15352>
This commit is contained in:
parent
c043e93ca5
commit
83010c57a6
1 changed files with 3 additions and 2 deletions
|
|
@ -2141,13 +2141,14 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
|
|||
|
||||
case nir_op_fddx:
|
||||
case nir_op_fddy: {
|
||||
unsigned axis = instr->op == nir_op_fddx ? 1 : 2;
|
||||
bi_index lane1 = bi_lshift_and_i32(b,
|
||||
bi_fau(BIR_FAU_LANE_ID, false),
|
||||
bi_imm_u32(instr->op == nir_op_fddx ? 2 : 1),
|
||||
bi_imm_u32(0x3 & ~axis),
|
||||
bi_imm_u8(0));
|
||||
|
||||
bi_index lane2 = bi_iadd_u32(b, lane1,
|
||||
bi_imm_u32(instr->op == nir_op_fddx ? 1 : 2),
|
||||
bi_imm_u32(axis),
|
||||
false);
|
||||
|
||||
bi_index left, right;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue