vtn: add mesh output and task_payload to vtn_mode_is_cross_invocation
authorRhys Perry <pendingchaos02@gmail.com>
Wed, 9 Nov 2022 16:22:27 +0000 (16:22 +0000)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Dec 2022 20:56:52 +0000 (20:56 +0000)
This fixes a potential race condition, and removes output loads (which
should not exist in the EXT_mesh_shader).

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7391
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19597>

src/compiler/spirv/vtn_variables.c

index b536ae2..9665d44 100644 (file)
@@ -179,12 +179,16 @@ static bool
 vtn_mode_is_cross_invocation(struct vtn_builder *b,
                              enum vtn_variable_mode mode)
 {
+   /* TODO: add TCS here once nir_remove_unused_io_vars() can handle vector indexing. */
+   bool cross_invocation_outputs = b->shader->info.stage == MESA_SHADER_MESH;
    return mode == vtn_variable_mode_ssbo ||
           mode == vtn_variable_mode_ubo ||
           mode == vtn_variable_mode_phys_ssbo ||
           mode == vtn_variable_mode_push_constant ||
           mode == vtn_variable_mode_workgroup ||
-          mode == vtn_variable_mode_cross_workgroup;
+          mode == vtn_variable_mode_cross_workgroup ||
+          (cross_invocation_outputs && mode == vtn_variable_mode_output) ||
+          (b->shader->info.stage == MESA_SHADER_TASK && mode == vtn_variable_mode_task_payload);
 }
 
 static bool