[Mesa-dev] [RFC 0/5] nir: Separate Textures and Samplers

Jason Ekstrand jason at jlekstrand.net
Tue Nov 3 13:25:59 PST 2015


Separate textures and samplers are something that a lot of hardware
supports.  Our hardware in particular has done this ever since the original
i965 chips.  Part of this is because DX has made it a requirement for some
time now.  GL allows you to expose it sort-of but weasel-words it enough
that you can do it entirely at the API level and that's how we handle it
today.  I've been doing some thinking lately about how we could expose this
(if we wanted to) in the compiler.  This patch series is a first crack at
doing that.

Key design points

 1) There is no "combine" instruction; nir_tex_instr just takes a deref for
    each of sampler and texture.
 2) It's optional (just make the texture deref NULL)
 3) The lowering pass sets both sampler and texture indices so that
    backends don't have to make a distinction between whether you have a
    separate texture or not

There is no API stuff here, just compiler stuff for the people who may or
may not be interested.

Happy Bikeshedding!

--Jason

Jason Ekstrand (5):
  nir: Separate texture from sampler in nir_tex_instr
  i965/fs: Separate the sampler from the surface in generate_tex
  i965/fs: Plumb separate surfaces and samplers through from NIR
  i965/vec4: Separate the sampler from the surface in generate_tex
  i965/vec4: Plumb separate surfaces and samplers through from NIR

 src/glsl/nir/nir.c                               |  8 +++-
 src/glsl/nir/nir.h                               | 28 ++++++++++++--
 src/glsl/nir/nir_instr_set.c                     | 13 ++++---
 src/glsl/nir/nir_lower_samplers.c                | 15 +++++++-
 src/glsl/nir/nir_print.c                         | 14 +++++--
 src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp  |  2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp             | 47 ++++++++++++++----------
 src/mesa/drivers/dri/i965/brw_fs.h               |  5 ++-
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 20 +++++++---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp         | 25 +++++++++----
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp     | 16 ++++----
 src/mesa/drivers/dri/i965/brw_vec4.h             |  4 +-
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 18 ++++++---
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp       | 27 ++++++++++----
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   | 12 ++++--
 src/mesa/program/prog_to_nir.c                   |  1 +
 16 files changed, 181 insertions(+), 74 deletions(-)

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list