[Mesa-dev] [PATCH v2 118/133] nir/tex_instr: Rename the indirect source type
Connor Abbott
cwabbott0 at gmail.com
Fri Jan 9 11:32:21 PST 2015
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
On Wed, Jan 7, 2015 at 9:03 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> In particular, we rename nir_tex_src_sampler_index to _sampler_offset and
> add a sampler_array_size field to nir_tex_instr. This way we can pass the
> size of sampler arrays through to backends even after removing the variable
> information and, with it, the type.
> ---
> src/glsl/nir/nir.c | 4 ++++
> src/glsl/nir/nir.h | 11 ++++++++++-
> src/glsl/nir/nir_print.c | 4 ++--
> 3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
> index 18324c6..9b99c9e 100644
> --- a/src/glsl/nir/nir.c
> +++ b/src/glsl/nir/nir.c
> @@ -464,6 +464,10 @@ nir_tex_instr_create(void *mem_ctx, unsigned num_srcs)
> instr->has_predicate = false;
> src_init(&instr->predicate);
>
> + instr->sampler_index = 0;
> + instr->sampler_array_size = 0;
> + instr->sampler = NULL;
> +
> return instr;
> }
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 09ecf86..8fd39d7 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -793,7 +793,7 @@ typedef enum {
> nir_tex_src_ms_index, /* MSAA sample index */
> nir_tex_src_ddx,
> nir_tex_src_ddy,
> - nir_tex_src_sampler_index, /* < dynamically uniform indirect index */
> + nir_tex_src_sampler_offset, /* < dynamically uniform indirect offset */
> nir_num_texinput_types
> } nir_texinput_type;
>
> @@ -838,7 +838,16 @@ typedef struct {
> /* gather component selector */
> unsigned component : 2;
>
> + /** The sampler index
> + *
> + * If this texture instruction has a nir_tex_src_sampler_offset source,
> + * then the sampler index is given by sampler_index + sampler_offset.
> + */
> unsigned sampler_index;
> +
> + /** The size of the sampler array or 0 if it's not an array */
> + unsigned sampler_array_size;
> +
> nir_deref_var *sampler; /* if this is NULL, use sampler_index instead */
> } nir_tex_instr;
>
> diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
> index 962e408..5987247 100644
> --- a/src/glsl/nir/nir_print.c
> +++ b/src/glsl/nir/nir_print.c
> @@ -465,8 +465,8 @@ print_tex_instr(nir_tex_instr *instr, print_var_state *state, FILE *fp)
> case nir_tex_src_ddy:
> fprintf(fp, "(ddy)");
> break;
> - case nir_tex_src_sampler_index:
> - fprintf(fp, "(sampler_index)");
> + case nir_tex_src_sampler_offset:
> + fprintf(fp, "(sampler_offset)");
> break;
>
> default:
> --
> 2.2.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list