nir: Add a helper for adding texture instruction sources
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
@@ -541,6 +541,28 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
|
||||
return instr;
|
||||
}
|
||||
|
||||
void
|
||||
nir_tex_instr_add_src(nir_tex_instr *tex,
|
||||
nir_tex_src_type src_type,
|
||||
nir_src src)
|
||||
{
|
||||
nir_tex_src *new_srcs = rzalloc_array(tex, nir_tex_src,
|
||||
tex->num_srcs + 1);
|
||||
|
||||
for (unsigned i = 0; i < tex->num_srcs; i++) {
|
||||
new_srcs[i].src_type = tex->src[i].src_type;
|
||||
nir_instr_move_src(&tex->instr, &new_srcs[i].src,
|
||||
&tex->src[i].src);
|
||||
}
|
||||
|
||||
ralloc_free(tex->src);
|
||||
tex->src = new_srcs;
|
||||
|
||||
tex->src[tex->num_srcs].src_type = src_type;
|
||||
nir_instr_rewrite_src(&tex->instr, &tex->src[tex->num_srcs].src, src);
|
||||
tex->num_srcs++;
|
||||
}
|
||||
|
||||
void
|
||||
nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx)
|
||||
{
|
||||
|
Reference in New Issue
Block a user