From 34b1102390026b89b9fdfef729f63fff3a298690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Tue, 25 Jun 2024 11:27:47 +0200 Subject: [PATCH] r300: bias presubtract fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to double check that the source is indeed constant before looking at the constant type. Signed-off-by: Pavel Ondračka Fixes: 0508db91556242c57029ad538613c2b1ee1969ef Part-of: (cherry picked from commit 1cad339409d437ba1170725f7575b016c7c896e7) --- .pick_status.json | 2 +- src/gallium/drivers/r300/compiler/radeon_optimize.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2d7ad9fc2a5..a9d6d3d7748 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -924,7 +924,7 @@ "description": "r300: bias presubtract fix", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0508db91556242c57029ad538613c2b1ee1969ef", "notes": null diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index f11462b36ce..7900cb09e91 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -627,7 +627,10 @@ static int peephole_mad_presub_bias( if (rc_inline_to_float(src1_reg.Index) != 2.0f) return 0; } else { - struct rc_constant *constant = &c->Program.Constants.Constants[src1_reg.Index]; + if (src1_reg.File != RC_FILE_CONSTANT) + return 0; + + struct rc_constant *constant = &c->Program.Constants.Constants[src1_reg.Index]; if (constant->Type != RC_CONSTANT_IMMEDIATE) return 0; for (i = 0; i < 4; i++) {