1 /* $Id: lines.c,v 1.3 1999/10/08 09:27:11 keithw Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 #include "GL/xf86glx.h"
50 #include "GL/xf86glx.h"
56 void gl_LineWidth( GLcontext
*ctx
, GLfloat width
)
59 gl_error( ctx
, GL_INVALID_VALUE
, "glLineWidth" );
62 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glLineWidth");
64 if (ctx
->Line
.Width
!= width
) {
65 ctx
->Line
.Width
= width
;
66 ctx
->TriangleCaps
&= ~DD_LINE_WIDTH
;
67 if (width
!= 1.0) ctx
->TriangleCaps
|= DD_LINE_WIDTH
;
68 ctx
->NewState
|= NEW_RASTER_OPS
;
74 void gl_LineStipple( GLcontext
*ctx
, GLint factor
, GLushort pattern
)
76 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glLineStipple");
77 ctx
->Line
.StippleFactor
= CLAMP( factor
, 1, 256 );
78 ctx
->Line
.StipplePattern
= pattern
;
79 ctx
->NewState
|= NEW_RASTER_OPS
;
84 /**********************************************************************/
85 /***** Rasterization *****/
86 /**********************************************************************/
90 * There are 4 pairs (RGBA, CI) of line drawing functions:
91 * 1. simple: width=1 and no special rasterization functions (fastest)
92 * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
93 * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
94 * 4. general: any other kind of line (slowest)
99 * All line drawing functions have the same arguments:
100 * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
101 * pv - provoking vertex: which vertex color/index to use for flat shading.
109 #if MAX_WIDTH > MAX_HEIGHT
110 # define MAXPOINTS MAX_WIDTH
112 # define MAXPOINTS MAX_HEIGHT
116 /* Flat, color index line */
117 static void flat_ci_line( GLcontext
*ctx
,
118 GLuint vert0
, GLuint vert1
, GLuint pvert
)
121 GLint
*pbx
= ctx
->PB
->x
;
122 GLint
*pby
= ctx
->PB
->y
;
123 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
124 count
= ctx
->PB
->count
;
133 #include "linetemp.h"
135 ctx
->PB
->count
= count
;
136 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
141 /* Flat, color index line with Z interpolation/testing */
142 static void flat_ci_z_line( GLcontext
*ctx
,
143 GLuint vert0
, GLuint vert1
, GLuint pvert
)
146 GLint
*pbx
= ctx
->PB
->x
;
147 GLint
*pby
= ctx
->PB
->y
;
148 GLdepth
*pbz
= ctx
->PB
->z
;
149 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
150 count
= ctx
->PB
->count
;
161 #include "linetemp.h"
163 ctx
->PB
->count
= count
;
164 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
169 /* Flat-shaded, RGBA line */
170 static void flat_rgba_line( GLcontext
*ctx
,
171 GLuint vert0
, GLuint vert1
, GLuint pvert
)
174 GLint
*pbx
= ctx
->PB
->x
;
175 GLint
*pby
= ctx
->PB
->y
;
176 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
177 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
178 count
= ctx
->PB
->count
;
187 #include "linetemp.h"
189 ctx
->PB
->count
= count
;
190 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
195 /* Flat-shaded, RGBA line with Z interpolation/testing */
196 static void flat_rgba_z_line( GLcontext
*ctx
,
197 GLuint vert0
, GLuint vert1
, GLuint pvert
)
200 GLint
*pbx
= ctx
->PB
->x
;
201 GLint
*pby
= ctx
->PB
->y
;
202 GLdepth
*pbz
= ctx
->PB
->z
;
203 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
204 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
205 count
= ctx
->PB
->count
;
216 #include "linetemp.h"
218 ctx
->PB
->count
= count
;
219 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
224 /* Smooth shaded, color index line */
225 static void smooth_ci_line( GLcontext
*ctx
,
226 GLuint vert0
, GLuint vert1
, GLuint pvert
)
228 GLint count
= ctx
->PB
->count
;
229 GLint
*pbx
= ctx
->PB
->x
;
230 GLint
*pby
= ctx
->PB
->y
;
231 GLuint
*pbi
= ctx
->PB
->i
;
235 #define INTERP_INDEX 1
243 #include "linetemp.h"
245 ctx
->PB
->count
= count
;
246 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
251 /* Smooth shaded, color index line with Z interpolation/testing */
252 static void smooth_ci_z_line( GLcontext
*ctx
,
253 GLuint vert0
, GLuint vert1
, GLuint pvert
)
255 GLint count
= ctx
->PB
->count
;
256 GLint
*pbx
= ctx
->PB
->x
;
257 GLint
*pby
= ctx
->PB
->y
;
258 GLdepth
*pbz
= ctx
->PB
->z
;
259 GLuint
*pbi
= ctx
->PB
->i
;
264 #define INTERP_INDEX 1
273 #include "linetemp.h"
275 ctx
->PB
->count
= count
;
276 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
281 /* Smooth-shaded, RGBA line */
282 static void smooth_rgba_line( GLcontext
*ctx
,
283 GLuint vert0
, GLuint vert1
, GLuint pvert
)
285 GLint count
= ctx
->PB
->count
;
286 GLint
*pbx
= ctx
->PB
->x
;
287 GLint
*pby
= ctx
->PB
->y
;
288 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
293 #define INTERP_ALPHA 1
298 pbrgba[count][RCOMP] = FixedToInt(r0); \
299 pbrgba[count][GCOMP] = FixedToInt(g0); \
300 pbrgba[count][BCOMP] = FixedToInt(b0); \
301 pbrgba[count][ACOMP] = FixedToInt(a0); \
304 #include "linetemp.h"
306 ctx
->PB
->count
= count
;
307 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
312 /* Smooth-shaded, RGBA line with Z interpolation/testing */
313 static void smooth_rgba_z_line( GLcontext
*ctx
,
314 GLuint vert0
, GLuint vert1
, GLuint pvert
)
316 GLint count
= ctx
->PB
->count
;
317 GLint
*pbx
= ctx
->PB
->x
;
318 GLint
*pby
= ctx
->PB
->y
;
319 GLdepth
*pbz
= ctx
->PB
->z
;
320 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
326 #define INTERP_ALPHA 1
332 pbrgba[count][RCOMP] = FixedToInt(r0); \
333 pbrgba[count][GCOMP] = FixedToInt(g0); \
334 pbrgba[count][BCOMP] = FixedToInt(b0); \
335 pbrgba[count][ACOMP] = FixedToInt(a0); \
338 #include "linetemp.h"
340 ctx
->PB
->count
= count
;
341 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
345 #define CHECK_FULL(count) \
346 if (count >= PB_SIZE-MAX_WIDTH) { \
347 ctx->PB->count = count; \
349 count = ctx->PB->count; \
354 /* Smooth shaded, color index, any width, maybe stippled */
355 static void general_smooth_ci_line( GLcontext
*ctx
,
356 GLuint vert0
, GLuint vert1
, GLuint pvert
)
358 GLint count
= ctx
->PB
->count
;
359 GLint
*pbx
= ctx
->PB
->x
;
360 GLint
*pby
= ctx
->PB
->y
;
361 GLdepth
*pbz
= ctx
->PB
->z
;
362 GLuint
*pbi
= ctx
->PB
->i
;
365 if (ctx
->Line
.StippleFlag
) {
369 #define INTERP_INDEX 1
379 #include "linetemp.h"
383 if (ctx
->Line
.Width
==2.0F
) {
384 /* special case: unstippled and width=2 */
387 #define INTERP_INDEX 1
388 #define XMAJOR_PLOT(X,Y) \
389 pbx[count] = X; pbx[count+1] = X; \
390 pby[count] = Y; pby[count+1] = Y+1; \
391 pbz[count] = Z; pbz[count+1] = Z; \
392 pbi[count] = I; pbi[count+1] = I; \
395 #define YMAJOR_PLOT(X,Y) \
396 pbx[count] = X; pbx[count+1] = X+1; \
397 pby[count] = Y; pby[count+1] = Y; \
398 pbz[count] = Z; pbz[count+1] = Z; \
399 pbi[count] = I; pbi[count+1] = I; \
402 #include "linetemp.h"
405 /* unstippled, any width */
408 #define INTERP_INDEX 1
417 #include "linetemp.h"
421 ctx
->PB
->count
= count
;
422 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
426 /* Flat shaded, color index, any width, maybe stippled */
427 static void general_flat_ci_line( GLcontext
*ctx
,
428 GLuint vert0
, GLuint vert1
, GLuint pvert
)
431 GLint
*pbx
= ctx
->PB
->x
;
432 GLint
*pby
= ctx
->PB
->y
;
433 GLdepth
*pbz
= ctx
->PB
->z
;
434 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
435 count
= ctx
->PB
->count
;
437 if (ctx
->Line
.StippleFlag
) {
438 /* stippled, any width */
449 #include "linetemp.h"
453 if (ctx
->Line
.Width
==2.0F
) {
454 /* special case: unstippled and width=2 */
457 #define XMAJOR_PLOT(X,Y) \
458 pbx[count] = X; pbx[count+1] = X; \
459 pby[count] = Y; pby[count+1] = Y+1; \
460 pbz[count] = Z; pbz[count+1] = Z; \
463 #define YMAJOR_PLOT(X,Y) \
464 pbx[count] = X; pbx[count+1] = X+1; \
465 pby[count] = Y; pby[count+1] = Y; \
466 pbz[count] = Z; pbz[count+1] = Z; \
469 #include "linetemp.h"
472 /* unstippled, any width */
482 #include "linetemp.h"
486 ctx
->PB
->count
= count
;
487 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
492 static void general_smooth_rgba_line( GLcontext
*ctx
,
493 GLuint vert0
, GLuint vert1
, GLuint pvert
)
495 GLint count
= ctx
->PB
->count
;
496 GLint
*pbx
= ctx
->PB
->x
;
497 GLint
*pby
= ctx
->PB
->y
;
498 GLdepth
*pbz
= ctx
->PB
->z
;
499 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
502 if (ctx
->Line
.StippleFlag
) {
507 #define INTERP_ALPHA 1
514 pbrgba[count][RCOMP] = FixedToInt(r0); \
515 pbrgba[count][GCOMP] = FixedToInt(g0); \
516 pbrgba[count][BCOMP] = FixedToInt(b0); \
517 pbrgba[count][ACOMP] = FixedToInt(a0); \
520 #include "linetemp.h"
524 if (ctx
->Line
.Width
==2.0F
) {
525 /* special case: unstippled and width=2 */
529 #define INTERP_ALPHA 1
530 #define XMAJOR_PLOT(X,Y) \
531 pbx[count] = X; pbx[count+1] = X; \
532 pby[count] = Y; pby[count+1] = Y+1; \
533 pbz[count] = Z; pbz[count+1] = Z; \
534 pbrgba[count][RCOMP] = FixedToInt(r0); \
535 pbrgba[count][GCOMP] = FixedToInt(g0); \
536 pbrgba[count][BCOMP] = FixedToInt(b0); \
537 pbrgba[count][ACOMP] = FixedToInt(a0); \
538 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
539 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
540 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
541 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
544 #define YMAJOR_PLOT(X,Y) \
545 pbx[count] = X; pbx[count+1] = X+1; \
546 pby[count] = Y; pby[count+1] = Y; \
547 pbz[count] = Z; pbz[count+1] = Z; \
548 pbrgba[count][RCOMP] = FixedToInt(r0); \
549 pbrgba[count][GCOMP] = FixedToInt(g0); \
550 pbrgba[count][BCOMP] = FixedToInt(b0); \
551 pbrgba[count][ACOMP] = FixedToInt(a0); \
552 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
553 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
554 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
555 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
558 #include "linetemp.h"
561 /* unstippled, any width */
565 #define INTERP_ALPHA 1
571 pbrgba[count][RCOMP] = FixedToInt(r0); \
572 pbrgba[count][GCOMP] = FixedToInt(g0); \
573 pbrgba[count][BCOMP] = FixedToInt(b0); \
574 pbrgba[count][ACOMP] = FixedToInt(a0); \
577 #include "linetemp.h"
581 ctx
->PB
->count
= count
;
582 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
586 static void general_flat_rgba_line( GLcontext
*ctx
,
587 GLuint vert0
, GLuint vert1
, GLuint pvert
)
590 GLint
*pbx
= ctx
->PB
->x
;
591 GLint
*pby
= ctx
->PB
->y
;
592 GLdepth
*pbz
= ctx
->PB
->z
;
593 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
594 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
595 count
= ctx
->PB
->count
;
597 if (ctx
->Line
.StippleFlag
) {
609 #include "linetemp.h"
613 if (ctx
->Line
.Width
==2.0F
) {
614 /* special case: unstippled and width=2 */
617 #define XMAJOR_PLOT(X,Y) \
618 pbx[count] = X; pbx[count+1] = X; \
619 pby[count] = Y; pby[count+1] = Y+1; \
620 pbz[count] = Z; pbz[count+1] = Z; \
623 #define YMAJOR_PLOT(X,Y) \
624 pbx[count] = X; pbx[count+1] = X+1; \
625 pby[count] = Y; pby[count+1] = Y; \
626 pbz[count] = Z; pbz[count+1] = Z; \
629 #include "linetemp.h"
632 /* unstippled, any width */
642 #include "linetemp.h"
646 ctx
->PB
->count
= count
;
647 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
651 /* Flat-shaded, textured, any width, maybe stippled */
652 static void flat_textured_line( GLcontext
*ctx
,
653 GLuint vert0
, GLuint vert1
, GLuint pv
)
656 GLint
*pbx
= ctx
->PB
->x
;
657 GLint
*pby
= ctx
->PB
->y
;
658 GLdepth
*pbz
= ctx
->PB
->z
;
659 GLfloat
*pbs
= ctx
->PB
->s
[0];
660 GLfloat
*pbt
= ctx
->PB
->t
[0];
661 GLfloat
*pbu
= ctx
->PB
->u
[0];
662 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
663 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
664 count
= ctx
->PB
->count
;
666 if (ctx
->Line
.StippleFlag
) {
670 #define INTERP_STUV0 1
684 #include "linetemp.h"
690 #define INTERP_STUV0 1
703 #include "linetemp.h"
706 ctx
->PB
->count
= count
;
707 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
712 /* Smooth-shaded, textured, any width, maybe stippled */
713 static void smooth_textured_line( GLcontext
*ctx
,
714 GLuint vert0
, GLuint vert1
, GLuint pvert
)
716 GLint count
= ctx
->PB
->count
;
717 GLint
*pbx
= ctx
->PB
->x
;
718 GLint
*pby
= ctx
->PB
->y
;
719 GLdepth
*pbz
= ctx
->PB
->z
;
720 GLfloat
*pbs
= ctx
->PB
->s
[0];
721 GLfloat
*pbt
= ctx
->PB
->t
[0];
722 GLfloat
*pbu
= ctx
->PB
->u
[0];
723 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
726 if (ctx
->Line
.StippleFlag
) {
731 #define INTERP_ALPHA 1
732 #define INTERP_STUV0 1
743 pbrgba[count][RCOMP] = FixedToInt(r0); \
744 pbrgba[count][GCOMP] = FixedToInt(g0); \
745 pbrgba[count][BCOMP] = FixedToInt(b0); \
746 pbrgba[count][ACOMP] = FixedToInt(a0); \
750 #include "linetemp.h"
757 #define INTERP_ALPHA 1
758 #define INTERP_STUV0 1
768 pbrgba[count][RCOMP] = FixedToInt(r0); \
769 pbrgba[count][GCOMP] = FixedToInt(g0); \
770 pbrgba[count][BCOMP] = FixedToInt(b0); \
771 pbrgba[count][ACOMP] = FixedToInt(a0); \
775 #include "linetemp.h"
778 ctx
->PB
->count
= count
;
779 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
783 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
784 * color interpolation.
786 static void smooth_multitextured_line( GLcontext
*ctx
,
787 GLuint vert0
, GLuint vert1
, GLuint pvert
)
789 GLint count
= ctx
->PB
->count
;
790 GLint
*pbx
= ctx
->PB
->x
;
791 GLint
*pby
= ctx
->PB
->y
;
792 GLdepth
*pbz
= ctx
->PB
->z
;
793 GLfloat
*pbs
= ctx
->PB
->s
[0];
794 GLfloat
*pbt
= ctx
->PB
->t
[0];
795 GLfloat
*pbu
= ctx
->PB
->u
[0];
796 GLfloat
*pbs1
= ctx
->PB
->s
[1];
797 GLfloat
*pbt1
= ctx
->PB
->t
[1];
798 GLfloat
*pbu1
= ctx
->PB
->u
[1];
799 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
800 GLubyte (*pbspec
)[3] = ctx
->PB
->spec
;
803 if (ctx
->Line
.StippleFlag
) {
808 #define INTERP_SPEC 1
809 #define INTERP_ALPHA 1
810 #define INTERP_STUV0 1
811 #define INTERP_STUV1 1
825 pbrgba[count][RCOMP] = FixedToInt(r0); \
826 pbrgba[count][GCOMP] = FixedToInt(g0); \
827 pbrgba[count][BCOMP] = FixedToInt(b0); \
828 pbrgba[count][ACOMP] = FixedToInt(a0); \
829 pbspec[count][RCOMP] = FixedToInt(sr0); \
830 pbspec[count][GCOMP] = FixedToInt(sg0); \
831 pbspec[count][BCOMP] = FixedToInt(sb0); \
835 #include "linetemp.h"
842 #define INTERP_SPEC 1
843 #define INTERP_ALPHA 1
844 #define INTERP_STUV0 1
845 #define INTERP_STUV1 1
858 pbrgba[count][RCOMP] = FixedToInt(r0); \
859 pbrgba[count][GCOMP] = FixedToInt(g0); \
860 pbrgba[count][BCOMP] = FixedToInt(b0); \
861 pbrgba[count][ACOMP] = FixedToInt(a0); \
862 pbspec[count][RCOMP] = FixedToInt(sr0); \
863 pbspec[count][GCOMP] = FixedToInt(sg0); \
864 pbspec[count][BCOMP] = FixedToInt(sb0); \
868 #include "linetemp.h"
871 ctx
->PB
->count
= count
;
872 PB_CHECK_FLUSH( ctx
, ctx
->PB
);
877 * Antialiased RGBA line
879 * This AA line function isn't terribly efficient but it's pretty
880 * straight-forward to understand. Also, it doesn't exactly conform
881 * to the specification.
883 static void aa_rgba_line( GLcontext
*ctx
,
884 GLuint vert0
, GLuint vert1
, GLuint pvert
)
886 #define INTERP_RGBA 1
887 #define PLOT(x, y) { PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, red, green, blue, coverage ); }
888 #include "lnaatemp.h"
892 * Antialiased Textured RGBA line
894 * This AA line function isn't terribly efficient but it's pretty
895 * straight-forward to understand. Also, it doesn't exactly conform
896 * to the specification.
898 static void aa_tex_rgba_line( GLcontext
*ctx
,
899 GLuint vert0
, GLuint vert1
, GLuint pvert
)
901 #define INTERP_RGBA 1
902 #define INTERP_STUV0 1
905 PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \
908 #include "lnaatemp.h"
913 * Antialiased Multitextured RGBA line
915 * This AA line function isn't terribly efficient but it's pretty
916 * straight-forward to understand. Also, it doesn't exactly conform
917 * to the specification.
919 static void aa_multitex_rgba_line( GLcontext
*ctx
,
920 GLuint vert0
, GLuint vert1
, GLuint pvert
)
922 #define INTERP_RGBA 1
923 #define INTERP_SPEC 1
924 #define INTERP_STUV0 1
925 #define INTERP_STUV1 1
928 PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \
929 red, green, blue, coverage, specRed, specGreen, specBlue, \
930 s, t, u, s1, t1, u1 ); \
932 #include "lnaatemp.h"
937 * Antialiased CI line. Same comments for RGBA antialiased lines apply.
939 static void aa_ci_line( GLcontext
*ctx
,
940 GLuint vert0
, GLuint vert1
, GLuint pvert
)
942 #define INTERP_INDEX 1
945 PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \
947 #include "lnaatemp.h"
952 * Null rasterizer for measuring transformation speed.
954 static void null_line( GLcontext
*ctx
, GLuint v1
, GLuint v2
, GLuint pv
)
964 * Determine which line drawing function to use given the current
967 void gl_set_line_function( GLcontext
*ctx
)
969 GLboolean rgbmode
= ctx
->Visual
->RGBAflag
;
970 /* TODO: antialiased lines */
972 if (ctx
->RenderMode
==GL_RENDER
) {
974 ctx
->Driver
.LineFunc
= null_line
;
977 if (ctx
->Driver
.LineFunc
) {
978 /* Device driver will draw lines. */
982 if (ctx
->Line
.SmoothFlag
) {
983 /* antialiased lines */
985 if (ctx
->Texture
.ReallyEnabled
) {
986 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
987 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
989 ctx
->Driver
.LineFunc
= aa_multitex_rgba_line
;
991 ctx
->Driver
.LineFunc
= aa_tex_rgba_line
;
993 ctx
->Driver
.LineFunc
= aa_rgba_line
;
997 ctx
->Driver
.LineFunc
= aa_ci_line
;
1000 else if (ctx
->Texture
.ReallyEnabled
) {
1001 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
1002 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
) {
1003 /* multi-texture and/or separate specular color */
1004 ctx
->Driver
.LineFunc
= smooth_multitextured_line
;
1007 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1008 ctx
->Driver
.LineFunc
= smooth_textured_line
;
1011 ctx
->Driver
.LineFunc
= flat_textured_line
;
1015 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
1016 || ctx
->Line
.SmoothFlag
) {
1017 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1019 ctx
->Driver
.LineFunc
= general_smooth_rgba_line
;
1021 ctx
->Driver
.LineFunc
= general_smooth_ci_line
;
1025 ctx
->Driver
.LineFunc
= general_flat_rgba_line
;
1027 ctx
->Driver
.LineFunc
= general_flat_ci_line
;
1031 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1032 /* Width==1, non-stippled, smooth-shaded */
1034 || (ctx
->Fog
.Enabled
&& ctx
->Hint
.Fog
==GL_NICEST
)) {
1036 ctx
->Driver
.LineFunc
= smooth_rgba_z_line
;
1038 ctx
->Driver
.LineFunc
= smooth_ci_z_line
;
1042 ctx
->Driver
.LineFunc
= smooth_rgba_line
;
1044 ctx
->Driver
.LineFunc
= smooth_ci_line
;
1048 /* Width==1, non-stippled, flat-shaded */
1050 || (ctx
->Fog
.Enabled
&& ctx
->Hint
.Fog
==GL_NICEST
)) {
1052 ctx
->Driver
.LineFunc
= flat_rgba_z_line
;
1054 ctx
->Driver
.LineFunc
= flat_ci_z_line
;
1058 ctx
->Driver
.LineFunc
= flat_rgba_line
;
1060 ctx
->Driver
.LineFunc
= flat_ci_line
;
1065 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1066 ctx
->Driver
.LineFunc
= gl_feedback_line
;
1069 /* GL_SELECT mode */
1070 ctx
->Driver
.LineFunc
= gl_select_line
;