Skip to content

nir: Add common task shader lowering to make the backend's job easier.

Timur Kristóf requested to merge Venemo/mesa:nir_lower_task_shader into main

Add a new intrinsic launch_mesh_workgroups which supercedes the TASK_COUNT output.

On top of that, add a new nir_lower_task_shader which contains common code that is potentially useful to all backends.

  1. Lowers NV_mesh_shader TASK_COUNT output to launch_mesh_workgroups.
  2. Removes all code after launch_mesh_workgroups, enforcing the fact that it's a terminating instruction.
  3. Ensures that task shaders always have at least one launch_mesh_workgroups instruction, so the backend doesn't need to implement a special case when the shader doesn't have it.
  4. Optionally, implements task_payload using shared memory when task_payload atomics are used. This is useful when the backend is otherwise not capable of handling the same atomic features as it can for shared memory. If this is used, the backend only has to implement the basic load/store operations for task_payload.

Usage of this new pass will be part of a follow-up MR.

Merge request reports