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
,
12 struct varray_frontend
*varray
= (struct varray_frontend
*)frontend
;
13 unsigned start
= (unsigned) ((char *) elts
- (char *) NULL
);
18 assert(elt_bias
== 0);
20 draw_pt_split_prim(varray
->input_prim
, &first
, &incr
);
22 /* Sanitize primitive length:
24 count
= trim(count
, first
, incr
);
29 debug_printf("%s (%d) %d/%d\n", __FUNCTION__
,
34 switch (varray
->input_prim
) {
35 case PIPE_PRIM_POINTS
:
37 case PIPE_PRIM_TRIANGLES
:
38 case PIPE_PRIM_LINE_STRIP
:
39 case PIPE_PRIM_TRIANGLE_STRIP
:
41 case PIPE_PRIM_QUAD_STRIP
:
42 case PIPE_PRIM_LINES_ADJACENCY
:
43 case PIPE_PRIM_LINE_STRIP_ADJACENCY
:
44 case PIPE_PRIM_TRIANGLES_ADJACENCY
:
45 case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY
:
46 for (j
= 0; j
< count
;) {
47 unsigned remaining
= count
- j
;
48 unsigned nr
= trim( MIN2(varray
->driver_fetch_max
, remaining
), first
, incr
);
49 varray_flush_linear(varray
, start
+ j
, nr
);
56 case PIPE_PRIM_LINE_LOOP
:
57 /* Always have to decompose as we've stated that this will be
58 * emitted as a line-strip.
60 for (j
= 0; j
< count
;) {
61 unsigned remaining
= count
- j
;
62 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
63 varray_line_loop_segment(varray
, start
, j
, nr
, nr
== remaining
);
71 case PIPE_PRIM_POLYGON
:
72 case PIPE_PRIM_TRIANGLE_FAN
:
73 if (count
< varray
->driver_fetch_max
) {
74 varray_flush_linear(varray
, start
, count
);
77 for ( j
= 0; j
< count
;) {
78 unsigned remaining
= count
- j
;
79 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
80 varray_fan_segment(varray
, start
, j
, nr
);