On Thu, Sep 8, 2016 at 11:21 AM, Jason Ekstrand <ja...@jlekstrand.net> wrote:
> > > On Thu, Sep 8, 2016 at 11:14 AM, Rob Clark <robdcl...@gmail.com> wrote: > >> I want to re-use this in a different pass, so move to nir.h >> >> Signed-off-by: Rob Clark <robdcl...@gmail.com> >> --- >> src/compiler/nir/nir.h | 16 ++++++++++++++++ >> src/compiler/nir/nir_lower_tex.c | 20 ++------------------ >> 2 files changed, 18 insertions(+), 18 deletions(-) >> >> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h >> index c1cf940..e907bc9 100644 >> --- a/src/compiler/nir/nir.h >> +++ b/src/compiler/nir/nir.h >> @@ -2297,6 +2297,22 @@ unsigned nir_index_instrs(nir_function_impl >> *impl); >> >> void nir_index_blocks(nir_function_impl *impl); >> >> +static inline void >> +nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx) >> > > This one is complex enough, I think I'd rather have it in nir.c. That > also allows us to put the declaration up with the other nir_tex_instr > helpers which would be nice. > With that fixed, both are Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> > +{ >> + 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--; >> +} >> + >> void nir_print_shader(nir_shader *shader, FILE *fp); >> void nir_print_shader_annotated(nir_shader *shader, FILE *fp, struct >> hash_table *errors); >> void nir_print_instr(const nir_instr *instr, FILE *fp); >> diff --git a/src/compiler/nir/nir_lower_tex.c >> b/src/compiler/nir/nir_lower_tex.c >> index b570598..a405758 100644 >> --- a/src/compiler/nir/nir_lower_tex.c >> +++ b/src/compiler/nir/nir_lower_tex.c >> @@ -39,22 +39,6 @@ >> #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 >> project_src(nir_builder *b, nir_tex_instr *tex) >> { >> /* Find the projector in the srcs list, if present. */ >> @@ -114,7 +98,7 @@ project_src(nir_builder *b, nir_tex_instr *tex) >> nir_src_for_ssa(projected)); >> } >> >> - tex_instr_remove_src(tex, proj_index); >> + nir_tex_instr_remove_src(tex, proj_index); >> } >> >> 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_src_for_ssa(offset_coord)); >> >> - tex_instr_remove_src(tex, offset_index); >> + nir_tex_instr_remove_src(tex, offset_index); >> >> return true; >> } >> -- >> 2.7.4 >> >> >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev