ir3: fix emitting descriptor prefetches at end of preamble

The fix in e7ac1094f6 to emit preamble defs in the correct block would
move the cursor of the builder that is later used to insert descriptor
prefetches, emitting them at the wrong place. Fix this by resetting the
cursor before emitting the prefetches.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Fixes: e7ac1094f6 ("ir3: rematerialize preamble defs in block dominated by sources")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33399>
(cherry picked from commit 8404e7428b)
This commit is contained in:
Job Noorman 2025-02-05 12:49:26 +01:00 committed by Eric Engestrom
parent 7368b3f409
commit 62dbbe79ec
2 changed files with 3 additions and 1 deletions

View file

@ -494,7 +494,7 @@
"description": "ir3: fix emitting descriptor prefetches at end of preamble",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e7ac1094f69830cb76e622525629ace68b757a10",
"notes": null

View file

@ -752,6 +752,8 @@ ir3_nir_opt_prefetch_descriptors(nir_shader *nir, struct ir3_shader_variant *v)
preamble_defs);
}
/* ir3_rematerialize_def_for_preamble may have moved the cursor. */
b.cursor = nir_after_impl(preamble);
progress |= emit_descriptor_prefetch(&b, instr, preamble_descs, &state);
if (state.sampler.num_prefetches == MAX_PREFETCHES &&