mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
nir/lower_shader_calls: Fix cursor if broken after nir_cf_extract() call
Fixes:e2dadda3("Revert "nir/lower_shader_calls: put inserted instructions into a dummy block") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8978 Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22884> (cherry picked from commit08e95f8f8e)
This commit is contained in:
parent
d98d6e0e1c
commit
8cf5581e92
2 changed files with 16 additions and 1 deletions
|
|
@ -2524,7 +2524,7 @@
|
|||
"description": "nir/lower_shader_calls: Fix cursor if broken after nir_cf_extract() call",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "e2dadda35f87af08358f0ea43a12434c1626ea82"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1115,6 +1115,21 @@ found_resume:
|
|||
nir_after_cf_list(child_list));
|
||||
}
|
||||
|
||||
/* If the resume instruction is in the first block of the child_list,
|
||||
* and the cursor is still before that block, the nir_cf_extract() may
|
||||
* extract the block object pointed by the cursor, and instead create
|
||||
* a new one for the code before the resume. In such case the cursor
|
||||
* will be broken, as it will point to a block which is no longer
|
||||
* in a function.
|
||||
*
|
||||
* Luckily, in both cases when this is possible, the intended cursor
|
||||
* position is right before the child_list, so we can fix the cursor here.
|
||||
*/
|
||||
if (child_list_contains_cursor &&
|
||||
b->cursor.option == nir_cursor_before_block &&
|
||||
b->cursor.block->cf_node.parent == NULL)
|
||||
b->cursor = nir_before_cf_list(child_list);
|
||||
|
||||
if (cursor_is_after_jump(b->cursor)) {
|
||||
/* If the resume instruction is in a loop, it's possible cf_list ends
|
||||
* in a break or continue instruction, in which case we don't want to
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue