mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 16:18:06 +02:00
gallium/util: Add u_stream_outputs_for_vertices helper
This u_prim.h helper determines the number of outputs for stream output, given a particular primitive type and a vertex count. This is useful for statically calculating sizes of stream output buffers (i.e. when there is no geometry/tessellation shader in use). This helper will be used in Panfrost's transform feedback implementation, as you can probably guess since why else would I be submitting it.... See also dEQP's getTransformFeedbackOutputCount routine. v2: Simplify definition using new helpers, which also extends to non-ES2 primitive types (Eric). Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
8ce4f9bbc3
commit
e881aa8c12
1 changed files with 19 additions and 0 deletions
|
|
@ -327,6 +327,25 @@ u_vertices_for_prims(enum pipe_prim_type prim_type, int count)
|
||||||
return info->min + (count - 1) * info->incr;
|
return info->min + (count - 1) * info->incr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of stream out outputs for a given number of vertices and
|
||||||
|
* primitive type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline unsigned
|
||||||
|
u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr)
|
||||||
|
{
|
||||||
|
/* Extraneous vertices don't contribute to stream outputs */
|
||||||
|
u_trim_pipe_prim(primitive, &nr);
|
||||||
|
|
||||||
|
/* Consider how many primitives are actually generated */
|
||||||
|
unsigned prims = u_decomposed_prims_for_vertices(primitive, nr);
|
||||||
|
|
||||||
|
/* One output per vertex after decomposition */
|
||||||
|
enum pipe_prim_type base = u_base_prim_type(primitive);
|
||||||
|
return u_vertices_for_prims(base, prims);
|
||||||
|
}
|
||||||
|
|
||||||
const char *u_prim_name(enum pipe_prim_type pipe_prim);
|
const char *u_prim_name(enum pipe_prim_type pipe_prim);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue