mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 23:00:11 +01:00
nir/opt_intrinsic: fix sample mask opt with demote
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: d3ce8a7f6b ("nir: optimize gl_SampleMaskIn to gl_HelperInvocation for radeonsi when possible")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32327>
This commit is contained in:
parent
22557497ec
commit
3f26e9ca19
1 changed files with 14 additions and 0 deletions
|
|
@ -329,6 +329,20 @@ opt_intrinsics_intrin(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
if (!nir_scalar_is_const(other) || nir_scalar_as_uint(other))
|
||||
continue;
|
||||
|
||||
nir_cf_node *cf_node = &intrin->instr.block->cf_node;
|
||||
while (cf_node->parent)
|
||||
cf_node = cf_node->parent;
|
||||
|
||||
nir_function_impl *func_impl = nir_cf_node_as_function(cf_node);
|
||||
|
||||
/* We need to insert load_helper before any demote,
|
||||
* which is only possible in the entry point function
|
||||
*/
|
||||
if (func_impl != nir_shader_get_entrypoint(b->shader))
|
||||
break;
|
||||
|
||||
b->cursor = nir_before_impl(func_impl);
|
||||
|
||||
nir_def *new_expr = nir_load_helper_invocation(b, 1);
|
||||
|
||||
if (alu->op == nir_op_ine)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue