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 <robdclark@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -536,6 +536,22 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
|
|||||||
return instr;
|
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 *
|
||||||
nir_phi_instr_create(nir_shader *shader)
|
nir_phi_instr_create(nir_shader *shader)
|
||||||
{
|
{
|
||||||
|
@@ -1329,6 +1329,8 @@ nir_tex_instr_src_index(nir_tex_instr *instr, nir_tex_src_type type)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx);
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
float f32[4];
|
float f32[4];
|
||||||
double f64[4];
|
double f64[4];
|
||||||
|
@@ -38,22 +38,6 @@
|
|||||||
#include "nir.h"
|
#include "nir.h"
|
||||||
#include "nir_builder.h"
|
#include "nir_builder.h"
|
||||||
|
|
||||||
static void
|
|
||||||
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--;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
project_src(nir_builder *b, nir_tex_instr *tex)
|
project_src(nir_builder *b, nir_tex_instr *tex)
|
||||||
{
|
{
|
||||||
@@ -114,7 +98,7 @@ project_src(nir_builder *b, nir_tex_instr *tex)
|
|||||||
nir_src_for_ssa(projected));
|
nir_src_for_ssa(projected));
|
||||||
}
|
}
|
||||||
|
|
||||||
tex_instr_remove_src(tex, proj_index);
|
nir_tex_instr_remove_src(tex, proj_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -159,7 +143,7 @@ lower_offset(nir_builder *b, nir_tex_instr *tex)
|
|||||||
nir_instr_rewrite_src(&tex->instr, &tex->src[coord_index].src,
|
nir_instr_rewrite_src(&tex->instr, &tex->src[coord_index].src,
|
||||||
nir_src_for_ssa(offset_coord));
|
nir_src_for_ssa(offset_coord));
|
||||||
|
|
||||||
tex_instr_remove_src(tex, offset_index);
|
nir_tex_instr_remove_src(tex, offset_index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user