1 static unsigned trim( unsigned count
, unsigned first
, unsigned incr
)
3 return count
- (count
- first
) % incr
;
6 static void FUNC(struct draw_pt_front_end
*frontend
,
11 struct varray_frontend
*varray
= (struct varray_frontend
*)frontend
;
12 unsigned start
= (unsigned)elts
;
17 draw_pt_split_prim(varray
->input_prim
, &first
, &incr
);
19 /* Sanitize primitive length:
21 count
= trim(count
, first
, incr
);
26 debug_printf("%s (%d) %d/%d\n", __FUNCTION__
,
31 switch (varray
->input_prim
) {
32 case PIPE_PRIM_POINTS
:
34 case PIPE_PRIM_TRIANGLES
:
35 case PIPE_PRIM_LINE_STRIP
:
36 case PIPE_PRIM_TRIANGLE_STRIP
:
38 case PIPE_PRIM_QUAD_STRIP
:
39 for (j
= 0; j
< count
;) {
40 unsigned remaining
= count
- j
;
41 unsigned nr
= trim( MIN2(varray
->driver_fetch_max
, remaining
), first
, incr
);
42 varray_flush_linear(varray
, start
+ j
, nr
);
49 case PIPE_PRIM_LINE_LOOP
:
50 /* Always have to decompose as we've stated that this will be
51 * emitted as a line-strip.
53 for (j
= 0; j
< count
;) {
54 unsigned remaining
= count
- j
;
55 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
56 varray_line_loop_segment(varray
, start
, j
, nr
, nr
== remaining
);
64 case PIPE_PRIM_POLYGON
:
65 case PIPE_PRIM_TRIANGLE_FAN
:
66 if (count
< varray
->driver_fetch_max
) {
67 varray_flush_linear(varray
, start
, count
);
70 for ( j
= 0; j
< count
;) {
71 unsigned remaining
= count
- j
;
72 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
73 varray_fan_segment(varray
, start
, j
, nr
);