summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2013-04-11 06:11:29 -0700
committerZack Rusin <zackr@vmware.com>2013-04-16 23:38:47 -0700
commit80ee4a407a2668f6a6a410c3e56ae9910510f773 (patch)
treefef704d3c130eb615a0e9f4d9631288d45513749 /src/gallium/auxiliary/util
parentb739376cffec19870804b1ebd4bef3c2f654e943 (diff)
downloadexternal_mesa3d-80ee4a407a2668f6a6a410c3e56ae9910510f773.zip
external_mesa3d-80ee4a407a2668f6a6a410c3e56ae9910510f773.tar.gz
external_mesa3d-80ee4a407a2668f6a6a410c3e56ae9910510f773.tar.bz2
draw: implement pipeline statistics in the draw module
This is a basic implementation of the pipeline statistics in the draw module. The interface is similar to the stream output statistics and also requires that the callers explicitly enable it. Included is the implementation of the interface in llvmpipe and softpipe. Only softpipe enables the pipeline statistics capability though because llvmpipe is lacking gathering of the fragment shading and rasterization statistics. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_prim.h35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h
index d62c636..99bb66c 100644
--- a/src/gallium/auxiliary/util/u_prim.h
+++ b/src/gallium/auxiliary/util/u_prim.h
@@ -165,12 +165,14 @@ u_vertices_per_prim(int primitive)
/**
* Returns the number of decomposed primitives for the given
* vertex count.
- * Geometry shader is invoked once for each triangle in
+ * Parts of the pipline are invoked once for each triangle in
* triangle strip, triangle fans and triangles and once
- * for each line in line strip, line loop, lines.
+ * for each line in line strip, line loop, lines. Also
+ * statistics depend on knowing the exact number of decomposed
+ * primitives for a set of vertices.
*/
static INLINE unsigned
-u_gs_prims_for_vertices(int primitive, int vertices)
+u_decomposed_prims_for_vertices(int primitive, int vertices)
{
switch(primitive) {
case PIPE_PRIM_POINTS:
@@ -180,31 +182,34 @@ u_gs_prims_for_vertices(int primitive, int vertices)
case PIPE_PRIM_LINE_LOOP:
return vertices;
case PIPE_PRIM_LINE_STRIP:
- return vertices - 1;
+ return (vertices > 1) ? vertices - 1 : 0;
case PIPE_PRIM_TRIANGLES:
return vertices / 3;
case PIPE_PRIM_TRIANGLE_STRIP:
- return vertices - 2;
+ return (vertices > 2) ? vertices - 2 : 0;
case PIPE_PRIM_TRIANGLE_FAN:
- return vertices - 2;
+ return (vertices > 2) ? vertices - 2 : 0;
case PIPE_PRIM_LINES_ADJACENCY:
return vertices / 2;
case PIPE_PRIM_LINE_STRIP_ADJACENCY:
- return vertices - 1;
+ return (vertices > 1) ? vertices - 1 : 0;
case PIPE_PRIM_TRIANGLES_ADJACENCY:
return vertices / 3;
case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
- return vertices - 2;
-
- /* following primitives should never be used
- * with geometry shaders abd their size is
- * undefined */
- case PIPE_PRIM_POLYGON:
+ return (vertices > 2) ? vertices - 2 : 0;
case PIPE_PRIM_QUADS:
+ return vertices / 4;
case PIPE_PRIM_QUAD_STRIP:
+ return (vertices > 4) ? (vertices - 2) / 2 : 0;
+ /* Polygons can't be decomposed
+ * because the number of their vertices isn't known so
+ * for them and whatever else we don't recognize just
+ * return 1 if the number of vertices is greater than
+ * 3 and zero otherwise */
+ case PIPE_PRIM_POLYGON:
default:
- debug_printf("Unrecognized geometry shader primitive");
- return 3;
+ debug_printf("Invalid decomposition primitive!\n");
+ return (vertices > 3) ? 1 : 0;
}
}