draw: Simplify frontend interface a little.
authorChia-I Wu <olv@lunarg.com>
Sun, 18 Jul 2010 08:53:57 +0000 (16:53 +0800)
committerChia-I Wu <olv@lunarg.com>
Mon, 16 Aug 2010 12:46:27 +0000 (20:46 +0800)
The run method is simplified to take the start vertex and the vertex
count.

src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt.h
src/gallium/auxiliary/draw/draw_pt_varray_tmp_linear.h
src/gallium/auxiliary/draw/draw_pt_vcache.c
src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h

index 248927505da2d7d4d731be74bfeba7fa735b39d4..ded94bb575c4d7acf2382e356000c765557c232e 100644 (file)
@@ -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 );
 
index 8d69b8c8c8d3547af07b5285da2da4d2a956009a..42c4f83272d598d31f32e80e860e105826b02e5c 100644 (file)
@@ -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 * );
index 55e43b2a714e86e65a697b1394c0ffef0e54150c..fc544764886d3e9417a7980a8060c5a927a32fea 100644 (file)
@@ -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:
index 0a9ec7ce6c16461f5f1bf7a7ed3ad4c78e1028cc..993f388dc37d73590d78b494d522adad7bd4ff57 100644 (file)
@@ -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 );
 }
 
 
index 8a841e83f2a7c66533f43315830a1808fc2d907f..e80a9c7f159792d8de08aefe37c5cdf6e77646c1 100644 (file)
@@ -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;