2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Keith Whitwell <keith@tungstengraphics.com>
29 /* Template for building functions to plug into the driver interface
31 * ctx->Driver.QuadFunc
32 * ctx->Driver.TriangleFunc
33 * ctx->Driver.LineFunc
34 * ctx->Driver.PointsFunc
36 * DO_TWOSIDE: Plug back-color values from the VB into backfacing triangles,
37 * and restore vertices afterwards.
38 * DO_OFFSET: Calculate offset for triangles and adjust vertices. Restore
39 * vertices after rendering.
40 * DO_FLAT: For hardware without native flatshading, copy provoking colors
41 * into the other vertices. Restore after rendering.
42 * DO_UNFILLED: Decompose triangles to lines and points where appropriate.
43 * DO_TWOSTENCIL:Gross hack for two-sided stencil.
45 * HAVE_RGBA: Vertices have rgba values (otherwise index values).
46 * HAVE_SPEC: Vertices have secondary rgba values.
48 * VERT_X(v): Alias for vertex x value.
49 * VERT_Y(v): Alias for vertex y value.
50 * VERT_Z(v): Alias for vertex z value.
51 * DEPTH_SCALE: Scale for constant offset.
52 * REVERSE_DEPTH: Viewport depth range reversed.
54 * VERTEX: Hardware vertex type.
55 * GET_VERTEX(n): Retreive vertex with index n.
56 * AREA_IS_CCW(a): Return true if triangle with signed area a is ccw.
58 * VERT_SET_RGBA: Assign vertex rgba from VB color.
59 * VERT_COPY_RGBA: Copy vertex rgba another vertex.
60 * VERT_SAVE_RGBA: Save vertex rgba to a local variable.
61 * VERT_RESTORE_RGBA: Restore vertex rgba from a local variable.
62 * --> Similar for IND and SPEC.
64 * LOCAL_VARS(n): (At least) define local vars for save/restore rgba.
69 #define VERT_SET_IND( v, c ) (void) c
70 #define VERT_COPY_IND( v0, v1 )
71 #define VERT_SAVE_IND( idx )
72 #define VERT_RESTORE_IND( idx )
74 #define VERT_SET_RGBA( v, c )
77 #define VERT_SET_RGBA( v, c ) (void) c
78 #define VERT_COPY_RGBA( v0, v1 )
79 #define VERT_SAVE_RGBA( idx )
80 #define VERT_RESTORE_RGBA( idx )
82 #define VERT_SET_IND( v, c )
87 #define VERT_SET_SPEC( v, c ) (void) c
88 #define VERT_COPY_SPEC( v0, v1 )
89 #define VERT_SAVE_SPEC( idx )
90 #define VERT_RESTORE_SPEC( idx )
92 #define VERT_COPY_SPEC1( v )
96 #define VERT_SET_SPEC( v, c )
100 #if !HAVE_BACK_COLORS
101 #define VERT_COPY_SPEC1( v )
102 #define VERT_COPY_IND1( v )
103 #define VERT_COPY_RGBA1( v )
106 #ifndef INSANE_VERTICES
107 #define VERT_SET_Z(v,val) VERT_Z(v) = val
108 #define VERT_Z_ADD(v,val) VERT_Z(v) += val
111 #ifndef REVERSE_DEPTH
112 #define REVERSE_DEPTH 0
115 /* disable twostencil for un-aware drivers */
116 #ifndef HAVE_STENCIL_TWOSIDE
117 #define HAVE_STENCIL_TWOSIDE 0
119 #ifndef DO_TWOSTENCIL
120 #define DO_TWOSTENCIL 0
122 #ifndef SETUP_STENCIL
123 #define SETUP_STENCIL(f)
125 #ifndef UNSET_STENCIL
126 #define UNSET_STENCIL(f)
130 static void TAG(triangle
)( GLcontext
*ctx
, GLuint e0
, GLuint e1
, GLuint e2
)
132 struct vertex_buffer
*VB
= &TNL_CONTEXT( ctx
)->vb
;
136 GLenum mode
= GL_FILL
;
140 /* fprintf(stderr, "%s\n", __FUNCTION__); */
142 v
[0] = (VERTEX
*)GET_VERTEX(e0
);
143 v
[1] = (VERTEX
*)GET_VERTEX(e1
);
144 v
[2] = (VERTEX
*)GET_VERTEX(e2
);
146 if (DO_TWOSIDE
|| DO_OFFSET
|| DO_UNFILLED
|| DO_TWOSTENCIL
)
148 GLfloat ex
= VERT_X(v
[0]) - VERT_X(v
[2]);
149 GLfloat ey
= VERT_Y(v
[0]) - VERT_Y(v
[2]);
150 GLfloat fx
= VERT_X(v
[1]) - VERT_X(v
[2]);
151 GLfloat fy
= VERT_Y(v
[1]) - VERT_Y(v
[2]);
152 GLfloat cc
= ex
*fy
- ey
*fx
;
154 if (DO_TWOSIDE
|| DO_UNFILLED
|| DO_TWOSTENCIL
)
156 facing
= AREA_IS_CCW( cc
) ^ ctx
->Polygon
._FrontBit
;
160 mode
= ctx
->Polygon
.BackMode
;
161 if (ctx
->Polygon
.CullFlag
&&
162 ctx
->Polygon
.CullFaceMode
!= GL_FRONT
) {
166 mode
= ctx
->Polygon
.FrontMode
;
167 if (ctx
->Polygon
.CullFlag
&&
168 ctx
->Polygon
.CullFaceMode
!= GL_BACK
) {
174 if (DO_TWOSIDE
&& facing
== 1)
177 if (HAVE_BACK_COLORS
) {
181 VERT_COPY_RGBA1( v
[0] );
182 VERT_COPY_RGBA1( v
[1] );
185 VERT_COPY_RGBA1( v
[2] );
190 VERT_COPY_SPEC1( v
[0] );
191 VERT_COPY_SPEC1( v
[1] );
194 VERT_COPY_SPEC1( v
[2] );
198 GLfloat (*vbcolor
)[4] = VB
->BackfaceColorPtr
->data
;
207 if (VB
->BackfaceColorPtr
->stride
) {
208 ASSERT(VB
->BackfaceColorPtr
->stride
== 4*sizeof(GLfloat
));
211 VERT_SET_RGBA( v
[0], vbcolor
[e0
] );
212 VERT_SET_RGBA( v
[1], vbcolor
[e1
] );
214 VERT_SET_RGBA( v
[2], vbcolor
[e2
] );
218 VERT_SET_RGBA( v
[0], vbcolor
[0] );
219 VERT_SET_RGBA( v
[1], vbcolor
[0] );
221 VERT_SET_RGBA( v
[2], vbcolor
[0] );
224 if (HAVE_SPEC
&& VB
->BackfaceSecondaryColorPtr
) {
225 GLfloat (*vbspec
)[4] = VB
->BackfaceSecondaryColorPtr
->data
;
226 ASSERT(VB
->BackfaceSecondaryColorPtr
->stride
== 4*sizeof(GLfloat
));
231 VERT_SET_SPEC( v
[0], vbspec
[e0
] );
232 VERT_SET_SPEC( v
[1], vbspec
[e1
] );
235 VERT_SET_SPEC( v
[2], vbspec
[e2
] );
240 GLfloat (*vbindex
) = (GLfloat
*)VB
->BackfaceIndexPtr
->data
;
244 VERT_SET_IND( v
[0], vbindex
[e0
] );
245 VERT_SET_IND( v
[1], vbindex
[e1
] );
248 VERT_SET_IND( v
[2], vbindex
[e2
] );
256 offset
= ctx
->Polygon
.OffsetUnits
* DEPTH_SCALE
;
260 if (cc
* cc
> 1e-16) {
261 GLfloat ic
= 1.0 / cc
;
262 GLfloat ez
= z
[0] - z
[2];
263 GLfloat fz
= z
[1] - z
[2];
264 GLfloat a
= ey
*fz
- ez
*fy
;
265 GLfloat b
= ez
*fx
- ex
*fz
;
268 if ( ac
< 0.0f
) ac
= -ac
;
269 if ( bc
< 0.0f
) bc
= -bc
;
270 offset
+= MAX2( ac
, bc
) * ctx
->Polygon
.OffsetFactor
/ ctx
->DrawBuffer
->_MRD
;
272 offset
*= ctx
->DrawBuffer
->_MRD
* (REVERSE_DEPTH
? -1.0 : 1.0);
280 VERT_COPY_RGBA( v
[0], v
[2] );
281 VERT_COPY_RGBA( v
[1], v
[2] );
282 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
285 VERT_COPY_SPEC( v
[0], v
[2] );
286 VERT_COPY_SPEC( v
[1], v
[2] );
292 VERT_COPY_IND( v
[0], v
[2] );
293 VERT_COPY_IND( v
[1], v
[2] );
297 if (mode
== GL_POINT
) {
298 if (DO_OFFSET
&& ctx
->Polygon
.OffsetPoint
) {
299 VERT_Z_ADD(v
[0], offset
);
300 VERT_Z_ADD(v
[1], offset
);
301 VERT_Z_ADD(v
[2], offset
);
303 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
304 SETUP_STENCIL(facing
);
305 UNFILLED_TRI( ctx
, GL_POINT
, e0
, e1
, e2
);
306 UNSET_STENCIL(facing
);
308 UNFILLED_TRI( ctx
, GL_POINT
, e0
, e1
, e2
);
310 } else if (mode
== GL_LINE
) {
311 if (DO_OFFSET
&& ctx
->Polygon
.OffsetLine
) {
312 VERT_Z_ADD(v
[0], offset
);
313 VERT_Z_ADD(v
[1], offset
);
314 VERT_Z_ADD(v
[2], offset
);
316 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
317 SETUP_STENCIL(facing
);
318 UNFILLED_TRI( ctx
, GL_LINE
, e0
, e1
, e2
);
319 UNSET_STENCIL(facing
);
321 UNFILLED_TRI( ctx
, GL_LINE
, e0
, e1
, e2
);
324 if (DO_OFFSET
&& ctx
->Polygon
.OffsetFill
) {
325 VERT_Z_ADD(v
[0], offset
);
326 VERT_Z_ADD(v
[1], offset
);
327 VERT_Z_ADD(v
[2], offset
);
330 RASTERIZE( GL_TRIANGLES
);
331 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
332 SETUP_STENCIL(facing
);
333 TRI( v
[0], v
[1], v
[2] );
334 UNSET_STENCIL(facing
);
336 TRI( v
[0], v
[1], v
[2] );
342 VERT_SET_Z(v
[0], z
[0]);
343 VERT_SET_Z(v
[1], z
[1]);
344 VERT_SET_Z(v
[2], z
[2]);
347 if (DO_TWOSIDE
&& facing
== 1)
351 VERT_RESTORE_RGBA( 0 );
352 VERT_RESTORE_RGBA( 1 );
354 VERT_RESTORE_RGBA( 2 );
357 VERT_RESTORE_SPEC( 0 );
358 VERT_RESTORE_SPEC( 1 );
360 VERT_RESTORE_SPEC( 2 );
365 VERT_RESTORE_IND( 0 );
366 VERT_RESTORE_IND( 1 );
368 VERT_RESTORE_IND( 2 );
375 VERT_RESTORE_RGBA( 0 );
376 VERT_RESTORE_RGBA( 1 );
377 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
378 VERT_RESTORE_SPEC( 0 );
379 VERT_RESTORE_SPEC( 1 );
383 VERT_RESTORE_IND( 0 );
384 VERT_RESTORE_IND( 1 );
392 static void TAG(quadr
)( GLcontext
*ctx
,
393 GLuint e0
, GLuint e1
, GLuint e2
, GLuint e3
)
395 struct vertex_buffer
*VB
= &TNL_CONTEXT( ctx
)->vb
;
399 GLenum mode
= GL_FILL
;
403 v
[0] = (VERTEX
*)GET_VERTEX(e0
);
404 v
[1] = (VERTEX
*)GET_VERTEX(e1
);
405 v
[2] = (VERTEX
*)GET_VERTEX(e2
);
406 v
[3] = (VERTEX
*)GET_VERTEX(e3
);
408 if (DO_TWOSIDE
|| DO_OFFSET
|| DO_UNFILLED
|| DO_TWOSTENCIL
)
410 GLfloat ex
= VERT_X(v
[2]) - VERT_X(v
[0]);
411 GLfloat ey
= VERT_Y(v
[2]) - VERT_Y(v
[0]);
412 GLfloat fx
= VERT_X(v
[3]) - VERT_X(v
[1]);
413 GLfloat fy
= VERT_Y(v
[3]) - VERT_Y(v
[1]);
414 GLfloat cc
= ex
*fy
- ey
*fx
;
416 if (DO_TWOSIDE
|| DO_UNFILLED
|| DO_TWOSTENCIL
)
418 facing
= AREA_IS_CCW( cc
) ^ ctx
->Polygon
._FrontBit
;
422 mode
= ctx
->Polygon
.BackMode
;
423 if (ctx
->Polygon
.CullFlag
&&
424 ctx
->Polygon
.CullFaceMode
!= GL_FRONT
) {
428 mode
= ctx
->Polygon
.FrontMode
;
429 if (ctx
->Polygon
.CullFlag
&&
430 ctx
->Polygon
.CullFaceMode
!= GL_BACK
) {
436 if (DO_TWOSIDE
&& facing
== 1)
439 GLfloat (*vbcolor
)[4] = VB
->BackfaceColorPtr
->data
;
442 if (HAVE_BACK_COLORS
) {
447 VERT_COPY_RGBA1( v
[0] );
448 VERT_COPY_RGBA1( v
[1] );
449 VERT_COPY_RGBA1( v
[2] );
452 VERT_COPY_RGBA1( v
[3] );
458 VERT_COPY_SPEC1( v
[0] );
459 VERT_COPY_SPEC1( v
[1] );
460 VERT_COPY_SPEC1( v
[2] );
463 VERT_COPY_SPEC1( v
[3] );
474 if (VB
->BackfaceColorPtr
->stride
) {
476 VERT_SET_RGBA( v
[0], vbcolor
[e0
] );
477 VERT_SET_RGBA( v
[1], vbcolor
[e1
] );
478 VERT_SET_RGBA( v
[2], vbcolor
[e2
] );
480 VERT_SET_RGBA( v
[3], vbcolor
[e3
] );
484 VERT_SET_RGBA( v
[0], vbcolor
[0] );
485 VERT_SET_RGBA( v
[1], vbcolor
[0] );
486 VERT_SET_RGBA( v
[2], vbcolor
[0] );
488 VERT_SET_RGBA( v
[3], vbcolor
[0] );
491 if (HAVE_SPEC
&& VB
->BackfaceSecondaryColorPtr
) {
492 GLfloat (*vbspec
)[4] = VB
->BackfaceSecondaryColorPtr
->data
;
493 ASSERT(VB
->BackfaceSecondaryColorPtr
->stride
==4*sizeof(GLfloat
));
499 VERT_SET_SPEC( v
[0], vbspec
[e0
] );
500 VERT_SET_SPEC( v
[1], vbspec
[e1
] );
501 VERT_SET_SPEC( v
[2], vbspec
[e2
] );
504 VERT_SET_SPEC( v
[3], vbspec
[e3
] );
509 GLfloat
*vbindex
= (GLfloat
*)VB
->BackfaceIndexPtr
->data
;
514 VERT_SET_IND( v
[0], vbindex
[e0
] );
515 VERT_SET_IND( v
[1], vbindex
[e1
] );
516 VERT_SET_IND( v
[2], vbindex
[e2
] );
519 VERT_SET_IND( v
[3], vbindex
[e3
] );
527 offset
= ctx
->Polygon
.OffsetUnits
* DEPTH_SCALE
;
532 if (cc
* cc
> 1e-16) {
533 GLfloat ez
= z
[2] - z
[0];
534 GLfloat fz
= z
[3] - z
[1];
535 GLfloat a
= ey
*fz
- ez
*fy
;
536 GLfloat b
= ez
*fx
- ex
*fz
;
537 GLfloat ic
= 1.0 / cc
;
540 if ( ac
< 0.0f
) ac
= -ac
;
541 if ( bc
< 0.0f
) bc
= -bc
;
542 offset
+= MAX2( ac
, bc
) * ctx
->Polygon
.OffsetFactor
/ ctx
->DrawBuffer
->_MRD
;
544 offset
*= ctx
->DrawBuffer
->_MRD
* (REVERSE_DEPTH
? -1.0 : 1.0);
553 VERT_COPY_RGBA( v
[0], v
[3] );
554 VERT_COPY_RGBA( v
[1], v
[3] );
555 VERT_COPY_RGBA( v
[2], v
[3] );
556 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
560 VERT_COPY_SPEC( v
[0], v
[3] );
561 VERT_COPY_SPEC( v
[1], v
[3] );
562 VERT_COPY_SPEC( v
[2], v
[3] );
569 VERT_COPY_IND( v
[0], v
[3] );
570 VERT_COPY_IND( v
[1], v
[3] );
571 VERT_COPY_IND( v
[2], v
[3] );
575 if (mode
== GL_POINT
) {
576 if (( DO_OFFSET
) && ctx
->Polygon
.OffsetPoint
) {
577 VERT_Z_ADD(v
[0], offset
);
578 VERT_Z_ADD(v
[1], offset
);
579 VERT_Z_ADD(v
[2], offset
);
580 VERT_Z_ADD(v
[3], offset
);
582 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
583 SETUP_STENCIL(facing
);
584 UNFILLED_QUAD( ctx
, GL_POINT
, e0
, e1
, e2
, e3
);
585 UNSET_STENCIL(facing
);
587 UNFILLED_QUAD( ctx
, GL_POINT
, e0
, e1
, e2
, e3
);
589 } else if (mode
== GL_LINE
) {
590 if (DO_OFFSET
&& ctx
->Polygon
.OffsetLine
) {
591 VERT_Z_ADD(v
[0], offset
);
592 VERT_Z_ADD(v
[1], offset
);
593 VERT_Z_ADD(v
[2], offset
);
594 VERT_Z_ADD(v
[3], offset
);
596 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
597 SETUP_STENCIL(facing
);
598 UNFILLED_QUAD( ctx
, GL_LINE
, e0
, e1
, e2
, e3
);
599 UNSET_STENCIL(facing
);
601 UNFILLED_QUAD( ctx
, GL_LINE
, e0
, e1
, e2
, e3
);
604 if (DO_OFFSET
&& ctx
->Polygon
.OffsetFill
) {
605 VERT_Z_ADD(v
[0], offset
);
606 VERT_Z_ADD(v
[1], offset
);
607 VERT_Z_ADD(v
[2], offset
);
608 VERT_Z_ADD(v
[3], offset
);
610 RASTERIZE( GL_QUADS
);
611 if (DO_TWOSTENCIL
&& !HAVE_STENCIL_TWOSIDE
&& ctx
->Stencil
.TestTwoSide
) {
612 SETUP_STENCIL(facing
);
613 QUAD( (v
[0]), (v
[1]), (v
[2]), (v
[3]) );
614 UNSET_STENCIL(facing
);
616 QUAD( (v
[0]), (v
[1]), (v
[2]), (v
[3]) );
622 VERT_SET_Z(v
[0], z
[0]);
623 VERT_SET_Z(v
[1], z
[1]);
624 VERT_SET_Z(v
[2], z
[2]);
625 VERT_SET_Z(v
[3], z
[3]);
628 if (DO_TWOSIDE
&& facing
== 1)
632 VERT_RESTORE_RGBA( 0 );
633 VERT_RESTORE_RGBA( 1 );
634 VERT_RESTORE_RGBA( 2 );
636 VERT_RESTORE_RGBA( 3 );
639 VERT_RESTORE_SPEC( 0 );
640 VERT_RESTORE_SPEC( 1 );
641 VERT_RESTORE_SPEC( 2 );
643 VERT_RESTORE_SPEC( 3 );
648 VERT_RESTORE_IND( 0 );
649 VERT_RESTORE_IND( 1 );
650 VERT_RESTORE_IND( 2 );
652 VERT_RESTORE_IND( 3 );
659 VERT_RESTORE_RGBA( 0 );
660 VERT_RESTORE_RGBA( 1 );
661 VERT_RESTORE_RGBA( 2 );
662 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
663 VERT_RESTORE_SPEC( 0 );
664 VERT_RESTORE_SPEC( 1 );
665 VERT_RESTORE_SPEC( 2 );
669 VERT_RESTORE_IND( 0 );
670 VERT_RESTORE_IND( 1 );
671 VERT_RESTORE_IND( 2 );
676 static void TAG(quadr
)( GLcontext
*ctx
, GLuint e0
,
677 GLuint e1
, GLuint e2
, GLuint e3
)
680 struct vertex_buffer
*VB
= &TNL_CONTEXT(ctx
)->vb
;
681 GLubyte ef1
= VB
->EdgeFlag
[e1
];
682 GLubyte ef3
= VB
->EdgeFlag
[e3
];
683 VB
->EdgeFlag
[e1
] = 0;
684 TAG(triangle
)( ctx
, e0
, e1
, e3
);
685 VB
->EdgeFlag
[e1
] = ef1
;
686 VB
->EdgeFlag
[e3
] = 0;
687 TAG(triangle
)( ctx
, e1
, e2
, e3
);
688 VB
->EdgeFlag
[e3
] = ef3
;
690 TAG(triangle
)( ctx
, e0
, e1
, e3
);
691 TAG(triangle
)( ctx
, e1
, e2
, e3
);
698 static void TAG(line
)( GLcontext
*ctx
, GLuint e0
, GLuint e1
)
700 struct vertex_buffer
*VB
= &TNL_CONTEXT(ctx
)->vb
;
704 v
[0] = (VERTEX
*)GET_VERTEX(e0
);
705 v
[1] = (VERTEX
*)GET_VERTEX(e1
);
710 VERT_COPY_RGBA( v
[0], v
[1] );
711 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
713 VERT_COPY_SPEC( v
[0], v
[1] );
718 VERT_COPY_IND( v
[0], v
[1] );
726 VERT_RESTORE_RGBA( 0 );
728 if (HAVE_SPEC
&& VB
->AttribPtr
[_TNL_ATTRIB_COLOR1
]) {
729 VERT_RESTORE_SPEC( 0 );
733 VERT_RESTORE_IND( 0 );
740 static void TAG(points
)( GLcontext
*ctx
, GLuint first
, GLuint last
)
742 struct vertex_buffer
*VB
= &TNL_CONTEXT( ctx
)->vb
;
747 for ( i
= first
; i
< last
; i
++ ) {
748 if ( VB
->ClipMask
[i
] == 0 ) {
749 VERTEX
*v
= (VERTEX
*)GET_VERTEX(i
);
754 for ( i
= first
; i
< last
; i
++ ) {
755 GLuint e
= VB
->Elts
[i
];
756 if ( VB
->ClipMask
[e
] == 0 ) {
757 VERTEX
*v
= (VERTEX
*)GET_VERTEX(e
);
765 static void TAG(init
)( void )
768 TAB
[IND
].quad
= TAG(quadr
);
771 TAB
[IND
].triangle
= TAG(triangle
);
774 TAB
[IND
].line
= TAG(line
);
777 TAB
[IND
].points
= TAG(points
);
788 #undef VERT_RESTORE_IND
794 #undef VERT_COPY_RGBA
795 #undef VERT_SAVE_RGBA
796 #undef VERT_RESTORE_RGBA
804 #undef VERT_COPY_SPEC
805 #undef VERT_SAVE_SPEC
806 #undef VERT_RESTORE_SPEC
808 #undef VERT_COPY_SPEC1
816 #if !HAVE_BACK_COLORS
817 #undef VERT_COPY_SPEC1
818 #undef VERT_COPY_IND1
819 #undef VERT_COPY_RGBA1
822 #ifndef INSANE_VERTICES