gallium: Add a nir-to-TGSI pass.
authorEric Anholt <eric@anholt.net>
Wed, 5 Nov 2014 20:41:08 +0000 (12:41 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 20 Oct 2020 15:54:06 +0000 (08:54 -0700)
commit34cc6a804ec92b5e74cde5b346828874737276a8
tree447b2b082820a3450385dddbe4ce45f4f23dab4c
parentd867e7c97482ee4682b59c5d17ef42232b480f36
gallium: Add a nir-to-TGSI pass.

The goal is to replace glsl_to_tgsi.cpp and its supporting code (~10k
LOC).  This code ends up being smaller because NIR has many lowering
passes that help it map better to TGSI than GLSL IR does.

As a benefit, this brings NIR optimizations to TGSI-only drivers.
Many of the softpipe shaders I've looked at end up being significantly
shorter.  Some potentially relevant changes to TGSI consumers:

- All immediates are now UINT typed.  This means they're less legible
  in printouts, but means that they get deduplicated better (no more
  multiple copies of 0x0!)
- Sampler views are not currently declared.
- nir_registers don't have their live ranges tracked, so TGSI temp usage
  may go up with a lot of control flow.
- nir_lower_vec_to_mov naively inserts movs instead of trying to coalesce
  the movs with the generators of the ssa values, sometimes increasing
  instruction count.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3395>
src/gallium/auxiliary/Makefile.sources
src/gallium/auxiliary/meson.build
src/gallium/auxiliary/nir/nir_to_tgsi.c [new file with mode: 0644]
src/gallium/auxiliary/nir/nir_to_tgsi.h [new file with mode: 0644]