compiler,gallium: move u_reduced_prim to common

Useful function that even Vulkan drivers can use.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28171>
This commit is contained in:
Juan A. Suarez Romero 2024-03-14 22:15:38 +01:00 committed by Marge Bot
parent 7a236dc785
commit d6553bf177
2 changed files with 21 additions and 21 deletions

View file

@ -1316,6 +1316,27 @@ u_decomposed_prim(enum mesa_prim prim)
}
}
/**
* Reduce a primitive to one of MESA_PRIM_POINTS, MESA_PRIM_LINES, and
* MESA_PRIM_TRIANGLES.
*/
static inline enum mesa_prim
u_reduced_prim(enum mesa_prim prim)
{
switch (prim) {
case MESA_PRIM_POINTS:
return MESA_PRIM_POINTS;
case MESA_PRIM_LINES:
case MESA_PRIM_LINE_LOOP:
case MESA_PRIM_LINE_STRIP:
case MESA_PRIM_LINES_ADJACENCY:
case MESA_PRIM_LINE_STRIP_ADJACENCY:
return MESA_PRIM_LINES;
default:
return MESA_PRIM_TRIANGLES;
}
}
/**
* A compare function enum for use in compiler lowering passes. This is in
* the same order as GL's compare functions (shifted down by GL_NEVER), and is

View file

@ -44,27 +44,6 @@ struct u_prim_vertex_count {
unsigned incr;
};
/**
* Reduce a primitive to one of MESA_PRIM_POINTS, MESA_PRIM_LINES, and
* MESA_PRIM_TRIANGLES.
*/
static inline enum mesa_prim
u_reduced_prim(enum mesa_prim prim)
{
switch (prim) {
case MESA_PRIM_POINTS:
return MESA_PRIM_POINTS;
case MESA_PRIM_LINES:
case MESA_PRIM_LINE_LOOP:
case MESA_PRIM_LINE_STRIP:
case MESA_PRIM_LINES_ADJACENCY:
case MESA_PRIM_LINE_STRIP_ADJACENCY:
return MESA_PRIM_LINES;
default:
return MESA_PRIM_TRIANGLES;
}
}
/**
* Re-assemble a primitive to remove its adjacency.
*/