[Mesa-dev] [PATCH] nir: add nir_swizzle

Erik Faye-Lund kusmabite at gmail.com
Thu Sep 10 17:03:01 PDT 2015


On Thu, Sep 10, 2015 at 10:08 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> Rather than make yet another copy of channel(), let's move it into nir.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> ---
>  src/glsl/nir/nir_builder.h                  |  6 ++++++
>  src/glsl/nir/nir_lower_tex_projector.c      | 24 +++++++++---------------
>  src/glsl/nir/nir_normalize_cubemap_coords.c | 20 +++++++-------------
>  3 files changed, 22 insertions(+), 28 deletions(-)
>
> diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
> index ba988d7..6568493 100644
> --- a/src/glsl/nir/nir_builder.h
> +++ b/src/glsl/nir/nir_builder.h
> @@ -216,6 +216,12 @@ nir_swizzle(nir_builder *build, nir_ssa_def *src, unsigned swiz[4],
>                       nir_imov_alu(build, alu_src, num_components);
>  }
>
> +static inline nir_ssa_def *
> +nir_channel(nir_builder *b, nir_ssa_def *def, int c)
> +{
> +   return nir_swizzle(b, def, (unsigned[4]){c, c, c, c}, 1, false);
> +}
> +

The subject is "add nir_swizzle", but you seem to rename channel to
nir_channel instead... Old subject, perhaps?


More information about the mesa-dev mailing list