From a35a158b093876898c1328fde25e4c6b4d0e9229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Wed, 27 Mar 2024 16:29:57 +0100 Subject: [PATCH] r300: check for the extra restrictions on presubtract swizzles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And don't use presubtract in the first place instead of relying on the dataflow swizzle pass to sort things up later. Just two shaders in shader-db hits this, but this patch prevents some regressions in dEQP when we later move presubtract after the dataflow swizzle pass. RV420: presub helped: shaders/chromeos/24.shader_test FS: 6 -> 2 (-66.67%) presub helped: shaders/chromeos/21.shader_test FS: 6 -> 2 (-66.67%) cycles helped: shaders/chromeos/24.shader_test FS: 79 -> 78 (-1.27%) cycles helped: shaders/chromeos/21.shader_test FS: 47 -> 46 (-2.13%) Signed-off-by: Pavel Ondračka Part-of: --- src/gallium/drivers/r300/compiler/radeon_compiler_util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c index 03422a37caab9..f6ecd835c34c0 100644 --- a/src/gallium/drivers/r300/compiler/radeon_compiler_util.c +++ b/src/gallium/drivers/r300/compiler/radeon_compiler_util.c @@ -431,6 +431,12 @@ unsigned int rc_inst_can_use_presub( return 0; } + struct rc_src_register test_reg = *replace_reg; + test_reg.File = RC_FILE_PRESUB; + if (!c->SwizzleCaps->IsNative(info->Opcode, test_reg)) { + return 0; + } + /* We can't allow constant swizzles from presubtract, because it is not possible * to rewrite it to a native swizzle later. */ if (!c->is_r500) {