spirv: Don't remove variables used by resource indexing intrinsics
In Vulkan, for some variable modes, the generated NIR will have derefs
pointing to resource index intrinsics instead of the variable. This
was letting nir_remove_dead_variables pass remove those variables,
which would lose information relevant for later passes after
spirv2nir.
Add a set to keep track of such variables and prevent them to be
removed when producing the NIR output.
Issue reported by Rhys.
Fixes: c4c9c780b1
("spirv: Remove more dead variables")
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8706>
This commit is contained in:

committed by
Marge Bot

parent
cb7352ae95
commit
10b3eecd36
@@ -237,6 +237,11 @@ vtn_variable_resource_index(struct vtn_builder *b, struct vtn_variable *var,
|
||||
desc_array_index = nir_imm_int(&b->nb, 0);
|
||||
}
|
||||
|
||||
if (b->vars_used_indirectly) {
|
||||
vtn_assert(var->var);
|
||||
_mesa_set_add(b->vars_used_indirectly, var->var);
|
||||
}
|
||||
|
||||
nir_intrinsic_instr *instr =
|
||||
nir_intrinsic_instr_create(b->nb.shader,
|
||||
nir_intrinsic_vulkan_resource_index);
|
||||
|
Reference in New Issue
Block a user