summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-07-18 16:53:57 +0800
committerChia-I Wu <olv@lunarg.com>2010-08-16 20:46:27 +0800
commit9d2be38fad109d9a10942fddde0b9dc3824c329c (patch)
tree2c1cac6cdc8095fa1c2bff7051c0c2795335b74e
parentf132498347c41294042db0cc6830abe928d827de (diff)
draw: Simplify frontend interface a little.
The run method is simplified to take the start vertex and the vertex count.
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h4
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h7
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h7
5 files changed, 11 insertions, 21 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 248927505d..ded94bb575 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 8d69b8c8c8..42c4f83272 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 55e43b2a71..fc54476488 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 0a9ec7ce6c..993f388dc3 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 8a841e83f2..e80a9c7f15 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;