ac/nir/taskmesh: Preserve workgroup ID Y and Z when applying firstTask.

NV_mesh_shader workgroups are only 1 dimensional, so it's OK to
only add firstTask to the X dimension.
However, let's keep the Y and Z dimensions so this doesn't mess up
the workgroup ID for future 3 dimensional task shader dispatches.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17023>
This commit is contained in:
Timur Kristóf 2022-02-28 14:22:09 +01:00 committed by Marge Bot
parent b243e94f07
commit 0fb9573c57
1 changed files with 4 additions and 2 deletions

View File

@ -124,10 +124,12 @@ ac_nir_apply_first_task_to_task_shader(nir_shader *shader)
nir_pop_if(b, if_stride);
first_task = nir_if_phi(b, first_task, zero);
/* NV_mesh_shader workgroups are 1 dimensional so we only care about X here. */
/* NV_mesh_shader workgroups are 1 dimensional.
* Apply firstTask to the X dimension, but leave Y and Z intact.
*/
nir_ssa_def *hw_workgroup_id = nir_load_workgroup_id(b, 32);
nir_ssa_def *api_workgroup_id_x = nir_iadd(b, nir_channel(b, hw_workgroup_id, 0), first_task);
nir_ssa_def *api_workgroup_id = nir_vec3(b, api_workgroup_id_x, zero, zero);
nir_ssa_def *api_workgroup_id = nir_vector_insert_imm(b, hw_workgroup_id, api_workgroup_id_x, 0);
add_first_task_to_workgroup_id_state state = {
.hw_workgroup_id = hw_workgroup_id,