From 9d2be38fad109d9a10942fddde0b9dc3824c329c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 18 Jul 2010 16:53:57 +0800 Subject: draw: Simplify frontend interface a little. The run method is simplified to take the start vertex and the vertex count. --- src/gallium/auxiliary/draw/draw_pt.c | 6 +----- src/gallium/auxiliary/draw/draw_pt.h | 4 +--- src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h | 7 +------ src/gallium/auxiliary/draw/draw_pt_vcache.c | 8 ++++---- src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h | 7 ++++--- 5 files changed, 11 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 248927505da..ded94bb575c 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -126,11 +126,7 @@ draw_pt_arrays(struct draw_context *draw, frontend->prepare( frontend, prim, middle, opt ); - frontend->run(frontend, - draw_pt_elt_func(draw), - draw_pt_elt_ptr(draw, start), - draw->pt.user.eltBias, - count); + frontend->run(frontend, start, count); frontend->finish( frontend ); diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 8d69b8c8c8d..42c4f83272d 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -67,9 +67,7 @@ struct draw_pt_front_end { unsigned opt ); void (*run)( struct draw_pt_front_end *, - pt_elt_func elt_func, - const void *elt_ptr, - int elt_bias, + unsigned start, unsigned count ); void (*finish)( struct draw_pt_front_end * ); diff --git a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h index 55e43b2a714..fc544764886 100644 --- a/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h +++ b/src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h @@ -9,19 +9,14 @@ static unsigned trim( unsigned count, unsigned first, unsigned incr ) } static void FUNC(struct draw_pt_front_end *frontend, - pt_elt_func get_elt, - const void *elts, - int elt_bias, + unsigned start, unsigned count) { struct varray_frontend *varray = (struct varray_frontend *)frontend; - unsigned start = (unsigned) ((char *) elts - (char *) NULL); unsigned j; unsigned first, incr; - assert(elt_bias == 0); - draw_pt_split_prim(varray->input_prim, &first, &incr); /* Sanitize primitive length: diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index 0a9ec7ce6c1..993f388dc37 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -369,9 +369,7 @@ any_instance_divisors(const struct draw_context *draw) static INLINE void vcache_check_run( struct draw_pt_front_end *frontend, - pt_elt_func get_elt, - const void *elts, - int elt_bias, + unsigned draw_start, unsigned draw_count ) { struct vcache_frontend *vcache = (struct vcache_frontend *)frontend; @@ -379,10 +377,12 @@ vcache_check_run( struct draw_pt_front_end *frontend, const unsigned min_index = draw->pt.user.min_index; const unsigned max_index = draw->pt.user.max_index; const unsigned index_size = draw->pt.user.eltSize; + const int elt_bias = draw->pt.user.eltBias; unsigned fetch_count; const ushort *transformed_elts; ushort *storage = NULL; boolean ok = FALSE; + const void *elts = draw_pt_elt_ptr(draw, draw_start); /* debug: verify indexes are in range [min_index, max_index] */ if (0) { @@ -521,7 +521,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, fetch_count, draw_count); fail: - vcache_run( frontend, get_elt, elts, elt_bias, draw_count ); + vcache_run( frontend, draw_start, draw_count ); } diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h index 8a841e83f2a..e80a9c7f159 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h @@ -1,14 +1,15 @@ #define FUNC_VARS \ struct draw_pt_front_end *frontend, \ - pt_elt_func get_elt, \ - const void *elts, \ - int elt_bias, \ + unsigned start, \ unsigned count #define LOCAL_VARS \ struct vcache_frontend *vcache = (struct vcache_frontend *) frontend; \ struct draw_context *draw = vcache->draw; \ const unsigned prim = vcache->input_prim; \ + const void *elts = draw_pt_elt_ptr(draw, start); \ + pt_elt_func get_elt = draw_pt_elt_func(draw); \ + const int elt_bias = draw->pt.user.eltBias; \ const boolean last_vertex_last = !(draw->rasterizer->flatshade && \ draw->rasterizer->flatshade_first); \ const unsigned prim_flags = 0x0; -- cgit v1.2.3