[Mesa-dev] [PATCH 00/11] i965: The grand uniform unification

Jason Ekstrand jason at jlekstrand.net
Wed Sep 30 18:41:04 PDT 2015


It has been bothering me for quite some time that the uniform setup in the
vec4 and fs backends is almost line-for-line identical but duplicated.
It's also been bothering me that it's in vec4/fs_visitor even though it has
very little to do with the backend compiler and has everything to do with
the stage_prog_data struct.  This patch series scratches both of those
itches.

The first three patches are actually to fix arb_shader_subroutine.  In all
backends, we aren't actually reserving space for the subroutine uniforms
properly.  To be honest, I'm not sure how we're passing tests and not
segfaulting when we write past the end of the param array.  It's also
completely broken for vec4 with NIR (I have no idea if it worked without
NIR) and, since we had no tests, no one knew...

Unfortunately, my fix for this stuff requires NIR so we probably want to
find another fix and back-port it to 11.0.

The next eight patches masage the uniform handling code to get it to the
point where we can finally pull stage_prog_data.param setup out of the
backend compiler and into helper functions.  The only thing the backend
compiler is left doing is filling out an internal array of uniform sizes
that it uses for splitting things up.  It's now *almost* completely unaware
of uniform storage handling inside Messa.  I say "almost" because the
work-arounds we do for TEXTURE_RECTANGLE and clip planes still do uniform
setup outside of those helpers.  Eventually, we should be able to get that
stuff moved out to.

In case it's not obvious from some of the patches, this series has deleting
the non-NIR vec4 code as a hard pre-requisite.

Jason Ekstrand (11):
  glsl/types: Make subroutine types have a single matrix column
  i965/vs: Move lazy NIR creation to codegen_vs_prog
  i965: Pull stage_prog_data.nr_params out of the NIR shader
  i965/vec4: Use the actual channels used in pack_uniform_registers
  i965/vec4: Get rid of the uniform_vector_size array
  i965/shader: Pull setup_image_uniform_values out of backend_shader
  i965/shader: Get rid of the setup_vec4_uniform_value helper
  i965/vec4: Use the uniform count from nir_assign_var_locations
  i965/nir: Pull common ARB program uniform handling into a common
    function
  i965/nir: Pull GLSL uniform handling into a common function
  i965/nir: Simplify uniform setup

 src/glsl/glsl_types.cpp                           |   3 +-
 src/mesa/drivers/dri/i965/Makefile.sources        |   1 +
 src/mesa/drivers/dri/i965/brw_cs.c                |   7 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp              |  14 --
 src/mesa/drivers/dri/i965/brw_fs.h                |   6 -
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp          |  98 +-----------
 src/mesa/drivers/dri/i965/brw_gs.c                |   8 +-
 src/mesa/drivers/dri/i965/brw_nir.h               |   9 ++
 src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp    | 181 ++++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_shader.cpp          |  52 +++++--
 src/mesa/drivers/dri/i965/brw_shader.h            |  11 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp            |  65 ++++----
 src/mesa/drivers/dri/i965/brw_vec4.h              |   8 +-
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp        | 134 +---------------
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp    |  19 ---
 src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp |   1 -
 src/mesa/drivers/dri/i965/brw_vs.c                |  38 +++--
 src/mesa/drivers/dri/i965/brw_wm.c                |  18 ++-
 18 files changed, 330 insertions(+), 343 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list