From 9838024547b355d6abb05e4415106925881a5a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Fri, 15 Nov 2024 17:27:31 +0100 Subject: [PATCH] r300: always transform sin/cos input for fs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need to check anymore if this was already applied and it turned out the check was not working properly in the first place. The check for vs is kept in place, because that one still detects that few wine shaders already have the sin/cos input in correct range. Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/compiler/r300_nir.h | 20 ------------------- .../r300/compiler/r300_nir_algebraic.py | 4 ++-- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/r300_nir.h b/src/gallium/drivers/r300/compiler/r300_nir.h index 1bef2ab520b..e645484e8f8 100644 --- a/src/gallium/drivers/r300/compiler/r300_nir.h +++ b/src/gallium/drivers/r300/compiler/r300_nir.h @@ -129,26 +129,6 @@ needs_vs_trig_input_fixup(UNUSED struct hash_table *ht, const nir_alu_instr *ins return false; } -static inline bool -needs_fs_trig_input_fixup(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle) -{ - /* We are checking for ffract(a * (1 / 2 * pi)) pattern. */ - nir_instr *parent = instr->src[src].src.ssa->parent_instr; - if (parent->type != nir_instr_type_alu) - return true; - nir_alu_instr *fract = nir_instr_as_alu(parent); - if (fract->op != nir_op_ffract) - return true; - parent = fract->src[0].src.ssa->parent_instr; - - /* Now check for fmul(a, 1 / (2 * pi)). */ - if (!check_instr_and_src_value(nir_op_fmul, &parent, 0.1591549)) - return true; - - return false; -} - bool r300_is_only_used_as_float(const nir_alu_instr *instr); char *r300_finalize_nir(struct pipe_screen *pscreen, struct nir_shader *nir); diff --git a/src/gallium/drivers/r300/compiler/r300_nir_algebraic.py b/src/gallium/drivers/r300/compiler/r300_nir_algebraic.py index 65b5c52383d..67c1feff85c 100644 --- a/src/gallium/drivers/r300/compiler/r300_nir_algebraic.py +++ b/src/gallium/drivers/r300/compiler/r300_nir_algebraic.py @@ -27,8 +27,8 @@ transform_trig_input_vs_r500 = [ # y = frac(x / 2PI) # transform_trig_input_fs_r500 = [ - (('fsin', 'a(needs_fs_trig_input_fixup)'), ('fsin', ('ffract', ('fmul', 'a', 1 / (2 * pi))))), - (('fcos', 'a(needs_fs_trig_input_fixup)'), ('fcos', ('ffract', ('fmul', 'a', 1 / (2 * pi))))), + (('fsin', 'a'), ('fsin', ('ffract', ('fmul', 'a', 1 / (2 * pi))))), + (('fcos', 'a'), ('fcos', ('ffract', ('fmul', 'a', 1 / (2 * pi))))), ] # The is a pattern produced by wined3d for A0 register load.