Mesa (master): nir: Embed the shader_info in the nir_shader again

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue May 9 22:08:23 UTC 2017


Module: Mesa
Branch: master
Commit: b86dba8a0eee6be283a96481c0c2b1fb1e882824
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b86dba8a0eee6be283a96481c0c2b1fb1e882824

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon May  8 09:20:21 2017 -0700

nir: Embed the shader_info in the nir_shader again

Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info
from being embedded into being just a pointer.  The idea was that
sharing the shader_info between NIR and GLSL would be easier if it were
a pointer pointing to the same shader_info struct.  This, however, has
caused a few problems:

 1) There are many things which generate NIR without GLSL.  This means
    we have to support both NIR shaders which come from GLSL and ones
    that don't and need to have an info elsewhere.

 2) The solution to (1) raises all sorts of ownership issues which have
    to be resolved with ralloc_parent checks.

 3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been
    using nir_gather_info to fill out the final shader_info.  Thanks to
    cloning and the above ownership issues, the nir_shader::info may not
    point back to the gl_shader anymore and so we have to do a copy of
    the shader_info from NIR back to GLSL anyway.

All of these issues go away if we just embed the shader_info in the
nir_shader.  There's a little downside of having to copy it back after
calling nir_gather_info but, as explained above, we have to do that
anyway.

Acked-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/amd/common/ac_nir_to_llvm.c                    | 38 +++++-----
 src/amd/vulkan/radv_meta.c                         |  4 +-
 src/amd/vulkan/radv_meta_blit.c                    |  8 +-
 src/amd/vulkan/radv_meta_blit2d.c                  |  8 +-
 src/amd/vulkan/radv_meta_buffer.c                  | 28 +++----
 src/amd/vulkan/radv_meta_bufimage.c                | 56 +++++++-------
 src/amd/vulkan/radv_meta_clear.c                   |  8 +-
 src/amd/vulkan/radv_meta_resolve.c                 |  2 +-
 src/amd/vulkan/radv_meta_resolve_cs.c              | 14 ++--
 src/amd/vulkan/radv_meta_resolve_fs.c              |  4 +-
 src/amd/vulkan/radv_pipeline.c                     | 24 +++---
 src/amd/vulkan/radv_query.c                        | 28 +++----
 src/compiler/glsl/glsl_to_nir.cpp                  | 12 +--
 src/compiler/nir/nir.c                             |  3 +-
 src/compiler/nir/nir.h                             |  2 +-
 src/compiler/nir/nir_clone.c                       |  8 +-
 src/compiler/nir/nir_gather_info.c                 | 46 ++++++------
 src/compiler/nir/nir_lower_bitmap.c                |  2 +-
 src/compiler/nir/nir_lower_clip.c                  |  2 +-
 .../nir/nir_lower_clip_cull_distance_arrays.c      |  4 +-
 src/compiler/nir/nir_lower_gs_intrinsics.c         |  2 +-
 src/compiler/nir/nir_lower_system_values.c         | 10 +--
 src/compiler/nir/nir_print.c                       | 18 ++---
 src/compiler/nir/nir_sweep.c                       | 14 +---
 src/compiler/spirv/spirv_to_nir.c                  | 48 ++++++------
 src/compiler/spirv/vtn_variables.c                 | 14 ++--
 src/gallium/auxiliary/nir/tgsi_to_nir.c            | 14 ++--
 .../drivers/freedreno/ir3/ir3_compiler_nir.c       |  4 +-
 src/gallium/drivers/freedreno/ir3/ir3_shader.c     |  2 +-
 src/gallium/drivers/vc4/vc4_nir_lower_blend.c      |  2 +-
 src/gallium/drivers/vc4/vc4_program.c              |  6 +-
 src/intel/blorp/blorp.c                            |  6 +-
 src/intel/blorp/blorp_blit.c                       |  2 +-
 src/intel/blorp/blorp_clear.c                      |  4 +-
 src/intel/compiler/brw_fs.cpp                      | 86 +++++++++++-----------
 src/intel/compiler/brw_fs_nir.cpp                  | 18 ++---
 src/intel/compiler/brw_fs_visitor.cpp              | 10 +--
 src/intel/compiler/brw_nir.c                       |  8 +-
 src/intel/compiler/brw_nir_intrinsics.c            |  4 +-
 src/intel/compiler/brw_shader.cpp                  | 28 +++----
 src/intel/compiler/brw_vec4.cpp                    | 20 ++---
 src/intel/compiler/brw_vec4_generator.cpp          |  4 +-
 src/intel/compiler/brw_vec4_gs_visitor.cpp         | 36 ++++-----
 src/intel/compiler/brw_vec4_nir.cpp                |  8 +-
 src/intel/compiler/brw_vec4_tcs.cpp                | 28 +++----
 src/intel/compiler/brw_wm_iz.cpp                   |  2 +-
 src/intel/compiler/gen6_gs_visitor.cpp             | 12 +--
 src/intel/vulkan/anv_pipeline.c                    | 34 ++++-----
 src/mesa/drivers/dri/i965/brw_link.cpp             |  2 +-
 src/mesa/drivers/dri/i965/brw_program.c            | 16 ++--
 src/mesa/drivers/dri/i965/brw_tcs.c                | 14 ++--
 src/mesa/drivers/dri/i965/brw_tes.c                |  8 +-
 src/mesa/drivers/dri/i965/brw_vs.c                 |  2 +-
 src/mesa/drivers/dri/i965/brw_wm.c                 |  6 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c   | 12 +--
 src/mesa/program/prog_to_nir.c                     | 26 +++----
 56 files changed, 410 insertions(+), 421 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=b86dba8a0eee6be283a96481c0c2b1fb1e882824



More information about the mesa-commit mailing list