From ca6ceb439676a47da8f272a6cc61a995b261ae15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Wed, 26 Apr 2023 10:18:20 +0200 Subject: [PATCH] r300: fix unconditional KIL on R300/R400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0: KIL -none.1111 Negate is not allowed for texturing opcodes, so the incorrect swizzle was detected, however later optimization, where we try to rewrite incorrect swizzles from constant (immediate) registers by adding a new ones with correct order was interfering and not handling this correctly, so we ended with CONST[0] = { -1.0000 -1.0000 -1.0000 -1.0000 } 0: KIL const[0].xyz-w; Even if it would get the swizzle right, texturing opcodes can't read from constant registers, so just skip it and let this be handled by a later part which inserts an extra mov instead. Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Fixes: a8e1e5b5c2aeb7c2fb4eff2203a026090f0853b9 Part-of: (cherry picked from commit db6c3cd13ded5c4a89fb8dbfaef714432b8e1ed9) --- .pick_status.json | 2 +- src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 7c65e4abb4f..aa21b670c4e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -67,7 +67,7 @@ "description": "r300: fix unconditional KIL on R300/R400", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a8e1e5b5c2aeb7c2fb4eff2203a026090f0853b9" }, diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c index cf304db3611..cea7f859b67 100644 --- a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c @@ -580,6 +580,7 @@ void rc_dataflow_swizzles(struct radeon_compiler * c, void *user) } if (!c->is_r500 && c->Program.Constants.Count < R300_PFS_NUM_CONST_REGS && + (!opcode->HasTexture && inst->U.I.Opcode != RC_OPCODE_KIL) && try_rewrite_constant(c, reg)) { continue; }