1 /* $Id: s_lines.c,v 1.14 2001/03/12 00:48:42 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 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.
34 #include "s_context.h"
37 #include "s_feedback.h"
41 /**********************************************************************/
42 /***** Rasterization *****/
43 /**********************************************************************/
47 * There are 4 pairs (RGBA, CI) of line drawing functions:
48 * 1. simple: width=1 and no special rasterization functions (fastest)
49 * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
50 * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
51 * 4. general: any other kind of line (slowest)
55 /* Flat, color index line */
56 static void flat_ci_line( GLcontext
*ctx
,
57 const SWvertex
*vert0
,
58 const SWvertex
*vert1
)
60 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
62 PB_SET_INDEX( PB
, vert0
->index
);
65 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
67 #include "s_linetemp.h"
74 /* Flat, color index line with Z interpolation/testing */
75 static void flat_ci_z_line( GLcontext
*ctx
,
76 const SWvertex
*vert0
,
77 const SWvertex
*vert1
)
79 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
80 PB_SET_INDEX( PB
, vert0
->index
);
85 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
87 #include "s_linetemp.h"
94 /* Flat-shaded, RGBA line */
95 static void flat_rgba_line( GLcontext
*ctx
,
96 const SWvertex
*vert0
,
97 const SWvertex
*vert1
)
99 const GLchan
*color
= vert1
->color
;
100 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
101 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
104 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
106 #include "s_linetemp.h"
113 /* Flat-shaded, RGBA line with Z interpolation/testing */
114 static void flat_rgba_z_line( GLcontext
*ctx
,
115 const SWvertex
*vert0
,
116 const SWvertex
*vert1
)
118 const GLchan
*color
= vert1
->color
;
119 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
120 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
125 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
127 #include "s_linetemp.h"
134 /* Smooth shaded, color index line */
135 static void smooth_ci_line( GLcontext
*ctx
,
136 const SWvertex
*vert0
,
137 const SWvertex
*vert1
)
139 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
140 GLint count
= PB
->count
;
143 GLuint
*pbi
= PB
->index
;
148 #define INTERP_INDEX 1
156 #include "s_linetemp.h"
164 /* Smooth shaded, color index line with Z interpolation/testing */
165 static void smooth_ci_z_line( GLcontext
*ctx
,
166 const SWvertex
*vert0
,
167 const SWvertex
*vert1
)
169 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
170 GLint count
= PB
->count
;
173 GLdepth
*pbz
= PB
->z
;
174 GLuint
*pbi
= PB
->index
;
181 #define INTERP_INDEX 1
190 #include "s_linetemp.h"
198 /* Smooth-shaded, RGBA line */
199 static void smooth_rgba_line( GLcontext
*ctx
,
200 const SWvertex
*vert0
,
201 const SWvertex
*vert1
)
203 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
204 GLint count
= PB
->count
;
207 GLchan (*pbrgba
)[4] = PB
->rgba
;
213 #define INTERP_ALPHA 1
218 pbrgba[count][RCOMP] = FixedToInt(r0); \
219 pbrgba[count][GCOMP] = FixedToInt(g0); \
220 pbrgba[count][BCOMP] = FixedToInt(b0); \
221 pbrgba[count][ACOMP] = FixedToInt(a0); \
224 #include "s_linetemp.h"
232 /* Smooth-shaded, RGBA line with Z interpolation/testing */
233 static void smooth_rgba_z_line( GLcontext
*ctx
,
234 const SWvertex
*vert0
,
235 const SWvertex
*vert1
)
237 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
238 GLint count
= PB
->count
;
241 GLdepth
*pbz
= PB
->z
;
242 GLfixed
*pbfog
= PB
->fog
;
243 GLchan (*pbrgba
)[4] = PB
->rgba
;
252 #define INTERP_ALPHA 1
258 pbfog[count] = fog0; \
259 pbrgba[count][RCOMP] = FixedToInt(r0); \
260 pbrgba[count][GCOMP] = FixedToInt(g0); \
261 pbrgba[count][BCOMP] = FixedToInt(b0); \
262 pbrgba[count][ACOMP] = FixedToInt(a0); \
265 #include "s_linetemp.h"
272 #define CHECK_FULL(count) \
273 if (count >= PB_SIZE-MAX_WIDTH) { \
275 _mesa_flush_pb(ctx); \
281 /* Smooth shaded, color index, any width, maybe stippled */
282 static void general_smooth_ci_line( GLcontext
*ctx
,
283 const SWvertex
*vert0
,
284 const SWvertex
*vert1
)
286 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
287 GLint count
= PB
->count
;
290 GLdepth
*pbz
= PB
->z
;
291 GLfixed
*pbfog
= PB
->fog
;
292 GLuint
*pbi
= PB
->index
;
296 if (ctx
->Line
.StippleFlag
) {
301 #define INTERP_INDEX 1
308 pbfog[count] = fog0; \
312 #include "s_linetemp.h"
316 if (ctx
->Line
.Width
==2.0F
) {
317 /* special case: unstippled and width=2 */
321 #define INTERP_INDEX 1
322 #define XMAJOR_PLOT(X,Y) \
323 pbx[count] = X; pbx[count+1] = X; \
324 pby[count] = Y; pby[count+1] = Y+1; \
325 pbz[count] = Z; pbz[count+1] = Z; \
326 pbfog[count] = fog0; pbfog[count+1] = fog0; \
327 pbi[count] = I; pbi[count+1] = I; \
330 #define YMAJOR_PLOT(X,Y) \
331 pbx[count] = X; pbx[count+1] = X+1; \
332 pby[count] = Y; pby[count+1] = Y; \
333 pbz[count] = Z; pbz[count+1] = Z; \
334 pbfog[count] = fog0; pbfog[count+1] = fog0; \
335 pbi[count] = I; pbi[count+1] = I; \
338 #include "s_linetemp.h"
341 /* unstippled, any width */
345 #define INTERP_INDEX 1
352 pbfog[count] = fog0; \
355 #include "s_linetemp.h"
364 /* Flat shaded, color index, any width, maybe stippled */
365 static void general_flat_ci_line( GLcontext
*ctx
,
366 const SWvertex
*vert0
,
367 const SWvertex
*vert1
)
369 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
373 GLdepth
*pbz
= PB
->z
;
374 GLfixed
*pbfog
= PB
->fog
;
375 PB_SET_INDEX( PB
, vert0
->index
);
378 if (ctx
->Line
.StippleFlag
) {
379 /* stippled, any width */
389 pbfog[count] = fog0; \
392 #include "s_linetemp.h"
396 if (ctx
->Line
.Width
==2.0F
) {
397 /* special case: unstippled and width=2 */
401 #define XMAJOR_PLOT(X,Y) \
402 pbx[count] = X; pbx[count+1] = X; \
403 pby[count] = Y; pby[count+1] = Y+1; \
404 pbz[count] = Z; pbz[count+1] = Z; \
405 pbfog[count] = fog0; pbfog[count+1] = fog0; \
408 #define YMAJOR_PLOT(X,Y) \
409 pbx[count] = X; pbx[count+1] = X+1; \
410 pby[count] = Y; pby[count+1] = Y; \
411 pbz[count] = Z; pbz[count+1] = Z; \
412 pbfog[count] = fog0; pbfog[count+1] = fog0; \
415 #include "s_linetemp.h"
418 /* unstippled, any width */
427 pbfog[count] = fog0; \
430 #include "s_linetemp.h"
440 static void general_smooth_rgba_line( GLcontext
*ctx
,
441 const SWvertex
*vert0
,
442 const SWvertex
*vert1
)
444 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
445 GLint count
= PB
->count
;
448 GLdepth
*pbz
= PB
->z
;
449 GLfixed
*pbfog
= PB
->fog
;
450 GLchan (*pbrgba
)[4] = PB
->rgba
;
454 if (ctx
->Line
.StippleFlag
) {
460 #define INTERP_ALPHA 1
467 pbfog[count] = fog0; \
468 pbrgba[count][RCOMP] = FixedToInt(r0); \
469 pbrgba[count][GCOMP] = FixedToInt(g0); \
470 pbrgba[count][BCOMP] = FixedToInt(b0); \
471 pbrgba[count][ACOMP] = FixedToInt(a0); \
474 #include "s_linetemp.h"
478 if (ctx
->Line
.Width
==2.0F
) {
479 /* special case: unstippled and width=2 */
484 #define INTERP_ALPHA 1
485 #define XMAJOR_PLOT(X,Y) \
486 pbx[count] = X; pbx[count+1] = X; \
487 pby[count] = Y; pby[count+1] = Y+1; \
488 pbz[count] = Z; pbz[count+1] = Z; \
489 pbfog[count] = fog0; pbfog[count+1] = fog0; \
490 pbrgba[count][RCOMP] = FixedToInt(r0); \
491 pbrgba[count][GCOMP] = FixedToInt(g0); \
492 pbrgba[count][BCOMP] = FixedToInt(b0); \
493 pbrgba[count][ACOMP] = FixedToInt(a0); \
494 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
495 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
496 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
497 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
500 #define YMAJOR_PLOT(X,Y) \
501 pbx[count] = X; pbx[count+1] = X+1; \
502 pby[count] = Y; pby[count+1] = Y; \
503 pbz[count] = Z; pbz[count+1] = Z; \
504 pbfog[count] = fog0; pbfog[count+1] = fog0; \
505 pbrgba[count][RCOMP] = FixedToInt(r0); \
506 pbrgba[count][GCOMP] = FixedToInt(g0); \
507 pbrgba[count][BCOMP] = FixedToInt(b0); \
508 pbrgba[count][ACOMP] = FixedToInt(a0); \
509 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
510 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
511 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
512 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
515 #include "s_linetemp.h"
518 /* unstippled, any width */
523 #define INTERP_ALPHA 1
529 pbfog[count] = fog0; \
530 pbrgba[count][RCOMP] = FixedToInt(r0); \
531 pbrgba[count][GCOMP] = FixedToInt(g0); \
532 pbrgba[count][BCOMP] = FixedToInt(b0); \
533 pbrgba[count][ACOMP] = FixedToInt(a0); \
536 #include "s_linetemp.h"
545 static void general_flat_rgba_line( GLcontext
*ctx
,
546 const SWvertex
*vert0
,
547 const SWvertex
*vert1
)
549 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
550 const GLchan
*color
= vert1
->color
;
551 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
553 if (ctx
->Line
.StippleFlag
) {
560 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
561 #include "s_linetemp.h"
565 if (ctx
->Line
.Width
==2.0F
) {
566 /* special case: unstippled and width=2 */
570 #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
571 PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0);
572 #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
573 PB_WRITE_PIXEL(PB, X+1, Y, Z, fog0);
574 #include "s_linetemp.h"
577 /* unstippled, any width */
582 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
583 #include "s_linetemp.h"
591 /* Flat-shaded, textured, any width, maybe stippled */
592 static void flat_textured_line( GLcontext
*ctx
,
593 const SWvertex
*vert0
,
594 const SWvertex
*vert1
)
596 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
600 GLdepth
*pbz
= PB
->z
;
601 GLfixed
*pbfog
= PB
->fog
;
602 GLfloat
*pbs
= PB
->s
[0];
603 GLfloat
*pbt
= PB
->t
[0];
604 GLfloat
*pbu
= PB
->u
[0];
605 GLchan
*color
= (GLchan
*) vert1
->color
;
606 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
609 if (ctx
->Line
.StippleFlag
) {
622 pbfog[count] = fog0; \
623 pbs[count] = fragTexcoord[0];\
624 pbt[count] = fragTexcoord[1];\
625 pbu[count] = fragTexcoord[2];\
629 #include "s_linetemp.h"
643 pbfog[count] = fog0; \
644 pbs[count] = fragTexcoord[0];\
645 pbt[count] = fragTexcoord[1];\
646 pbu[count] = fragTexcoord[2];\
650 #include "s_linetemp.h"
659 /* Smooth-shaded, textured, any width, maybe stippled */
660 static void smooth_textured_line( GLcontext
*ctx
,
661 const SWvertex
*vert0
,
662 const SWvertex
*vert1
)
664 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
665 GLint count
= PB
->count
;
668 GLdepth
*pbz
= PB
->z
;
669 GLfixed
*pbfog
= PB
->fog
;
670 GLfloat
*pbs
= PB
->s
[0];
671 GLfloat
*pbt
= PB
->t
[0];
672 GLfloat
*pbu
= PB
->u
[0];
673 GLchan (*pbrgba
)[4] = PB
->rgba
;
677 if (ctx
->Line
.StippleFlag
) {
683 #define INTERP_ALPHA 1
692 pbfog[count] = fog0; \
693 pbs[count] = fragTexcoord[0]; \
694 pbt[count] = fragTexcoord[1]; \
695 pbu[count] = fragTexcoord[2]; \
696 pbrgba[count][RCOMP] = FixedToInt(r0); \
697 pbrgba[count][GCOMP] = FixedToInt(g0); \
698 pbrgba[count][BCOMP] = FixedToInt(b0); \
699 pbrgba[count][ACOMP] = FixedToInt(a0); \
703 #include "s_linetemp.h"
711 #define INTERP_ALPHA 1
719 pbfog[count] = fog0; \
720 pbs[count] = fragTexcoord[0]; \
721 pbt[count] = fragTexcoord[1]; \
722 pbu[count] = fragTexcoord[2]; \
723 pbrgba[count][RCOMP] = FixedToInt(r0); \
724 pbrgba[count][GCOMP] = FixedToInt(g0); \
725 pbrgba[count][BCOMP] = FixedToInt(b0); \
726 pbrgba[count][ACOMP] = FixedToInt(a0); \
730 #include "s_linetemp.h"
738 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
739 * color interpolation.
741 static void smooth_multitextured_line( GLcontext
*ctx
,
742 const SWvertex
*vert0
,
743 const SWvertex
*vert1
)
745 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
746 GLint count
= PB
->count
;
749 GLdepth
*pbz
= PB
->z
;
750 GLfixed
*pbfog
= PB
->fog
;
751 GLchan (*pbrgba
)[4] = PB
->rgba
;
752 GLchan (*pbspec
)[3] = PB
->spec
;
756 if (ctx
->Line
.StippleFlag
) {
762 #define INTERP_SPEC 1
763 #define INTERP_ALPHA 1
764 #define INTERP_MULTITEX 1
773 pbfog[count] = fog0; \
774 pbrgba[count][RCOMP] = FixedToInt(r0); \
775 pbrgba[count][GCOMP] = FixedToInt(g0); \
776 pbrgba[count][BCOMP] = FixedToInt(b0); \
777 pbrgba[count][ACOMP] = FixedToInt(a0); \
778 pbspec[count][RCOMP] = FixedToInt(sr0); \
779 pbspec[count][GCOMP] = FixedToInt(sg0); \
780 pbspec[count][BCOMP] = FixedToInt(sb0); \
781 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
782 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
783 PB->s[u][0] = fragTexcoord[u][0]; \
784 PB->s[u][1] = fragTexcoord[u][1]; \
785 PB->s[u][2] = fragTexcoord[u][2]; \
786 PB->s[u][3] = fragTexcoord[u][3]; \
792 #include "s_linetemp.h"
800 #define INTERP_SPEC 1
801 #define INTERP_ALPHA 1
802 #define INTERP_MULTITEX 1
810 pbfog[count] = fog0; \
811 pbrgba[count][RCOMP] = FixedToInt(r0); \
812 pbrgba[count][GCOMP] = FixedToInt(g0); \
813 pbrgba[count][BCOMP] = FixedToInt(b0); \
814 pbrgba[count][ACOMP] = FixedToInt(a0); \
815 pbspec[count][RCOMP] = FixedToInt(sr0); \
816 pbspec[count][GCOMP] = FixedToInt(sg0); \
817 pbspec[count][BCOMP] = FixedToInt(sb0); \
818 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
819 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
820 PB->s[u][0] = fragTexcoord[u][0]; \
821 PB->s[u][1] = fragTexcoord[u][1]; \
822 PB->s[u][2] = fragTexcoord[u][2]; \
823 PB->s[u][3] = fragTexcoord[u][3]; \
829 #include "s_linetemp.h"
837 /* Flat-shaded, multitextured, any width, maybe stippled, separate specular
838 * color interpolation.
840 static void flat_multitextured_line( GLcontext
*ctx
,
841 const SWvertex
*vert0
,
842 const SWvertex
*vert1
)
844 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
845 GLint count
= PB
->count
;
848 GLdepth
*pbz
= PB
->z
;
849 GLfixed
*pbfog
= PB
->fog
;
850 GLchan (*pbrgba
)[4] = PB
->rgba
;
851 GLchan (*pbspec
)[3] = PB
->spec
;
852 GLchan
*color
= (GLchan
*) vert1
->color
;
853 GLchan sRed
= vert1
->specular
[0];
854 GLchan sGreen
= vert1
->specular
[1];
855 GLchan sBlue
= vert1
->specular
[2];
859 if (ctx
->Line
.StippleFlag
) {
864 #define INTERP_ALPHA 1
865 #define INTERP_MULTITEX 1
874 pbfog[count] = fog0; \
875 pbrgba[count][RCOMP] = color[0]; \
876 pbrgba[count][GCOMP] = color[1]; \
877 pbrgba[count][BCOMP] = color[2]; \
878 pbrgba[count][ACOMP] = color[3]; \
879 pbspec[count][RCOMP] = sRed; \
880 pbspec[count][GCOMP] = sGreen; \
881 pbspec[count][BCOMP] = sBlue; \
882 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
883 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
884 PB->s[u][0] = fragTexcoord[u][0]; \
885 PB->s[u][1] = fragTexcoord[u][1]; \
886 PB->s[u][2] = fragTexcoord[u][2]; \
887 PB->s[u][3] = fragTexcoord[u][3]; \
893 #include "s_linetemp.h"
900 #define INTERP_ALPHA 1
901 #define INTERP_MULTITEX 1
909 pbfog[count] = fog0; \
910 pbrgba[count][RCOMP] = color[0]; \
911 pbrgba[count][GCOMP] = color[1]; \
912 pbrgba[count][BCOMP] = color[2]; \
913 pbrgba[count][ACOMP] = color[3]; \
914 pbspec[count][RCOMP] = sRed; \
915 pbspec[count][GCOMP] = sGreen; \
916 pbspec[count][BCOMP] = sBlue; \
917 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
918 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
919 PB->s[u][0] = fragTexcoord[u][0]; \
920 PB->s[u][1] = fragTexcoord[u][1]; \
921 PB->s[u][2] = fragTexcoord[u][2]; \
922 PB->s[u][3] = fragTexcoord[u][3]; \
928 #include "s_linetemp.h"
936 void _swrast_add_spec_terms_line( GLcontext
*ctx
,
940 SWvertex
*ncv0
= (SWvertex
*)v0
;
941 SWvertex
*ncv1
= (SWvertex
*)v1
;
943 COPY_CHAN4( c
[0], ncv0
->color
);
944 COPY_CHAN4( c
[1], ncv1
->color
);
945 ACC_3V( ncv0
->color
, ncv0
->specular
);
946 ACC_3V( ncv1
->color
, ncv1
->specular
);
947 SWRAST_CONTEXT(ctx
)->SpecLine( ctx
, ncv0
, ncv1
);
948 COPY_CHAN4( ncv0
->color
, c
[0] );
949 COPY_CHAN4( ncv1
->color
, c
[1] );
955 _mesa_print_line_function(GLcontext
*ctx
); /* silence compiler warning */
957 _mesa_print_line_function(GLcontext
*ctx
)
959 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
961 printf("Line Func == ");
962 if (swrast
->Line
== flat_ci_line
)
963 printf("flat_ci_line\n");
964 else if (swrast
->Line
== flat_ci_z_line
)
965 printf("flat_ci_z_line\n");
966 else if (swrast
->Line
== flat_rgba_line
)
967 printf("flat_rgba_line\n");
968 else if (swrast
->Line
== flat_rgba_z_line
)
969 printf("flat_rgba_z_line\n");
970 else if (swrast
->Line
== smooth_ci_line
)
971 printf("smooth_ci_line\n");
972 else if (swrast
->Line
== smooth_ci_z_line
)
973 printf("smooth_ci_z_line\n");
974 else if (swrast
->Line
== smooth_rgba_line
)
975 printf("smooth_rgba_line\n");
976 else if (swrast
->Line
== smooth_rgba_z_line
)
977 printf("smooth_rgba_z_line\n");
978 else if (swrast
->Line
== general_smooth_ci_line
)
979 printf("general_smooth_ci_line\n");
980 else if (swrast
->Line
== general_flat_ci_line
)
981 printf("general_flat_ci_line\n");
982 else if (swrast
->Line
== general_smooth_rgba_line
)
983 printf("general_smooth_rgba_line\n");
984 else if (swrast
->Line
== general_flat_rgba_line
)
985 printf("general_flat_rgba_line\n");
986 else if (swrast
->Line
== flat_textured_line
)
987 printf("flat_textured_line\n");
988 else if (swrast
->Line
== smooth_textured_line
)
989 printf("smooth_textured_line\n");
990 else if (swrast
->Line
== smooth_multitextured_line
)
991 printf("smooth_multitextured_line\n");
992 else if (swrast
->Line
== flat_multitextured_line
)
993 printf("flat_multitextured_line\n");
995 printf("Driver func %p\n", swrast
->Line
);
1002 * Determine which line drawing function to use given the current
1003 * rendering context.
1005 * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
1006 * tests to this code.
1009 _swrast_choose_line( GLcontext
*ctx
)
1011 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
1012 const GLboolean rgbmode
= ctx
->Visual
.rgbMode
;
1014 if (ctx
->RenderMode
==GL_RENDER
) {
1015 if (ctx
->Line
.SmoothFlag
) {
1016 /* antialiased lines */
1017 _swrast_choose_aa_line_function(ctx
);
1018 ASSERT(swrast
->Triangle
);
1020 else if (ctx
->Texture
._ReallyEnabled
) {
1021 if (swrast
->_MultiTextureEnabled
||
1022 (ctx
->_TriangleCaps
& DD_SEPERATE_SPECULAR
)) {
1023 /* multi-texture and/or separate specular color */
1024 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
)
1025 swrast
->Line
= smooth_multitextured_line
;
1027 swrast
->Line
= flat_multitextured_line
;
1030 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1031 swrast
->Line
= smooth_textured_line
;
1034 swrast
->Line
= flat_textured_line
;
1038 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
) {
1039 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1041 swrast
->Line
= general_smooth_rgba_line
;
1043 swrast
->Line
= general_smooth_ci_line
;
1047 swrast
->Line
= general_flat_rgba_line
;
1049 swrast
->Line
= general_flat_ci_line
;
1053 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1054 /* Width==1, non-stippled, smooth-shaded */
1055 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1057 swrast
->Line
= smooth_rgba_z_line
;
1059 swrast
->Line
= smooth_ci_z_line
;
1063 swrast
->Line
= smooth_rgba_line
;
1065 swrast
->Line
= smooth_ci_line
;
1069 /* Width==1, non-stippled, flat-shaded */
1070 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1072 swrast
->Line
= flat_rgba_z_line
;
1074 swrast
->Line
= flat_ci_z_line
;
1078 swrast
->Line
= flat_rgba_line
;
1080 swrast
->Line
= flat_ci_line
;
1085 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1086 swrast
->Line
= _mesa_feedback_line
;
1089 /* GL_SELECT mode */
1090 swrast
->Line
= _mesa_select_line
;
1093 /*_mesa_print_line_function(ctx);*/