diff options
author | Chia-I Wu <[email protected]> | 2013-05-02 13:49:30 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-05-03 11:59:10 +0800 |
commit | 30671cecc0817ffe59b47e8f70b584bb55447f5d (patch) | |
tree | b7cadb8aab23348c03e739682922613b4050c80c /src/gallium/auxiliary/util | |
parent | ddf0e3930fc7b52ff6a172a5d23eec7d24ee42fc (diff) |
util/prim: use vertex count info in u_validate_pipe_prim()
As a side effect, primitives with adjacency are now correctly validated.
Signed-off-by: Chia-I Wu <[email protected]>
Acked-by: Zack Rusin <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_prim.h | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h index 7415e76c1e7..94312c2f4c5 100644 --- a/src/gallium/auxiliary/util/u_prim.h +++ b/src/gallium/auxiliary/util/u_prim.h @@ -138,39 +138,9 @@ u_prim_vertex_count(unsigned prim) static INLINE boolean u_validate_pipe_prim( unsigned pipe_prim, unsigned nr ) { - boolean ok = TRUE; - - switch (pipe_prim) { - case PIPE_PRIM_POINTS: - ok = (nr >= 1); - break; - case PIPE_PRIM_LINES: - ok = (nr >= 2); - break; - case PIPE_PRIM_LINE_STRIP: - case PIPE_PRIM_LINE_LOOP: - ok = (nr >= 2); - break; - case PIPE_PRIM_TRIANGLES: - ok = (nr >= 3); - break; - case PIPE_PRIM_TRIANGLE_STRIP: - case PIPE_PRIM_TRIANGLE_FAN: - case PIPE_PRIM_POLYGON: - ok = (nr >= 3); - break; - case PIPE_PRIM_QUADS: - ok = (nr >= 4); - break; - case PIPE_PRIM_QUAD_STRIP: - ok = (nr >= 4); - break; - default: - ok = 0; - break; - } + const struct u_prim_vertex_count *count = u_prim_vertex_count(pipe_prim); - return ok; + return (count && nr >= count->min); } |