aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-05-02 14:32:30 +0800
committerChia-I Wu <[email protected]>2013-05-03 11:59:10 +0800
commit7346ab3b4344d648b2fd7fffe3b89b0b8923a26c (patch)
tree74e2b6e3cc4da5190336eb094aa242d55398e882 /src/gallium
parentf87dccdc19416fd8d47b995f9b0f0c54534bfd16 (diff)
ilo: use u_reduced_prims_for_vertices()
We do not need our own prim_count() anymore.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline.c69
1 files changed, 1 insertions, 68 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.c b/src/gallium/drivers/ilo/ilo_3d_pipeline.c
index bbdf180d66e..2515357e25b 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.c
@@ -143,73 +143,6 @@ handle_invalid_batch_bo(struct ilo_3d_pipeline *p, bool unset)
}
}
-/* XXX move to u_prim.h */
-static unsigned
-prim_count(unsigned prim, unsigned num_verts)
-{
- unsigned num_prims;
-
- u_trim_pipe_prim(prim, &num_verts);
-
- switch (prim) {
- case PIPE_PRIM_POINTS:
- num_prims = num_verts;
- break;
- case PIPE_PRIM_LINES:
- num_prims = num_verts / 2;
- break;
- case PIPE_PRIM_LINE_LOOP:
- num_prims = num_verts;
- break;
- case PIPE_PRIM_LINE_STRIP:
- num_prims = num_verts - 1;
- break;
- case PIPE_PRIM_TRIANGLES:
- num_prims = num_verts / 3;
- break;
- case PIPE_PRIM_TRIANGLE_STRIP:
- case PIPE_PRIM_TRIANGLE_FAN:
- num_prims = num_verts - 2;
- break;
- case PIPE_PRIM_QUADS:
- num_prims = (num_verts / 4) * 2;
- break;
- case PIPE_PRIM_QUAD_STRIP:
- num_prims = (num_verts / 2 - 1) * 2;
- break;
- case PIPE_PRIM_POLYGON:
- num_prims = num_verts - 2;
- break;
- case PIPE_PRIM_LINES_ADJACENCY:
- num_prims = num_verts / 4;
- break;
- case PIPE_PRIM_LINE_STRIP_ADJACENCY:
- num_prims = num_verts - 3;
- break;
- case PIPE_PRIM_TRIANGLES_ADJACENCY:
- /* u_trim_pipe_prim is wrong? */
- num_verts += 1;
-
- num_prims = num_verts / 6;
- break;
- case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
- /* u_trim_pipe_prim is wrong? */
- if (num_verts >= 6)
- num_verts -= (num_verts % 2);
- else
- num_verts = 0;
-
- num_prims = (num_verts / 2 - 2);
- break;
- default:
- assert(!"unknown pipe prim");
- num_prims = 0;
- break;
- }
-
- return num_prims;
-}
-
/**
* Emit context states and 3DPRIMITIVE.
*/
@@ -275,7 +208,7 @@ ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p,
const int num_verts = u_vertices_per_prim(u_reduced_prim(info->mode));
const int max_emit =
(p->state.so_max_vertices - p->state.so_num_vertices) / num_verts;
- const int generated = prim_count(info->mode, info->count);
+ const int generated = u_reduced_prims_for_vertices(info->mode, info->count);
const int emitted = MIN2(generated, max_emit);
p->state.so_num_vertices += emitted * num_verts;