summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-16 08:50:44 -0700
committerJason Ekstrand <[email protected]>2017-10-17 07:36:00 -0700
commit759ab66db036dd911cb589429eb4dbb3eb4fdc4c (patch)
treed54c2037549ef7719a79db97c1c0e33bfef1bfd6 /src/intel/vulkan
parent41c75b5354e5d4382786ff853f6f5143a0fe4c6d (diff)
anv/apply_pipeline_layout: Use nir_tex_instr_remove_src
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_nir_apply_pipeline_layout.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
index 1c8651333b3..3ca2b04049a 100644
--- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
+++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c
@@ -192,10 +192,10 @@ has_tex_src_plane(nir_tex_instr *tex)
static uint32_t
extract_tex_src_plane(nir_tex_instr *tex)
{
- nir_tex_src *new_srcs = rzalloc_array(tex, nir_tex_src, tex->num_srcs - 1);
unsigned plane = 0;
- for (unsigned i = 0, w = 0; i < tex->num_srcs; i++) {
+ int plane_src_idx = -1;
+ for (unsigned i = 0; i < tex->num_srcs; i++) {
if (tex->src[i].src_type == nir_tex_src_plane) {
nir_const_value *const_plane =
nir_src_as_const_value(tex->src[i].src);
@@ -204,19 +204,12 @@ extract_tex_src_plane(nir_tex_instr *tex)
* constants. */
assert(const_plane);
plane = const_plane->u32[0];
-
- /* Remove the source from the instruction */
- nir_instr_rewrite_src(&tex->instr, &tex->src[i].src, NIR_SRC_INIT);
- } else {
- new_srcs[w].src_type = tex->src[i].src_type;
- nir_instr_move_src(&tex->instr, &new_srcs[w].src, &tex->src[i].src);
- w++;
+ plane_src_idx = i;
}
}
- ralloc_free(tex->src);
- tex->src = new_srcs;
- tex->num_srcs--;
+ assert(plane_src_idx >= 0);
+ nir_tex_instr_remove_src(tex, plane_src_idx);
return plane;
}