compiler: Extract num_mesh_vertices_per_primitive function.

Prevent code duplication.

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/15005>
This commit is contained in:
Timur Kristóf
2022-02-14 10:44:28 +01:00
parent 32155851f1
commit 0445802ab2
4 changed files with 24 additions and 19 deletions
+2 -14
View File
@@ -300,20 +300,8 @@ brw_compute_mue_map(struct nir_shader *nir, struct brw_mue_map *map)
for (int i = 0; i < VARYING_SLOT_MAX; i++)
map->start_dw[i] = -1;
unsigned vertices_per_primitive = 0;
switch (nir->info.mesh.primitive_type) {
case SHADER_PRIM_POINTS:
vertices_per_primitive = 1;
break;
case SHADER_PRIM_LINES:
vertices_per_primitive = 2;
break;
case SHADER_PRIM_TRIANGLES:
vertices_per_primitive = 3;
break;
default:
unreachable("invalid primitive type");
}
unsigned vertices_per_primitive =
num_mesh_vertices_per_primitive(nir->info.mesh.primitive_type);
map->max_primitives = nir->info.mesh.max_primitives_out;
map->max_vertices = nir->info.mesh.max_vertices_out;