[Mesa-dev] [PATCH 0/7] nir_shader_clone() and few bits

Rob Clark robdclark at gmail.com
Sat Oct 24 10:07:53 PDT 2015

From: Rob Clark <robclark at freedesktop.org>

Mostly the implementation of nir_shader_clone() for copying a NIR
shader IR, plus couple cleanups, reference counting, and helper
macros.  The reference counting will be useful for mesa-st (and
perhaps other state trackers), since there are cases when both
mesa-st and the driver need to hold on to copies to do their own
variant management.

Couple small TODO's still..  The clone-test (NIR_TEST_CLONE=1, which
clones/revalidates/replaces the shader between each opt/lowering pass)
survives glmark2.  I need still to subject it to a piglit run.

I was originally going to use nir_cf_node_insert()/nir_instr_insert()
with the plan that they'd update the uses/defs/etc.  But that turned
out to be awkward, do to the order things get cloned if I use the
clone_ptr() aproach for blocks/etc (in particular w/ predecessor and
successor ptrs).  Instead it was easier to just export a fxn which
did the important (for us) bits of cf_node_insert()/instr_insert()

Rob Clark (7):
  nir: add nir_var_all enum
  nir: some small cleanups
  nir: export update_if_uses() and add_def_uses()
  nir: add couple array length fields
  nir: support to clone shaders
  nir: add shader reference counting
  nir: add helper macros for running NIR passes

 src/gallium/drivers/vc4/vc4_program.c   |    2 +-
 src/glsl/Makefile.sources               |    1 +
 src/glsl/nir/glsl_to_nir.cpp            |    6 +
 src/glsl/nir/nir.c                      |   45 +-
 src/glsl/nir/nir.h                      |  102 +++-
 src/glsl/nir/nir_clone.c                | 1012 +++++++++++++++++++++++++++++++
 src/glsl/nir/nir_control_flow.c         |    6 +-
 src/glsl/nir/nir_control_flow_private.h |    1 +
 src/glsl/nir/nir_lower_io.c             |    2 +-
 src/mesa/drivers/dri/i965/brw_nir.c     |  127 ++--
 src/mesa/program/program.c              |    3 +-
 11 files changed, 1202 insertions(+), 105 deletions(-)
 create mode 100644 src/glsl/nir/nir_clone.c


More information about the mesa-dev mailing list