Skip to content

radv: Lower NGG shaders in NIR

Timur Kristóf requested to merge Venemo/mesa:radv-ngg-lowering into main

This MR refactors our NGG code. It teaches NIR how the hardware works.

(Content taken from MR !10525 (merged) so that we can merge it is smaller chunks.)

About the NIR NGG lowering:

  • New intrinsics are added so that NIR becomes aware of things like ES/GS threads, gs_alloc_req etc.
  • The generated code for VS/TES (without culling) is almost identical to what was there before
  • NGG GS is slightly less optimal, but not by much
  • The new intrinsics also make it possible for us to support mesh shaders in the future with little effort.

Future work, not included in this MR

  • Add some micro-optimizations to the emitted code. (I have a list.)
  • Implement the new NIR intrinsics in LLVM, therefore simplifying the RADV/LLVM backend.
  • Implement NGG streamout in the new NIR lowering functions.
Edited by Timur Kristóf

Merge request reports