aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-04-18 03:08:41 -0700
committerZack Rusin <[email protected]>2013-04-18 11:51:22 -0700
commit12eab7cc564a6928197f9b87ded9e368e56976f0 (patch)
treee4d157930258f4cfe4ab173cf178ea9b7e51478f /src/gallium/auxiliary/util
parente4752d0f56b90a5565936b1e05bb48edb1baa3ac (diff)
draw: implement primitive assembler
Input assembler needs to be able to decompose adjacency primitives into something that can be understood by the rest of the pipeline. The specs say that the adjacency primitives are *only* visible in the geometry shader, for everything else they need to be decomposed. Which in most of the cases is not an issue, because the geometry shader always decomposes them for us, but without geometry shader we were passing unchanged adjacency primitives to the rest of the pipeline and causing crashes everywhere. This commit introduces a primitive assembler which, if geometry shader is missing and the input primitive is one of the adjacency primitives, decomposes them into something that the rest of the pipeline can understand. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_prim.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h
index 507d12e8096..e4774442c81 100644
--- a/src/gallium/auxiliary/util/u_prim.h
+++ b/src/gallium/auxiliary/util/u_prim.h
@@ -213,6 +213,27 @@ u_decomposed_prims_for_vertices(int primitive, int vertices)
}
}
+static INLINE unsigned
+u_assembled_primitive(unsigned prim)
+{
+ switch (prim) {
+ case PIPE_PRIM_LINES_ADJACENCY:
+ return PIPE_PRIM_LINES;
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ return PIPE_PRIM_LINES;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ return PIPE_PRIM_TRIANGLES;
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ return PIPE_PRIM_TRIANGLES;
+ default:
+ return prim;
+ }
+
+ return prim;
+}
+
+
+
const char *u_prim_name( unsigned pipe_prim );
#endif