draw_pt_varray_tmp_linear.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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, unsigned count)


Function Documentation

static void FUNC ( struct draw_pt_front_end frontend,
pt_elt_func  get_elt,
const void *  elts,
unsigned  count 
) [static]

Definition at line 6 of file draw_pt_varray_tmp_linear.h.

References assert, debug_printf(), draw_pt_split_prim(), varray_frontend::driver_fetch_max, varray_frontend::fetch_max, varray_frontend::input_prim, MIN2, PIPE_PRIM_LINE_LOOP, PIPE_PRIM_LINE_STRIP, PIPE_PRIM_LINES, PIPE_PRIM_POINTS, PIPE_PRIM_POLYGON, PIPE_PRIM_QUAD_STRIP, PIPE_PRIM_QUADS, PIPE_PRIM_TRIANGLE_FAN, PIPE_PRIM_TRIANGLE_STRIP, PIPE_PRIM_TRIANGLES, trim(), varray_fan_segment(), varray_flush_linear(), and varray_line_loop_segment().

00010 {
00011    struct varray_frontend *varray = (struct varray_frontend *)frontend;
00012    unsigned start = (unsigned) ((char *) elts - (char *) NULL);
00013 
00014    unsigned j;
00015    unsigned first, incr;
00016 
00017    draw_pt_split_prim(varray->input_prim, &first, &incr);
00018    
00019    /* Sanitize primitive length:
00020     */
00021    count = trim(count, first, incr); 
00022    if (count < first)
00023       return;
00024 
00025 #if 0
00026    debug_printf("%s (%d) %d/%d\n", __FUNCTION__,
00027                 varray->input_prim,
00028                 start, count);
00029 #endif
00030 
00031    switch (varray->input_prim) {
00032    case PIPE_PRIM_POINTS:
00033    case PIPE_PRIM_LINES:
00034    case PIPE_PRIM_TRIANGLES:
00035    case PIPE_PRIM_LINE_STRIP:
00036    case PIPE_PRIM_TRIANGLE_STRIP:
00037    case PIPE_PRIM_QUADS:
00038    case PIPE_PRIM_QUAD_STRIP:
00039       for (j = 0; j < count;) {
00040          unsigned remaining = count - j;
00041          unsigned nr = trim( MIN2(varray->driver_fetch_max, remaining), first, incr );
00042          varray_flush_linear(varray, start + j, nr);
00043          j += nr;
00044          if (nr != remaining) 
00045             j -= (first - incr);
00046       }
00047       break;
00048 
00049    case PIPE_PRIM_LINE_LOOP:
00050       /* Always have to decompose as we've stated that this will be
00051        * emitted as a line-strip.
00052        */
00053       for (j = 0; j < count;) {
00054          unsigned remaining = count - j;
00055          unsigned nr = trim( MIN2(varray->fetch_max-1, remaining), first, incr );
00056          varray_line_loop_segment(varray, start, j, nr, nr == remaining);
00057          j += nr;
00058          if (nr != remaining) 
00059             j -= (first - incr);
00060       }
00061       break;
00062 
00063 
00064    case PIPE_PRIM_POLYGON:
00065    case PIPE_PRIM_TRIANGLE_FAN: 
00066       if (count < varray->driver_fetch_max) {
00067          varray_flush_linear(varray, start, count);
00068       }
00069       else {
00070          for ( j = 0; j < count;) {
00071             unsigned remaining = count - j;
00072             unsigned nr = trim( MIN2(varray->fetch_max-1, remaining), first, incr );
00073             varray_fan_segment(varray, start, j, nr);
00074             j += nr;
00075             if (nr != remaining) 
00076                j -= (first - incr);
00077          }
00078       }
00079       break;
00080 
00081    default:
00082       assert(0);
00083       break;
00084    }
00085 }

static unsigned trim ( unsigned  count,
unsigned  first,
unsigned  incr 
) [static]

Definition at line 1 of file draw_pt_varray_tmp_linear.h.

00002 {
00003    return count - (count - first) % incr; 
00004 }


Generated on Tue Sep 29 06:25:21 2009 for Gallium3D by  doxygen 1.5.4