mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
util/prim: add u_reduced_prims_for_vertices()
The function returns the number of reduced/tessellated primitives for the given vertex count. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Acked-by: Zack Rusin <zackr@vmware.com>
This commit is contained in:
parent
90d5190594
commit
f87dccdc19
1 changed files with 20 additions and 0 deletions
|
|
@ -243,6 +243,26 @@ u_decomposed_prims_for_vertices(int primitive, int vertices)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of reduced/tessellated primitives for the given vertex
|
||||
* count. Each quad is treated as two triangles. Polygons are treated as
|
||||
* triangle fans.
|
||||
*/
|
||||
static INLINE unsigned
|
||||
u_reduced_prims_for_vertices(int primitive, int vertices)
|
||||
{
|
||||
switch (primitive) {
|
||||
case PIPE_PRIM_QUADS:
|
||||
case PIPE_PRIM_QUAD_STRIP:
|
||||
return u_decomposed_prims_for_vertices(primitive, vertices) * 2;
|
||||
case PIPE_PRIM_POLYGON:
|
||||
primitive = PIPE_PRIM_TRIANGLE_FAN;
|
||||
/* fall through */
|
||||
default:
|
||||
return u_decomposed_prims_for_vertices(primitive, vertices);
|
||||
}
|
||||
}
|
||||
|
||||
const char *u_prim_name( unsigned pipe_prim );
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue