[Mesa-dev] [PATCH v2 2/8] nir: Separate texture from sampler in nir_tex_instr

Kenneth Graunke kenneth at whitecape.org
Mon Feb 8 23:18:00 UTC 2016


On Saturday, February 6, 2016 10:19:46 AM PST Jason Ekstrand wrote:
> This commit adds the capability to NIR to support separate textures and
> samplers.  As it currently stands, glsl_to_nir only sets the texture deref
> and leaves the sampler deref alone as it did before and nir_lower_samplers
> assumes this.  Backends can still assume that they are combined and only
> look at only at the texture index.  Or, if they wish, they can assume that
> they are separate because nir_lower_samplers, tgsi_to_nir, and prog_to_nir
> all set both texture and sampler index whenever a sampler is required (the
> two indices are the same in this case).
> ---
>  src/compiler/nir/nir.c                       |  6 ++++++
>  src/compiler/nir/nir.h                       | 31 +++++++++++++++++++++++++++-
>  src/compiler/nir/nir_clone.c                 |  7 ++++++-
>  src/compiler/nir/nir_instr_set.c             | 15 ++++++++------
>  src/compiler/nir/nir_lower_samplers.c        | 13 +++++++++++-
>  src/compiler/nir/nir_lower_tex.c             |  6 +++---
>  src/compiler/nir/nir_opt_constant_folding.c  | 11 +++++++---
>  src/compiler/nir/nir_print.c                 | 14 ++++++++++---
>  src/compiler/nir/nir_remove_dead_variables.c |  5 +++++
>  src/compiler/nir/nir_validate.c              |  3 +++
>  src/gallium/auxiliary/nir/tgsi_to_nir.c      |  1 +
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp     |  3 +++
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp   |  3 +++
>  src/mesa/program/prog_to_nir.c               |  1 +
>  14 files changed, 101 insertions(+), 18 deletions(-)
> 
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index b8cc84d..cd22a5c 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -489,6 +489,8 @@ nir_tex_instr_create(nir_shader *shader, unsigned num_srcs)
>     instr->texture_index = 0;
>     instr->texture_array_size = 0;
>     instr->texture = NULL;
> +   instr->sampler_index = 0;
> +   instr->sampler = NULL;
>  
>     return instr;
>  }
> @@ -1009,6 +1011,10 @@ visit_tex_src(nir_tex_instr *instr, nir_foreach_src_cb cb, void *state)
>        if (!visit_deref_src(instr->texture, cb, state))
>           return false;
>  
> +   if (instr->sampler != NULL)
> +      if (!visit_deref_src(instr->sampler, cb, state))
> +         return false;

Braces, please!

Patches 1-2 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160208/ef196474/attachment-0001.sig>


More information about the mesa-dev mailing list