#define SWIZ(X, Y, Z, W) \
(unsigned[4]){ SWIZZLE_##X, SWIZZLE_##Y, SWIZZLE_##Z, SWIZZLE_##W }
-#define ptn_swizzle(b, src, x, y, z, w) nir_swizzle(b, src, SWIZ(x, y, z, w), 4, true)
#define ptn_channel(b, src, ch) nir_swizzle(b, src, SWIZ(ch, ch, ch, ch), 1, true)
static nir_ssa_def *
ptn_move_dest_masked(b, dest,
nir_fsub(b,
nir_fmul(b,
- ptn_swizzle(b, src[0], Y, Z, X, X),
- ptn_swizzle(b, src[1], Z, X, Y, X)),
+ nir_swizzle(b, src[0], SWIZ(Y, Z, X, W), 3, true),
+ nir_swizzle(b, src[1], SWIZ(Z, X, Y, W), 3, true)),
nir_fmul(b,
- ptn_swizzle(b, src[1], Y, Z, X, X),
- ptn_swizzle(b, src[0], Z, X, Y, X))),
+ nir_swizzle(b, src[1], SWIZ(Y, Z, X, W), 3, true),
+ nir_swizzle(b, src[0], SWIZ(Z, X, Y, W), 3, true))),
WRITEMASK_XYZ);
ptn_move_dest_masked(b, dest, nir_imm_float(b, 1.0), WRITEMASK_W);
}
unsigned src_number = 0;
instr->src[src_number].src =
- nir_src_for_ssa(ptn_swizzle(b, src[0], X, Y, Z, W));
+ nir_src_for_ssa(nir_swizzle(b, src[0], SWIZ(X, Y, Z, W),
+ instr->coord_components, true));
instr->src[src_number].src_type = nir_tex_src_coord;
src_number++;