gallium/u_blitter: remove unused CONST declaration when using IMM

The immediate fs_clear_color shader uses IMM[0] but still declares
CONST[0][0]. That can make drivers try to read a fragment constant
buffer even though one is never uploaded on this path. Only declare
CONST[0][0] when the shader actually uses a constant buffer.

Fixes: 2ff9fa8b72 ("gallium/u_blitter: add a new fs_color_clear variant")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 79e3196320)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Pavel Ondračka 2026-04-01 17:36:27 +02:00 committed by Eric Engestrom
parent b4cfec4973
commit 18115a5df5
2 changed files with 3 additions and 2 deletions

View file

@ -1694,7 +1694,7 @@
"description": "gallium/u_blitter: remove unused CONST declaration when using IMM",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "2ff9fa8b728c5f206e19433a9d9b88eb8d97055b",
"notes": null

View file

@ -1321,7 +1321,7 @@ util_make_fs_clear_color(struct pipe_context *pipe,
"FRAG\n"
"PROPERTY FS_COLOR0_WRITES_ALL_CBUFS %u\n"
"DCL OUT[0], COLOR[0]\n"
"DCL CONST[0][0]\n"
"%s"
"IMM[0] INT32 {0, 0, 0, 0}\n"
"MOV OUT[0], %s\n"
@ -1330,6 +1330,7 @@ util_make_fs_clear_color(struct pipe_context *pipe,
snprintf(text, ARRAY_SIZE(text), text_templ,
write_all_cbufs,
use_const_buf ? "DCL CONST[0][0]\n" : "",
use_const_buf ? "CONST[0][0]" : "IMM[0]");
struct tgsi_token tokens[1000];