nir: Fix shader calls with nir_opt_dead_write_vars.

Fixes: 5a28893279 ("spirv,nir: Add ray-tracing intrinsics")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10096>
This commit is contained in:
Bas Nieuwenhuizen 2021-03-31 02:41:15 +02:00 committed by Marge Bot
parent 95c4f0f910
commit 84e0f6dbd8
1 changed files with 14 additions and 0 deletions

View File

@ -169,6 +169,20 @@ remove_dead_write_vars_local(void *mem_ctx, nir_shader *shader, nir_block *block
break;
}
case nir_intrinsic_execute_callable: {
/* Mark payload as it can be used by the callee */
nir_deref_instr *src = nir_src_as_deref(intrin->src[1]);
clear_unused_for_read(&unused_writes, src);
break;
}
case nir_intrinsic_trace_ray: {
/* Mark payload as it can be used by the callees */
nir_deref_instr *src = nir_src_as_deref(intrin->src[10]);
clear_unused_for_read(&unused_writes, src);
break;
}
case nir_intrinsic_load_deref: {
nir_deref_instr *src = nir_src_as_deref(intrin->src[0]);
if (nir_deref_mode_must_be(src, nir_var_read_only_modes))