nir/lower_point_size_mov: handle case where gl_Position isn't written

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821>
This commit is contained in:
Mike Blumenkrantz
2022-04-08 12:45:06 -04:00
committed by Marge Bot
parent cfca760d6e
commit 9c212e117d
@@ -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 |