tu: Use NIR for clear/blit shaders
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 27 Jul 2021 13:35:03 +0000 (15:35 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 29 Jul 2021 23:20:18 +0000 (23:20 +0000)
commitfc0c0e9d459344218933e68e416baf575612548a
tree440934bff0053e7d865723a2392e911356434265
parentdf338fe7d1ebe3caa7a6ad2168a103835577c4c6
tu: Use NIR for clear/blit shaders

This is much more maintainable, extensible, and easy to read than
hand-rolled structs approximating assembly. This also removes the last
use of the old hand-written packing structs. There are a few minor
differences:

- The shaders are larger because ir3 currently doesn't support (rpt),
  which means that some shaders are larger than one instrlen and the
  current logic has to be extended to allow for that. This seems a small
  price to pay, ir3 will gain support for (rpt) eventually, and we
  shouldn't have limitations like this baked in anyway. For example some
  GL blob r8g8 <-> r16 copy shaders are apparently quite large.
- Due to the inability to switch inputs/outputs on the fly, we need to
  split the VS into two variants. I made the layer-writing variant also
  used for other clears, because the old method of overloading c0.z/c1.z
  to mean both "src x coordinate" and "z clear value" in the same shader
  seemed too clever and I didn't want to add yet another variant. This
  means that non-layered clears will also write the layer (to 0), but
  that shouldn't be a big deal performance-wise.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12079>
src/freedreno/vulkan/tu_clear_blit.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_private.h