nir/builder: Add a copy_deref_var helper

This commit is contained in:
Jason Ekstrand 2015-12-18 12:16:45 -08:00
parent 23cfa683d5
commit b21db9cea5
1 changed files with 13 additions and 0 deletions

View File

@ -353,6 +353,19 @@ nir_store_var(nir_builder *build, nir_variable *var, nir_ssa_def *value)
nir_builder_instr_insert(build, &store->instr);
}
static inline void
nir_copy_deref_var(nir_builder *build, nir_deref_var *dest, nir_deref_var *src)
{
assert(nir_deref_tail(&dest->deref)->type ==
nir_deref_tail(&src->deref)->type);
nir_intrinsic_instr *copy =
nir_intrinsic_instr_create(build->shader, nir_intrinsic_copy_var);
copy->variables[0] = nir_deref_as_var(nir_copy_deref(copy, &dest->deref));
copy->variables[1] = nir_deref_as_var(nir_copy_deref(copy, &src->deref));
nir_builder_instr_insert(build, &copy->instr);
}
static inline void
nir_copy_var(nir_builder *build, nir_variable *dest, nir_variable *src)
{