From 4ca6b1dfd1055f7eb1679deb3e7194c19e4584e8 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sat, 13 Apr 2019 12:25:57 +0200 Subject: [PATCH] st/nine: Fix SINCOS input SINCOS takes an input with replicated swizzle. the swizzle can be on any component, not just x. Enable it to read from any component, but also use a temporary register to avoid dst/src aliasing. No known game is fixed by this change as it seems the input swizzle is commonly on x for this instruction, and src and dst don't alias. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/nine_shader.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index 0da60932f48..57bf5efd5dc 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1807,14 +1807,19 @@ DECL_SPECIAL(SINCOS) struct ureg_program *ureg = tx->ureg; struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]); struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]); + struct ureg_dst tmp = tx_scratch_scalar(tx); assert(!(dst.WriteMask & 0xc)); + /* Copying to a temporary register avoids src/dst aliasing. + * src is supposed to have replicated swizzle. */ + ureg_MOV(ureg, tmp, src); + /* z undefined, w untouched */ ureg_COS(ureg, ureg_writemask(dst, TGSI_WRITEMASK_X), - ureg_scalar(src, TGSI_SWIZZLE_X)); + tx_src_scalar(tmp)); ureg_SIN(ureg, ureg_writemask(dst, TGSI_WRITEMASK_Y), - ureg_scalar(src, TGSI_SWIZZLE_X)); + tx_src_scalar(tmp)); return D3D_OK; } -- 2.30.2