nir: Add common task shader lowering to make the backend's job easier.
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.
- Lowers NV_mesh_shader
TASK_COUNT
output tolaunch_mesh_workgroups
. - Removes all code after
launch_mesh_workgroups
, enforcing the fact that it's a terminating instruction. - 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. - 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.