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> (cherry picked from commit3f26e9ca19
)
This commit is contained in:

committed by
Dylan Baker

parent
ff59f1f58e
commit
3d96958812
@@ -2914,7 +2914,7 @@
|
||||
"description": "nir/opt_intrinsic: fix sample mask opt with demote",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "d3ce8a7f6b93e893929b81f4d6605a2a968730a1",
|
||||
"notes": null
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user