spirv: Support EXT_mesh_shader SetMeshOutputsEXT.
authorTimur Kristóf <timur.kristof@gmail.com>
Thu, 20 Jan 2022 15:35:23 +0000 (16:35 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 16:18:33 +0000 (16:18 +0000)
Use the set_vertex_and_primitive_count intrinsic to
express the number of vertices and primitives that the
mesh shader workgroup outputs.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18366>

src/compiler/spirv/spirv_to_nir.c

index a227e4c..a25843c 100644 (file)
@@ -6284,6 +6284,11 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
       vtn_handle_write_packed_primitive_indices(b, opcode, w, count);
       break;
 
+   case SpvOpSetMeshOutputsEXT:
+      nir_set_vertex_and_primitive_count(
+         &b->nb, vtn_get_nir_ssa(b, w[1]), vtn_get_nir_ssa(b, w[2]));
+      break;
+
    default:
       vtn_fail_with_opcode("Unhandled opcode", opcode);
    }