summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_prim.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h
index ae05788702c..d80e235ffd9 100644
--- a/src/gallium/auxiliary/util/u_prim.h
+++ b/src/gallium/auxiliary/util/u_prim.h
@@ -327,6 +327,25 @@ u_vertices_for_prims(enum pipe_prim_type prim_type, int count)
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);