6e2b16d9be2af761dd6b8866df0406b26d135539
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
);
16 varray
->fetch_start
= start
;
18 split_prim_inplace(varray
->input_prim
, &first
, &incr
);
21 debug_printf("%s (%d) %d/%d\n", __FUNCTION__
,
26 switch (varray
->input_prim
) {
27 case PIPE_PRIM_POINTS
:
29 case PIPE_PRIM_TRIANGLES
:
31 while (j
+ first
<= count
) {
32 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
34 varray_flush_linear(varray
, start
+ j
, end
);
39 case PIPE_PRIM_LINE_LOOP
:
41 flags
= DRAW_PIPE_RESET_STIPPLE
;
43 for (j
= 0; j
+ first
<= count
; j
+= i
) {
44 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
46 for (i
= 1; i
< end
; i
++, flags
= 0) {
47 LINE(varray
, flags
, i
- 1, i
);
49 LINE(varray
, flags
, i
- 1, 0);
51 fetch_init(varray
, end
);
57 case PIPE_PRIM_LINE_STRIP
:
58 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
);
66 fetch_init(varray
, end
);
71 case PIPE_PRIM_TRIANGLE_STRIP
:
73 for (j
= 0; j
+ first
<= count
; j
+= i
) {
74 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
76 for (i
= 0; i
+2 < end
; i
++) {
77 TRIANGLE(varray
, DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
,
78 i
+ 0, i
+ 1 + (i
&1), i
+ 2 - (i
&1));
81 fetch_init(varray
, end
);
83 if (j
+ first
+ i
<= count
) {
84 varray
->fetch_start
-= 2;
90 for (j
= 0; j
+ first
<= count
; j
+= i
) {
91 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
93 for (i
= 0; i
+2 < end
; i
++) {
94 TRIANGLE(varray
, DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
,
95 i
+ 0 + (i
&1), i
+ 1 - (i
&1), i
+ 2);
98 fetch_init(varray
, end
);
100 if (j
+ first
+ i
<= count
) {
101 varray
->fetch_start
-= 2;
108 case PIPE_PRIM_TRIANGLE_FAN
:
111 flags
= DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
;
112 for (j
= 0; j
+ first
<= count
; j
+= i
) {
113 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
115 for (i
= 0; i
+2 < end
; i
++) {
116 TRIANGLE(varray
, flags
, i
+ 1, i
+ 2, 0);
119 fetch_init(varray
, end
);
120 varray_flush(varray
);
124 flags
= DRAW_PIPE_RESET_STIPPLE
| DRAW_PIPE_EDGE_FLAG_ALL
;
125 for (j
= 0; j
+ first
<= count
; j
+= i
) {
126 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
128 for (i
= 0; i
+2 < end
; i
++) {
129 TRIANGLE(varray
, flags
, 0, i
+ 1, i
+ 2);
132 fetch_init(varray
, end
);
133 varray_flush(varray
);
139 case PIPE_PRIM_QUADS
:
140 for (j
= 0; j
+ first
<= count
; j
+= i
) {
141 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
143 for (i
= 0; i
+3 < end
; i
+= 4) {
144 QUAD(varray
, i
+ 0, i
+ 1, i
+ 2, i
+ 3);
147 fetch_init(varray
, end
);
148 varray_flush(varray
);
152 case PIPE_PRIM_QUAD_STRIP
:
153 for (j
= 0; j
+ first
<= count
; j
+= i
) {
154 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
156 for (i
= 0; i
+3 < end
; i
+= 2) {
157 QUAD(varray
, i
+ 2, i
+ 0, i
+ 1, i
+ 3);
160 fetch_init(varray
, end
);
161 varray_flush(varray
);
162 if (j
+ first
+ i
<= count
) {
163 varray
->fetch_start
-= 2;
169 case PIPE_PRIM_POLYGON
:
171 /* These bitflags look a little odd because we submit the
172 * vertices as (1,2,0) to satisfy flatshade requirements.
174 const unsigned edge_first
= DRAW_PIPE_EDGE_FLAG_2
;
175 const unsigned edge_middle
= DRAW_PIPE_EDGE_FLAG_0
;
176 const unsigned edge_last
= DRAW_PIPE_EDGE_FLAG_1
;
178 flags
= DRAW_PIPE_RESET_STIPPLE
| edge_first
| edge_middle
;
179 for (j
= 0; j
+ first
<= count
; j
+= i
) {
180 unsigned end
= MIN2(FETCH_MAX
, count
- j
);
182 for (i
= 0; i
+2 < end
; i
++, flags
= edge_middle
) {
187 TRIANGLE(varray
, flags
, i
+ 1, i
+ 2, 0);
190 fetch_init(varray
, end
);
191 varray_flush(varray
);
201 varray_flush(varray
);