nir: add nir_instr_rewrite_deref
Allows modifying a texture instruction's texture and sampler derefs. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
540b1a8f0b
commit
b27c2d402e
|
@ -1509,6 +1509,19 @@ nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest, nir_dest new_dest)
|
||||||
src_add_all_uses(dest->reg.indirect, instr, NULL);
|
src_add_all_uses(dest->reg.indirect, instr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nir_instr_rewrite_deref(nir_instr *instr, nir_deref_var **deref,
|
||||||
|
nir_deref_var *new_deref)
|
||||||
|
{
|
||||||
|
if (*deref)
|
||||||
|
visit_deref_src(*deref, remove_use_cb, NULL);
|
||||||
|
|
||||||
|
*deref = new_deref;
|
||||||
|
|
||||||
|
if (*deref)
|
||||||
|
visit_deref_src(*deref, add_use_cb, instr);
|
||||||
|
}
|
||||||
|
|
||||||
/* note: does *not* take ownership of 'name' */
|
/* note: does *not* take ownership of 'name' */
|
||||||
void
|
void
|
||||||
nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
|
nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
|
||||||
|
|
|
@ -2211,6 +2211,8 @@ void nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src *src);
|
||||||
void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
|
void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
|
||||||
void nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest,
|
void nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest,
|
||||||
nir_dest new_dest);
|
nir_dest new_dest);
|
||||||
|
void nir_instr_rewrite_deref(nir_instr *instr, nir_deref_var **deref,
|
||||||
|
nir_deref_var *new_deref);
|
||||||
|
|
||||||
void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
|
void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
|
||||||
unsigned num_components, unsigned bit_size,
|
unsigned num_components, unsigned bit_size,
|
||||||
|
|
Loading…
Reference in New Issue