1 static unsigned trim( unsigned count
, unsigned first
, unsigned incr
)
4 * count either has been trimmed in draw_pt_arrays or is set to
5 * (driver)_fetch_max which is hopefully always larger than first.
7 assert(count
>= first
);
8 return count
- (count
- first
) % incr
;
11 static void FUNC(struct draw_pt_front_end
*frontend
,
17 struct varray_frontend
*varray
= (struct varray_frontend
*)frontend
;
18 unsigned start
= (unsigned) ((char *) elts
- (char *) NULL
);
23 assert(elt_bias
== 0);
25 draw_pt_split_prim(varray
->input_prim
, &first
, &incr
);
27 /* Sanitize primitive length:
29 count
= trim(count
, first
, incr
);
34 debug_printf("%s (%d) %d/%d\n", __FUNCTION__
,
39 switch (varray
->input_prim
) {
40 case PIPE_PRIM_POINTS
:
42 case PIPE_PRIM_TRIANGLES
:
43 case PIPE_PRIM_LINE_STRIP
:
44 case PIPE_PRIM_TRIANGLE_STRIP
:
46 case PIPE_PRIM_QUAD_STRIP
:
47 case PIPE_PRIM_LINES_ADJACENCY
:
48 case PIPE_PRIM_LINE_STRIP_ADJACENCY
:
49 case PIPE_PRIM_TRIANGLES_ADJACENCY
:
50 case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY
:
51 for (j
= 0; j
< count
;) {
52 unsigned remaining
= count
- j
;
53 unsigned nr
= trim( MIN2(varray
->driver_fetch_max
, remaining
), first
, incr
);
54 varray_flush_linear(varray
, start
+ j
, nr
);
61 case PIPE_PRIM_LINE_LOOP
:
62 /* Always have to decompose as we've stated that this will be
63 * emitted as a line-strip.
65 for (j
= 0; j
< count
;) {
66 unsigned remaining
= count
- j
;
67 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
68 varray_line_loop_segment(varray
, start
, j
, nr
, nr
== remaining
);
76 case PIPE_PRIM_POLYGON
:
77 case PIPE_PRIM_TRIANGLE_FAN
:
78 if (count
< varray
->driver_fetch_max
) {
79 varray_flush_linear(varray
, start
, count
);
82 for ( j
= 0; j
< count
;) {
83 unsigned remaining
= count
- j
;
84 unsigned nr
= trim( MIN2(varray
->fetch_max
-1, remaining
), first
, incr
);
85 varray_fan_segment(varray
, start
, j
, nr
);