Module: Mesa Branch: main Commit: 9c212e117d59b949c01971e39f002bdb5984db60 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c212e117d59b949c01971e39f002bdb5984db60
Author: Mike Blumenkrantz <[email protected]> Date: Fri Apr 8 12:45:06 2022 -0400 nir/lower_point_size_mov: handle case where gl_Position isn't written Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821> --- src/compiler/nir/nir_lower_point_size_mov.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_lower_point_size_mov.c b/src/compiler/nir/nir_lower_point_size_mov.c index 0fd8ecafaf1..3ef938e59ec 100644 --- a/src/compiler/nir/nir_lower_point_size_mov.c +++ b/src/compiler/nir/nir_lower_point_size_mov.c @@ -65,6 +65,7 @@ lower_impl(nir_function_impl *impl, b.cursor = nir_before_cf_list(&impl->body); nir_copy_var(&b, new_out, in); } else { + bool found = false; nir_foreach_block_safe(block, impl) { nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) { @@ -74,11 +75,16 @@ lower_impl(nir_function_impl *impl, if (var == out) { b.cursor = nir_after_instr(instr); nir_copy_var(&b, new_out ? new_out : out, in); + found = true; } } } } } + if (!found) { + b.cursor = nir_before_cf_list(&impl->body); + nir_copy_var(&b, new_out, in); + } } nir_metadata_preserve(impl, nir_metadata_block_index |
