2 static void FUNC(struct draw_pt_front_end
*frontend
,
7 struct varray_frontend
*varray
= (struct varray_frontend
*)frontend
;
8 struct draw_context
*draw
= varray
->draw
;
9 unsigned start
= (unsigned)elts
;
11 boolean flatfirst
= (draw
->rasterizer
->flatshade
&&
12 draw
->rasterizer
->flatshade_first
);
17 varray
->fetch_start
= start
;
19 draw_pt_split_prim(varray
->input_prim
, &first
, &incr
);
22 debug_printf("%s (%d) %d/%d\n", __FUNCTION__
,
27 switch (varray
->input_prim
) {
28 case PIPE_PRIM_POINTS
:
29 for (j
= 0; j
+ first
<= count
; j
+= i
) {
30 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
32 for (i
= 0; i
< end
; i
++) {
36 fetch_init(varray
, end
);
42 for (j
= 0; j
+ first
<= count
; j
+= i
) {
43 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
45 for (i
= 0; i
+1 < end
; i
+= 2) {
46 LINE(varray
, DRAW_PIPE_RESET_STIPPLE
,
50 fetch_init(varray
, end
);
55 case PIPE_PRIM_LINE_LOOP
:
57 flags
= DRAW_PIPE_RESET_STIPPLE
;
59 for (j
= 0; j
+ first
<= count
; j
+= i
) {
60 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
62 for (i
= 1; i
< end
; i
++, flags
= 0) {
63 LINE(varray
, flags
, i
- 1, i
);
65 LINE(varray
, flags
, i
- 1, 0);
67 fetch_init(varray
, end
);
73 case PIPE_PRIM_LINE_STRIP
:
74 flags
= DRAW_PIPE_RESET_STIPPLE
;
75 for (j
= 0; j
+ first
<= count
; j
+= i
) {
76 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
78 for (i
= 1; i
< end
; i
++, flags
= 0) {
79 LINE(varray
, flags
, i
- 1, i
);
82 fetch_init(varray
, end
);
87 case PIPE_PRIM_TRIANGLES
:
88 for (j
= 0; j
+ first
<= count
; j
+= i
) {
89 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
91 for (i
= 0; i
+2 < end
; i
+= 3) {
92 TRIANGLE(varray
, DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
,
96 fetch_init(varray
, end
);
101 case PIPE_PRIM_TRIANGLE_STRIP
:
103 for (j
= 0; j
+ first
<= count
; j
+= i
) {
104 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
106 for (i
= 0; i
+2 < end
; i
++) {
107 TRIANGLE(varray
, DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
,
108 i
+ 0, i
+ 1 + (i
&1), i
+ 2 - (i
&1));
111 fetch_init(varray
, end
);
112 varray_flush(varray
);
113 if (j
+ first
+ i
<= count
) {
114 varray
->fetch_start
-= 2;
120 for (j
= 0; j
+ first
<= count
; j
+= i
) {
121 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
123 for (i
= 0; i
+ 2 < end
; i
++) {
124 TRIANGLE(varray
, DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
,
125 i
+ 0 + (i
&1), i
+ 1 - (i
&1), i
+ 2);
128 fetch_init(varray
, end
);
129 varray_flush(varray
);
130 if (j
+ first
+ i
<= count
) {
131 varray
->fetch_start
-= 2;
138 case PIPE_PRIM_TRIANGLE_FAN
:
141 flags
= DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
;
142 for (j
= 0; j
+ first
<= count
; j
+= i
) {
143 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
145 for (i
= 0; i
+2 < end
; i
++) {
146 TRIANGLE(varray
, flags
, i
+ 1, i
+ 2, 0);
149 fetch_init(varray
, end
);
150 varray_flush(varray
);
154 flags
= DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
;
155 for (j
= 0; j
+ first
<= count
; j
+= i
) {
156 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
158 for (i
= 0; i
+2 < end
; i
++) {
159 TRIANGLE(varray
, flags
, 0, i
+ 1, i
+ 2);
162 fetch_init(varray
, end
);
163 varray_flush(varray
);
169 case PIPE_PRIM_QUADS
:
170 for (j
= 0; j
+ first
<= count
; j
+= i
) {
171 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
173 for (i
= 0; i
+3 < end
; i
+= 4) {
174 QUAD(varray
, i
+ 0, i
+ 1, i
+ 2, i
+ 3);
177 fetch_init(varray
, end
);
178 varray_flush(varray
);
182 case PIPE_PRIM_QUAD_STRIP
:
183 for (j
= 0; j
+ first
<= count
; j
+= i
) {
184 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
186 for (i
= 0; i
+3 < end
; i
+= 2) {
187 QUAD(varray
, i
+ 2, i
+ 0, i
+ 1, i
+ 3);
190 fetch_init(varray
, end
);
191 varray_flush(varray
);
192 if (j
+ first
+ i
<= count
) {
193 varray
->fetch_start
-= 2;
199 case PIPE_PRIM_POLYGON
:
201 /* These bitflags look a little odd because we submit the
202 * vertices as (1,2,0) to satisfy flatshade requirements.
204 const ushort edge_first
= DRAW_PIPE_EDGE_FLAG_2
;
205 const ushort edge_middle
= DRAW_PIPE_EDGE_FLAG_0
;
206 const ushort edge_last
= DRAW_PIPE_EDGE_FLAG_1
;
208 flags
= DRAW_PIPE_RESET_STIPPLE
| edge_first
| edge_middle
;
209 for (j
= 0; j
+ first
<= count
; j
+= i
) {
210 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
212 for (i
= 0; i
+2 < end
; i
++, flags
= edge_middle
) {
217 TRIANGLE(varray
, flags
, i
+ 1, i
+ 2, 0);
220 fetch_init(varray
, end
);
221 varray_flush(varray
);
231 varray_flush(varray
);