summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-16 08:50:23 -0700
committerJason Ekstrand <[email protected]>2017-10-17 07:36:00 -0700
commit41c75b5354e5d4382786ff853f6f5143a0fe4c6d (patch)
treecaa4501a38cb4bf61dd0652c7f9cf85800bb3fb0 /src/intel/vulkan
parent31fb7bbe0be83b2ad769568829a006855639bee8 (diff)
nir: Add a helper for adding texture instruction sources
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_nir_apply_pipeline_layout.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 26e7dccc79d..1c8651333b3 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -157,24 +157,7 @@ lower_tex_deref(nir_tex_instr *tex, nir_deref_var *deref,
if (state->add_bounds_checks)
index = nir_umin(b, index, nir_imm_int(b, array_size - 1));
- 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;
-
- /* Now we can go ahead and move the source over to being a
- * first-class texture source.
- */
- tex->src[tex->num_srcs].src_type = src_type;
- nir_instr_rewrite_src(&tex->instr, &tex->src[tex->num_srcs].src,
- nir_src_for_ssa(index));
- tex->num_srcs++;
+ nir_tex_instr_add_src(tex, src_type, nir_src_for_ssa(index));
} else {
*const_index += MIN2(deref_array->base_offset, array_size - 1);
}