radeonsi: fix blits via util_blitter_draw_rectangle

It didn't save states properly. The only correct place to save them is
si_blitter_begin. Unfortunately, we can't skip saving and restoring
those states because we don't know in advance whether the rectangle path
will be used.

Cc: mesa-stable
Reviewed-by: Pierre-Eric
(cherry picked from commit 556ceb1b75)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
Marek Olšák 2026-03-25 13:30:02 -04:00 committed by Eric Engestrom
parent 5e538b5efd
commit a20678b267
4 changed files with 5 additions and 3 deletions

View file

@ -1374,7 +1374,7 @@
"description": "radeonsi: fix blits via util_blitter_draw_rectangle",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -26,6 +26,9 @@ enum
void si_blitter_begin(struct si_context *sctx, enum si_blitter_op op)
{
util_blitter_save_vertex_buffers(sctx->blitter, sctx->vertex_buffer,
sctx->vertex_elements->num_vertex_buffers);
util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
util_blitter_save_vertex_shader(sctx->blitter, sctx->shader.vs.cso);
util_blitter_save_tessctrl_shader(sctx->blitter, sctx->shader.tcs.cso);
util_blitter_save_tesseval_shader(sctx->blitter, sctx->shader.tes.cso);
@ -34,6 +37,7 @@ void si_blitter_begin(struct si_context *sctx, enum si_blitter_op op)
util_blitter_save_so_targets(sctx->blitter, sctx->streamout.num_targets,
(struct pipe_stream_output_target **)sctx->streamout.targets,
sctx->streamout.output_prim);
util_blitter_save_viewport(sctx->blitter, &sctx->viewports.states[0]);
util_blitter_save_rasterizer(sctx->blitter, sctx->queued.named.rasterizer);
if (op & SI_SAVE_FRAGMENT_STATE) {

View file

@ -700,7 +700,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
mesa_loge("can't create blitter");
goto fail;
}
sctx->blitter->skip_viewport_restore = true;
/* Some states are expected to be always non-NULL. */
sctx->noop_blend = util_blitter_get_noop_blend_state(sctx->blitter);

View file

@ -2600,7 +2600,6 @@ static void si_draw_rectangle(struct blitter_context *blitter, void *vertex_elem
if (MAX2(abs(x1), abs(x2)) > INT16_MAX || MAX2(abs(y1), abs(y2)) > INT16_MAX) {
/* Fallback when coordinates can't fit in int16. */
util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
util_blitter_draw_rectangle(blitter, vertex_elements_cso, get_vs, x1, y1, x2, y2,
depth, num_instances, type, attrib);
return;