[Mesa-dev] [RFCv0 0/8] gallium: add support for NIR as alternate IR
Rob Clark
robdclark at gmail.com
Mon Oct 19 12:54:33 PDT 2015
From: Rob Clark <robclark at freedesktop.org>
(grr, resend to the right list..)
Still quite rough around the edges, but now it's at the point of sorta-
kinda-working-sometimes. So I guess time to get wider feedback.
The initial goal is to figure out things that glsl_to_nir does
differently from tgsi_to_nir, so we can fix them up and have better
likelyhood of drivers being able to consume NIR from multiple sources.
Eventually I'd like to be able to re-use spriv->nir for compute/
clover support, for example. And at some point I'd like to be able to
bypass the conversion from glsl->tgsi for mesa st. But for now, being
able to track down and fix differences between glsl_to_nir vs tgsi_to_nir
is a good start.
With what I've added to pipe_shader_state (which is, I suppose, missing
some doc updates), the intention is that drivers can ask for an IR
other than TGSI. And what they actually get will be either TGSI or
their preferred IR. Drivers will have to always handle the TGSI case,
so the intention isn't to port all the different state trackers (or
internally generated shaders, etc).
I suppose pipe_compute_state needs similar treatment, but I've skipped
that for now.
Currently only the direct GLSL->NIR path is implemented for vertex
shaders, which results in a huge hack at the end of the series. It
isn't ever intended for drivers to mix/match glsl->nir vs glsl->tgsi->
nir across shader stages. But this is sufficient for now for me to
debug other issues.
Shader variant handling will be completely broken at the moment, without
having a nir_clone()[1]. (Ian, depending on how far that is from the top
of your TODO list, I can take a stab at that, since I might be the first
consumer.)
Also, there is some trivial shader variant handling in mesa st which
would have to be ported to NIR. Or, perhaps, just somehow expose the
shader key to the driver. (Currently most drivers are doing much more
variant handling within the driver, and having two levels of variants
does seem a bit silly.)
[1] https://bugs.freedesktop.org/show_bug.cgi?id=89436
(First patch isn't actually RFC.. just an issue that I noticed in the
process.)
Rob Clark (8):
nir: add nir_var_all enum
gallium: refactor pipe_shader_state to support multiple IR's
gallium: add NIR as a possible IR
mesa/st: add support for NIR as possible driver IR
freedreno/ir3: drop tokens arg
freedreno/ir3: add support for NIR as preferred IR
freedreno/ir3: fix const_index handling for uniforms
HACK: freedreno/ir3: hack for mismatch on varying slots for
glsl->tgsi->nir vs glsl->nir
src/gallium/auxiliary/hud/hud_context.c | 14 +-
src/gallium/auxiliary/postprocess/pp_run.c | 4 +-
src/gallium/auxiliary/tgsi/tgsi_ureg.c | 6 +-
src/gallium/auxiliary/util/u_simple_shaders.c | 42 +++-
src/gallium/auxiliary/util/u_tests.c | 7 +-
src/gallium/drivers/freedreno/freedreno_screen.c | 5 +-
src/gallium/drivers/freedreno/freedreno_util.h | 1 +
.../drivers/freedreno/ir3/ir3_compiler_nir.c | 38 +++-
src/gallium/drivers/freedreno/ir3/ir3_shader.c | 30 ++-
src/gallium/drivers/freedreno/ir3/ir3_shader.h | 3 +
src/gallium/include/pipe/p_defines.h | 13 +-
src/gallium/include/pipe/p_state.h | 21 +-
src/glsl/nir/nir.c | 4 +
src/glsl/nir/nir.h | 1 +
src/glsl/nir/nir_lower_io.c | 2 +-
src/mesa/drivers/dri/i965/brw_nir.c | 3 +-
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 223 ++++++++++++++++++++-
src/mesa/state_tracker/st_program.c | 43 +++-
18 files changed, 422 insertions(+), 38 deletions(-)
--
2.5.0
More information about the mesa-dev
mailing list