From de91b18be44755f2b6042a14bb608820a6bfb132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Thu, 6 Mar 2025 10:49:35 +0100 Subject: [PATCH] r300: fix INV and BIAS presubtract on R300/R400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The swizzle check was too strict, we actually don't care about the swizzle on the constant source at this point, it is only checked later whether the constant source actually has the correct form. So this effectively enables INV and BIAS presub on R300/R400. RV370 stats: total instructions in shared programs: 85379 -> 84948 (-0.50%) instructions in affected programs: 15669 -> 15238 (-2.75%) helped: 336 HURT: 81 total presub in shared programs: 1318 -> 2991 (126.93%) presub in affected programs: 797 -> 2470 (209.91%) helped: 0 HURT: 514 total omod in shared programs: 387 -> 384 (-0.78%) omod in affected programs: 9 -> 6 (-33.33%) helped: 3 HURT: 0 total temps in shared programs: 13290 -> 13243 (-0.35%) temps in affected programs: 1388 -> 1341 (-3.39%) helped: 91 HURT: 52 total consts in shared programs: 81922 -> 81855 (-0.08%) consts in affected programs: 173 -> 106 (-38.73%) helped: 67 HURT: 0 total cycles in shared programs: 126746 -> 126560 (-0.15%) cycles in affected programs: 30752 -> 30566 (-0.60%) helped: 255 HURT: 124 LOST: shaders/godot3.4/22-69.shader_test FS GAINED: shaders/ck2/172.shader_test FS GAINED: shaders/tesseract/389.shader_test FS GAINED: shaders/tesseract/393.shader_test FS GAINED: shaders/unity/64-DeferredPointShadows.shader_test FS Signed-off-by: Pavel Ondračka Part-of: --- src/gallium/drivers/r300/ci/r300-rv380-fails.txt | 1 - src/gallium/drivers/r300/compiler/radeon_optimize.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt index be321c4d0f7..db0d393cd59 100644 --- a/src/gallium/drivers/r300/ci/r300-rv380-fails.txt +++ b/src/gallium/drivers/r300/ci/r300-rv380-fails.txt @@ -38,7 +38,6 @@ dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue dEQP-GLES2.functional.shaders.loops.for_constant_iterations.mixed_break_continue_vertex,Fail dEQP-GLES2.functional.shaders.random.all_features.fragment.6,Fail dEQP-GLES2.functional.shaders.random.all_features.fragment.93,Fail -dEQP-GLES2.functional.shaders.random.all_features.fragment.97,Fail dEQP-GLES2.functional.shaders.random.trigonometric.fragment.45,Fail dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_l8_npot,Fail dEQP-GLES2.functional.texture.filtering.cube.linear_linear_clamp_rgb888_npot,Fail diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index f0cdee0838e..38ba2efd050 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -439,7 +439,8 @@ is_presub_candidate(struct radeon_compiler *c, struct rc_instruction *inst) return 0; src.File = RC_FILE_PRESUB; - if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src)) + if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, src) && + inst->U.I.SrcReg[i].File != RC_FILE_NONE) return 0; } return 1;