r300: bias presubtract fix

We need to double check that the source is indeed constant before
looking at the constant type.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Fixes: 0508db9155
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29893>
This commit is contained in:
Pavel Ondračka
2024-06-25 11:27:47 +02:00
committed by Marge Bot
parent 5d367aba7b
commit 1cad339409
@@ -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++) {