Mesa (master): gallium: add an inline that returns number of vertices per primitive
Zack Rusin
zack at kemper.freedesktop.org
Fri Dec 25 10:55:45 UTC 2009
Module: Mesa
Branch: master
Commit: f658fa5e8febc41836980ad1b4cb385445833a02
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f658fa5e8febc41836980ad1b4cb385445833a02
Author: Zack Rusin <zackr at vmware.com>
Date: Wed Dec 23 12:39:21 2009 -0500
gallium: add an inline that returns number of vertices per primitive
---
src/gallium/include/pipe/p_inlines.h | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 5fbd62a..95ec55d 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -192,6 +192,38 @@ pipe_transfer_buffer_flags( struct pipe_transfer *transf )
}
}
+static INLINE unsigned
+pipe_vertices_per_primitive(int primitive)
+{
+ switch(primitive) {
+ case PIPE_PRIM_POINTS:
+ return 1;
+ case PIPE_PRIM_LINES:
+ case PIPE_PRIM_LINE_LOOP:
+ case PIPE_PRIM_LINE_STRIP:
+ return 2;
+ case PIPE_PRIM_TRIANGLES:
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ case PIPE_PRIM_TRIANGLE_FAN:
+ return 3;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ return 4;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ return 6;
+
+ /* following primitives should never be used
+ * with geometry shaders */
+ case PIPE_PRIM_POLYGON:
+ case PIPE_PRIM_QUADS:
+ case PIPE_PRIM_QUAD_STRIP:
+ default:
+ debug_printf("Unrecognized geometry shader primitive");
+ return 3;
+ }
+}
+
#ifdef __cplusplus
}
#endif
More information about the mesa-commit
mailing list