summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir.c
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-09-08 14:07:06 -0400
committerRob Clark <[email protected]>2016-09-14 13:45:32 -0400
commit1a8424cebaeaf46a01000624a46764f3e84dad85 (patch)
treefe7d57ce69ee32fd14163128db63e524409ef9c1 /src/compiler/nir/nir.c
parent2c3f9662762f6e45b47ea5d3047f5596b555f29c (diff)
nir: move tex_instr_remove_src
I want to re-use this in a different pass, so move to nir.h Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.c')
-rw-r--r--src/compiler/nir/nir.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 6bebb7392f5..13ba989af4b 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -536,6 +536,22 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
return instr;
}
+void
+nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx)
+{
+ assert(src_idx < tex->num_srcs);
+
+ /* First rewrite the source to NIR_SRC_INIT */
+ nir_instr_rewrite_src(&tex->instr, &tex->src[src_idx].src, NIR_SRC_INIT);
+
+ /* Now, move all of the other sources down */
+ for (unsigned i = src_idx + 1; i < tex->num_srcs; i++) {
+ tex->src[i-1].src_type = tex->src[i].src_type;
+ nir_instr_move_src(&tex->instr, &tex->src[i-1].src, &tex->src[i].src);
+ }
+ tex->num_srcs--;
+}
+
nir_phi_instr *
nir_phi_instr_create(nir_shader *shader)
{