1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 * Binning code for triangles
32 #include "util/u_math.h"
33 #include "util/u_memory.h"
34 #include "util/u_rect.h"
35 #include "util/u_sse.h"
37 #include "lp_setup_context.h"
39 #include "lp_state_fs.h"
40 #include "lp_state_setup.h"
42 #define NUM_CHANNELS 4
44 #if defined(PIPE_ARCH_SSE)
45 #include <emmintrin.h>
49 subpixel_snap(float a
)
51 return util_iround(FIXED_ONE
* a
);
57 return a
* (1.0 / FIXED_ONE
);
67 * Alloc space for a new triangle plus the input.a0/dadx/dady arrays
68 * immediately after it.
69 * The memory is allocated from the per-scene pool, not per-tile.
70 * \param tri_size returns number of bytes allocated
71 * \param num_inputs number of fragment shader inputs
72 * \return pointer to triangle space
74 struct lp_rast_triangle
*
75 lp_setup_alloc_triangle(struct lp_scene
*scene
,
80 unsigned input_array_sz
= NUM_CHANNELS
* (nr_inputs
+ 1) * sizeof(float);
81 unsigned plane_sz
= nr_planes
* sizeof(struct lp_rast_plane
);
82 struct lp_rast_triangle
*tri
;
84 *tri_size
= (sizeof(struct lp_rast_triangle
) +
88 tri
= lp_scene_alloc_aligned( scene
, *tri_size
, 16 );
92 tri
->inputs
.stride
= input_array_sz
;
95 char *a
= (char *)tri
;
96 char *b
= (char *)&GET_PLANES(tri
)[nr_planes
];
97 assert(b
- a
== *tri_size
);
104 lp_setup_print_vertex(struct lp_setup_context
*setup
,
108 const struct lp_setup_variant_key
*key
= &setup
->setup
.variant
->key
;
111 debug_printf(" wpos (%s[0]) xyzw %f %f %f %f\n",
113 v
[0][0], v
[0][1], v
[0][2], v
[0][3]);
115 for (i
= 0; i
< key
->num_inputs
; i
++) {
116 const float *in
= v
[key
->inputs
[i
].src_index
];
118 debug_printf(" in[%d] (%s[%d]) %s%s%s%s ",
120 name
, key
->inputs
[i
].src_index
,
121 (key
->inputs
[i
].usage_mask
& 0x1) ? "x" : " ",
122 (key
->inputs
[i
].usage_mask
& 0x2) ? "y" : " ",
123 (key
->inputs
[i
].usage_mask
& 0x4) ? "z" : " ",
124 (key
->inputs
[i
].usage_mask
& 0x8) ? "w" : " ");
126 for (j
= 0; j
< 4; j
++)
127 if (key
->inputs
[i
].usage_mask
& (1<<j
))
128 debug_printf("%.5f ", in
[j
]);
136 * Print triangle vertex attribs (for debug).
139 lp_setup_print_triangle(struct lp_setup_context
*setup
,
140 const float (*v0
)[4],
141 const float (*v1
)[4],
142 const float (*v2
)[4])
144 debug_printf("triangle\n");
147 const float ex
= v0
[0][0] - v2
[0][0];
148 const float ey
= v0
[0][1] - v2
[0][1];
149 const float fx
= v1
[0][0] - v2
[0][0];
150 const float fy
= v1
[0][1] - v2
[0][1];
152 /* det = cross(e,f).z */
153 const float det
= ex
* fy
- ey
* fx
;
155 debug_printf(" - ccw\n");
157 debug_printf(" - cw\n");
159 debug_printf(" - zero area\n");
162 lp_setup_print_vertex(setup
, "v0", v0
);
163 lp_setup_print_vertex(setup
, "v1", v1
);
164 lp_setup_print_vertex(setup
, "v2", v2
);
170 lp_rast_tri_tab
[MAX_PLANES
+1] = {
171 0, /* should be impossible */
172 LP_RAST_OP_TRIANGLE_1
,
173 LP_RAST_OP_TRIANGLE_2
,
174 LP_RAST_OP_TRIANGLE_3
,
175 LP_RAST_OP_TRIANGLE_4
,
176 LP_RAST_OP_TRIANGLE_5
,
177 LP_RAST_OP_TRIANGLE_6
,
178 LP_RAST_OP_TRIANGLE_7
,
179 LP_RAST_OP_TRIANGLE_8
185 * The primitive covers the whole tile- shade whole tile.
187 * \param tx, ty the tile position in tiles, not pixels
190 lp_setup_whole_tile(struct lp_setup_context
*setup
,
191 const struct lp_rast_shader_inputs
*inputs
,
194 struct lp_scene
*scene
= setup
->scene
;
196 LP_COUNT(nr_fully_covered_64
);
198 /* if variant is opaque and scissor doesn't effect the tile */
199 if (inputs
->opaque
) {
200 if (!scene
->fb
.zsbuf
) {
202 * All previous rendering will be overwritten so reset the bin.
204 lp_scene_bin_reset( scene
, tx
, ty
);
207 LP_COUNT(nr_shade_opaque_64
);
208 return lp_scene_bin_cmd_with_state( scene
, tx
, ty
,
210 LP_RAST_OP_SHADE_TILE_OPAQUE
,
211 lp_rast_arg_inputs(inputs
) );
213 LP_COUNT(nr_shade_64
);
214 return lp_scene_bin_cmd_with_state( scene
, tx
, ty
,
216 LP_RAST_OP_SHADE_TILE
,
217 lp_rast_arg_inputs(inputs
) );
223 * Do basic setup for triangle rasterization and determine which
224 * framebuffer tiles are touched. Put the triangle in the scene's
225 * bins for the tiles which we overlap.
228 do_triangle_ccw(struct lp_setup_context
*setup
,
229 const float (*v0
)[4],
230 const float (*v1
)[4],
231 const float (*v2
)[4],
232 boolean frontfacing
)
234 struct lp_scene
*scene
= setup
->scene
;
235 const struct lp_setup_variant_key
*key
= &setup
->setup
.variant
->key
;
236 struct lp_rast_triangle
*tri
;
237 struct lp_rast_plane
*plane
;
245 lp_setup_print_triangle(setup
, v0
, v1
, v2
);
247 if (setup
->scissor_test
) {
254 /* x/y positions in fixed point */
255 x
[0] = subpixel_snap(v0
[0][0] - setup
->pixel_offset
);
256 x
[1] = subpixel_snap(v1
[0][0] - setup
->pixel_offset
);
257 x
[2] = subpixel_snap(v2
[0][0] - setup
->pixel_offset
);
259 y
[0] = subpixel_snap(v0
[0][1] - setup
->pixel_offset
);
260 y
[1] = subpixel_snap(v1
[0][1] - setup
->pixel_offset
);
261 y
[2] = subpixel_snap(v2
[0][1] - setup
->pixel_offset
);
265 /* Bounding rectangle (in pixels) */
267 /* Yes this is necessary to accurately calculate bounding boxes
268 * with the two fill-conventions we support. GL (normally) ends
269 * up needing a bottom-left fill convention, which requires
270 * slightly different rounding.
272 int adj
= (setup
->pixel_offset
!= 0) ? 1 : 0;
274 bbox
.x0
= (MIN3(x
[0], x
[1], x
[2]) + (FIXED_ONE
-1)) >> FIXED_ORDER
;
275 bbox
.x1
= (MAX3(x
[0], x
[1], x
[2]) + (FIXED_ONE
-1)) >> FIXED_ORDER
;
276 bbox
.y0
= (MIN3(y
[0], y
[1], y
[2]) + (FIXED_ONE
-1) + adj
) >> FIXED_ORDER
;
277 bbox
.y1
= (MAX3(y
[0], y
[1], y
[2]) + (FIXED_ONE
-1) + adj
) >> FIXED_ORDER
;
279 /* Inclusive coordinates:
285 if (bbox
.x1
< bbox
.x0
||
287 if (0) debug_printf("empty bounding box\n");
288 LP_COUNT(nr_culled_tris
);
292 if (!u_rect_test_intersection(&setup
->draw_region
, &bbox
)) {
293 if (0) debug_printf("offscreen\n");
294 LP_COUNT(nr_culled_tris
);
298 u_rect_find_intersection(&setup
->draw_region
, &bbox
);
300 tri
= lp_setup_alloc_triangle(scene
,
308 tri
->v
[0][0] = v0
[0][0];
309 tri
->v
[1][0] = v1
[0][0];
310 tri
->v
[2][0] = v2
[0][0];
311 tri
->v
[0][1] = v0
[0][1];
312 tri
->v
[1][1] = v1
[0][1];
313 tri
->v
[2][1] = v2
[0][1];
318 /* Setup parameter interpolants:
320 setup
->setup
.variant
->jit_function( v0
,
324 GET_A0(&tri
->inputs
),
325 GET_DADX(&tri
->inputs
),
326 GET_DADY(&tri
->inputs
) );
328 tri
->inputs
.frontfacing
= frontfacing
;
329 tri
->inputs
.disable
= FALSE
;
330 tri
->inputs
.opaque
= setup
->fs
.current
.variant
->opaque
;
333 lp_dump_setup_coef(&setup
->setup
.variant
->key
,
334 (const float (*)[4])GET_A0(&tri
->inputs
),
335 (const float (*)[4])GET_DADX(&tri
->inputs
),
336 (const float (*)[4])GET_DADY(&tri
->inputs
));
338 plane
= GET_PLANES(tri
);
340 #if defined(PIPE_ARCH_SSE)
342 __m128i vertx
, verty
;
343 __m128i shufx
, shufy
;
344 __m128i dcdx
, dcdy
, c
;
346 __m128i dcdx_neg_mask
;
347 __m128i dcdy_neg_mask
;
348 __m128i dcdx_zero_mask
;
349 __m128i top_left_flag
;
350 __m128i c_inc_mask
, c_inc
;
351 __m128i eo
, p0
, p1
, p2
;
352 __m128i zero
= _mm_setzero_si128();
354 vertx
= _mm_loadu_si128((__m128i
*)x
); /* vertex x coords */
355 verty
= _mm_loadu_si128((__m128i
*)y
); /* vertex y coords */
357 shufx
= _mm_shuffle_epi32(vertx
, _MM_SHUFFLE(3,0,2,1));
358 shufy
= _mm_shuffle_epi32(verty
, _MM_SHUFFLE(3,0,2,1));
360 dcdx
= _mm_sub_epi32(verty
, shufy
);
361 dcdy
= _mm_sub_epi32(vertx
, shufx
);
363 dcdx_neg_mask
= _mm_srai_epi32(dcdx
, 31);
364 dcdx_zero_mask
= _mm_cmpeq_epi32(dcdx
, zero
);
365 dcdy_neg_mask
= _mm_srai_epi32(dcdy
, 31);
367 top_left_flag
= _mm_set1_epi32((setup
->pixel_offset
== 0) ? ~0 : 0);
369 c_inc_mask
= _mm_or_si128(dcdx_neg_mask
,
370 _mm_and_si128(dcdx_zero_mask
,
371 _mm_xor_si128(dcdy_neg_mask
,
374 c_inc
= _mm_srli_epi32(c_inc_mask
, 31);
376 c
= _mm_sub_epi32(mm_mullo_epi32(dcdx
, vertx
),
377 mm_mullo_epi32(dcdy
, verty
));
379 c
= _mm_add_epi32(c
, c_inc
);
381 /* Scale up to match c:
383 dcdx
= _mm_slli_epi32(dcdx
, FIXED_ORDER
);
384 dcdy
= _mm_slli_epi32(dcdy
, FIXED_ORDER
);
386 /* Calculate trivial reject values:
388 eo
= _mm_sub_epi32(_mm_andnot_si128(dcdy_neg_mask
, dcdy
),
389 _mm_and_si128(dcdx_neg_mask
, dcdx
));
391 /* ei = _mm_sub_epi32(_mm_sub_epi32(dcdy, dcdx), eo); */
393 /* Pointless transpose which gets undone immediately in
396 transpose4_epi32(&c
, &dcdx
, &dcdy
, &eo
,
397 &p0
, &p1
, &p2
, &unused
);
399 _mm_store_si128((__m128i
*)&plane
[0], p0
);
400 _mm_store_si128((__m128i
*)&plane
[1], p1
);
401 _mm_store_si128((__m128i
*)&plane
[2], p2
);
406 plane
[0].dcdy
= x
[0] - x
[1];
407 plane
[1].dcdy
= x
[1] - x
[2];
408 plane
[2].dcdy
= x
[2] - x
[0];
409 plane
[0].dcdx
= y
[0] - y
[1];
410 plane
[1].dcdx
= y
[1] - y
[2];
411 plane
[2].dcdx
= y
[2] - y
[0];
413 for (i
= 0; i
< 3; i
++) {
414 /* half-edge constants, will be interated over the whole render
417 plane
[i
].c
= plane
[i
].dcdx
* x
[i
] - plane
[i
].dcdy
* y
[i
];
419 /* correct for top-left vs. bottom-left fill convention.
421 * note that we're overloading gl_rasterization_rules to mean
422 * both (0.5,0.5) pixel centers *and* bottom-left filling
425 * GL actually has a top-left filling convention, but GL's
426 * notion of "top" differs from gallium's...
428 * Also, sometimes (in FBO cases) GL will render upside down
429 * to its usual method, in which case it will probably want
430 * to use the opposite, top-left convention.
432 if (plane
[i
].dcdx
< 0) {
433 /* both fill conventions want this - adjust for left edges */
436 else if (plane
[i
].dcdx
== 0) {
437 if (setup
->pixel_offset
== 0) {
438 /* correct for top-left fill convention:
440 if (plane
[i
].dcdy
> 0) plane
[i
].c
++;
443 /* correct for bottom-left fill convention:
445 if (plane
[i
].dcdy
< 0) plane
[i
].c
++;
449 plane
[i
].dcdx
*= FIXED_ONE
;
450 plane
[i
].dcdy
*= FIXED_ONE
;
452 /* find trivial reject offsets for each edge for a single-pixel
453 * sized block. These will be scaled up at each recursive level to
454 * match the active blocksize. Scaling in this way works best if
455 * the blocks are square.
458 if (plane
[i
].dcdx
< 0) plane
[i
].eo
-= plane
[i
].dcdx
;
459 if (plane
[i
].dcdy
> 0) plane
[i
].eo
+= plane
[i
].dcdy
;
465 debug_printf("p0: %08x/%08x/%08x/%08x\n",
471 debug_printf("p1: %08x/%08x/%08x/%08x\n",
477 debug_printf("p0: %08x/%08x/%08x/%08x\n",
486 * When rasterizing scissored tris, use the intersection of the
487 * triangle bounding box and the scissor rect to generate the
490 * This permits us to cut off the triangle "tails" that are present
491 * in the intermediate recursive levels caused when two of the
492 * triangles edges don't diverge quickly enough to trivially reject
493 * exterior blocks from the triangle.
495 * It's not really clear if it's worth worrying about these tails,
496 * but since we generate the planes for each scissored tri, it's
497 * free to trim them in this case.
499 * Note that otherwise, the scissor planes only vary in 'C' value,
500 * and even then only on state-changes. Could alternatively store
501 * these planes elsewhere.
503 if (nr_planes
== 7) {
506 plane
[3].c
= 1-bbox
.x0
;
511 plane
[4].c
= bbox
.x1
+1;
516 plane
[5].c
= 1-bbox
.y0
;
521 plane
[6].c
= bbox
.y1
+1;
525 return lp_setup_bin_triangle( setup
, tri
, &bbox
, nr_planes
);
529 * Round to nearest less or equal power of two of the input.
531 * Undefined if no bit set exists, so code should check against 0 first.
533 static INLINE
uint32_t
534 floor_pot(uint32_t n
)
536 #if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
556 lp_setup_bin_triangle( struct lp_setup_context
*setup
,
557 struct lp_rast_triangle
*tri
,
558 const struct u_rect
*bbox
,
561 struct lp_scene
*scene
= setup
->scene
;
564 /* What is the largest power-of-two boundary this triangle crosses:
566 int dx
= floor_pot((bbox
->x0
^ bbox
->x1
) |
567 (bbox
->y0
^ bbox
->y1
));
569 /* The largest dimension of the rasterized area of the triangle
570 * (aligned to a 4x4 grid), rounded down to the nearest power of two:
572 int sz
= floor_pot((bbox
->x1
- (bbox
->x0
& ~3)) |
573 (bbox
->y1
- (bbox
->y0
& ~3)));
575 /* Determine which tile(s) intersect the triangle's bounding box
579 int ix0
= bbox
->x0
/ TILE_SIZE
;
580 int iy0
= bbox
->y0
/ TILE_SIZE
;
581 int px
= bbox
->x0
& 63 & ~3;
582 int py
= bbox
->y0
& 63 & ~3;
583 int mask
= px
| (py
<< 8);
585 assert(iy0
== bbox
->y1
/ TILE_SIZE
&&
586 ix0
== bbox
->x1
/ TILE_SIZE
);
588 if (nr_planes
== 3) {
591 /* Triangle is contained in a single 4x4 stamp:
593 return lp_scene_bin_cmd_with_state( scene
, ix0
, iy0
,
595 LP_RAST_OP_TRIANGLE_3_4
,
596 lp_rast_arg_triangle(tri
, mask
) );
601 /* Triangle is contained in a single 16x16 block:
603 return lp_scene_bin_cmd_with_state( scene
, ix0
, iy0
,
605 LP_RAST_OP_TRIANGLE_3_16
,
606 lp_rast_arg_triangle(tri
, mask
) );
609 else if (nr_planes
== 4 && sz
< 16)
611 return lp_scene_bin_cmd_with_state(scene
, ix0
, iy0
,
613 LP_RAST_OP_TRIANGLE_4_16
,
614 lp_rast_arg_triangle(tri
, mask
) );
618 /* Triangle is contained in a single tile:
620 return lp_scene_bin_cmd_with_state( scene
, ix0
, iy0
, setup
->fs
.stored
,
621 lp_rast_tri_tab
[nr_planes
],
622 lp_rast_arg_triangle(tri
, (1<<nr_planes
)-1) );
626 struct lp_rast_plane
*plane
= GET_PLANES(tri
);
630 int xstep
[MAX_PLANES
];
631 int ystep
[MAX_PLANES
];
634 int ix0
= bbox
->x0
/ TILE_SIZE
;
635 int iy0
= bbox
->y0
/ TILE_SIZE
;
636 int ix1
= bbox
->x1
/ TILE_SIZE
;
637 int iy1
= bbox
->y1
/ TILE_SIZE
;
639 for (i
= 0; i
< nr_planes
; i
++) {
641 plane
[i
].dcdy
* iy0
* TILE_SIZE
-
642 plane
[i
].dcdx
* ix0
* TILE_SIZE
);
644 ei
[i
] = (plane
[i
].dcdy
-
646 plane
[i
].eo
) << TILE_ORDER
;
648 eo
[i
] = plane
[i
].eo
<< TILE_ORDER
;
649 xstep
[i
] = -(plane
[i
].dcdx
<< TILE_ORDER
);
650 ystep
[i
] = plane
[i
].dcdy
<< TILE_ORDER
;
655 /* Test tile-sized blocks against the triangle.
656 * Discard blocks fully outside the tri. If the block is fully
657 * contained inside the tri, bin an lp_rast_shade_tile command.
658 * Else, bin a lp_rast_triangle command.
660 for (y
= iy0
; y
<= iy1
; y
++)
662 boolean in
= FALSE
; /* are we inside the triangle? */
665 for (i
= 0; i
< nr_planes
; i
++)
668 for (x
= ix0
; x
<= ix1
; x
++)
673 for (i
= 0; i
< nr_planes
; i
++) {
674 int planeout
= cx
[i
] + eo
[i
];
675 int planepartial
= cx
[i
] + ei
[i
] - 1;
676 out
|= (planeout
>> 31);
677 partial
|= (planepartial
>> 31) & (1<<i
);
683 break; /* exiting triangle, all done with this row */
684 LP_COUNT(nr_empty_64
);
687 /* Not trivially accepted by at least one plane -
688 * rasterize/shade partial tile
690 int count
= util_bitcount(partial
);
693 if (!lp_scene_bin_cmd_with_state( scene
, x
, y
,
695 lp_rast_tri_tab
[count
],
696 lp_rast_arg_triangle(tri
, partial
) ))
699 LP_COUNT(nr_partially_covered_64
);
702 /* triangle covers the whole tile- shade whole tile */
703 LP_COUNT(nr_fully_covered_64
);
705 if (!lp_setup_whole_tile(setup
, &tri
->inputs
, x
, y
))
709 /* Iterate cx values across the region:
711 for (i
= 0; i
< nr_planes
; i
++)
715 /* Iterate c values down the region:
717 for (i
= 0; i
< nr_planes
; i
++)
725 /* Need to disable any partially binned triangle. This is easier
726 * than trying to locate all the triangle, shade-tile, etc,
727 * commands which may have been binned.
729 tri
->inputs
.disable
= TRUE
;
735 * Try to draw the triangle, restart the scene on failure.
737 static void retry_triangle_ccw( struct lp_setup_context
*setup
,
738 const float (*v0
)[4],
739 const float (*v1
)[4],
740 const float (*v2
)[4],
743 if (!do_triangle_ccw( setup
, v0
, v1
, v2
, front
))
745 if (!lp_setup_flush_and_restart(setup
))
748 if (!do_triangle_ccw( setup
, v0
, v1
, v2
, front
))
754 calc_area(const float (*v0
)[4],
755 const float (*v1
)[4],
756 const float (*v2
)[4])
758 float dx01
= v0
[0][0] - v1
[0][0];
759 float dy01
= v0
[0][1] - v1
[0][1];
760 float dx20
= v2
[0][0] - v0
[0][0];
761 float dy20
= v2
[0][1] - v0
[0][1];
762 return dx01
* dy20
- dx20
* dy01
;
767 * Draw triangle if it's CW, cull otherwise.
769 static void triangle_cw( struct lp_setup_context
*setup
,
770 const float (*v0
)[4],
771 const float (*v1
)[4],
772 const float (*v2
)[4] )
774 float area
= calc_area(v0
, v1
, v2
);
777 retry_triangle_ccw(setup
, v0
, v2
, v1
, !setup
->ccw_is_frontface
);
781 static void triangle_ccw( struct lp_setup_context
*setup
,
782 const float (*v0
)[4],
783 const float (*v1
)[4],
784 const float (*v2
)[4])
786 float area
= calc_area(v0
, v1
, v2
);
789 retry_triangle_ccw(setup
, v0
, v1
, v2
, setup
->ccw_is_frontface
);
793 * Draw triangle whether it's CW or CCW.
795 static void triangle_both( struct lp_setup_context
*setup
,
796 const float (*v0
)[4],
797 const float (*v1
)[4],
798 const float (*v2
)[4] )
800 float area
= calc_area(v0
, v1
, v2
);
803 retry_triangle_ccw( setup
, v0
, v1
, v2
, setup
->ccw_is_frontface
);
804 else if (area
< 0.0f
)
805 retry_triangle_ccw( setup
, v0
, v2
, v1
, !setup
->ccw_is_frontface
);
809 static void triangle_nop( struct lp_setup_context
*setup
,
810 const float (*v0
)[4],
811 const float (*v1
)[4],
812 const float (*v2
)[4] )
818 lp_setup_choose_triangle( struct lp_setup_context
*setup
)
820 switch (setup
->cullmode
) {
822 setup
->triangle
= triangle_both
;
825 setup
->triangle
= setup
->ccw_is_frontface
? triangle_ccw
: triangle_cw
;
827 case PIPE_FACE_FRONT
:
828 setup
->triangle
= setup
->ccw_is_frontface
? triangle_cw
: triangle_ccw
;
831 setup
->triangle
= triangle_nop
;