nir: Add common task shader lowering to make the backend's job easier.
authorTimur Kristóf <timur.kristof@gmail.com>
Thu, 26 May 2022 11:20:36 +0000 (13:20 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 27 May 2022 07:52:03 +0000 (07:52 +0000)
commit8aff8d3dd42ecc399f1d7d23ddd641e7e3fce777
treec50cc23c6918e8609e3793b7419f26981c14a213
parent9eaf918ed29def18162a83fcf8f312561a739d59
nir: Add common task shader lowering to make the backend's job easier.

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.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16720>
src/compiler/nir/meson.build
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_task_shader.c [new file with mode: 0644]