From 7346ab3b4344d648b2fd7fffe3b89b0b8923a26c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 2 May 2013 14:32:30 +0800 Subject: [PATCH] ilo: use u_reduced_prims_for_vertices() We do not need our own prim_count() anymore. --- src/gallium/drivers/ilo/ilo_3d_pipeline.c | 69 +---------------------- 1 file changed, 1 insertion(+), 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; -- 2.30.2