1 /* $Id: s_lines.c,v 1.4 2000/11/10 17:45:16 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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)
56 /* Flat, color index line */
57 static void flat_ci_line( GLcontext
*ctx
,
61 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
63 PB_SET_INDEX( PB
, vert0
->index
);
66 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
68 #include "s_linetemp.h"
75 /* Flat, color index line with Z interpolation/testing */
76 static void flat_ci_z_line( GLcontext
*ctx
,
80 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
81 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
,
99 const GLchan
*color
= vert0
->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
,
118 const GLchan
*color
= vert0
->color
;
119 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
120 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
124 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
126 #include "s_linetemp.h"
133 /* Smooth shaded, color index line */
134 static void smooth_ci_line( GLcontext
*ctx
,
138 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
139 GLint count
= PB
->count
;
142 GLuint
*pbi
= PB
->index
;
147 #define INTERP_INDEX 1
155 #include "s_linetemp.h"
163 /* Smooth shaded, color index line with Z interpolation/testing */
164 static void smooth_ci_z_line( GLcontext
*ctx
,
168 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
169 GLint count
= PB
->count
;
172 GLdepth
*pbz
= PB
->z
;
173 GLuint
*pbi
= PB
->index
;
179 #define INTERP_INDEX 1
188 #include "s_linetemp.h"
196 /* Smooth-shaded, RGBA line */
197 static void smooth_rgba_line( GLcontext
*ctx
,
201 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
202 GLint count
= PB
->count
;
205 GLchan (*pbrgba
)[4] = PB
->rgba
;
211 #define INTERP_ALPHA 1
216 pbrgba[count][RCOMP] = FixedToInt(r0); \
217 pbrgba[count][GCOMP] = FixedToInt(g0); \
218 pbrgba[count][BCOMP] = FixedToInt(b0); \
219 pbrgba[count][ACOMP] = FixedToInt(a0); \
222 #include "s_linetemp.h"
230 /* Smooth-shaded, RGBA line with Z interpolation/testing */
231 static void smooth_rgba_z_line( GLcontext
*ctx
,
235 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
236 GLint count
= PB
->count
;
239 GLdepth
*pbz
= PB
->z
;
240 GLfixed
*pbfog
= PB
->fog
;
241 GLchan (*pbrgba
)[4] = PB
->rgba
;
249 #define INTERP_ALPHA 1
255 pbfog[count] = fog0; \
256 pbrgba[count][RCOMP] = FixedToInt(r0); \
257 pbrgba[count][GCOMP] = FixedToInt(g0); \
258 pbrgba[count][BCOMP] = FixedToInt(b0); \
259 pbrgba[count][ACOMP] = FixedToInt(a0); \
262 #include "s_linetemp.h"
269 #define CHECK_FULL(count) \
270 if (count >= PB_SIZE-MAX_WIDTH) { \
278 /* Smooth shaded, color index, any width, maybe stippled */
279 static void general_smooth_ci_line( GLcontext
*ctx
,
283 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
284 GLint count
= PB
->count
;
287 GLdepth
*pbz
= PB
->z
;
288 GLfixed
*pbfog
= PB
->fog
;
289 GLuint
*pbi
= PB
->index
;
293 if (ctx
->Line
.StippleFlag
) {
297 #define INTERP_INDEX 1
304 pbfog[count] = fog0; \
308 #include "s_linetemp.h"
312 if (ctx
->Line
.Width
==2.0F
) {
313 /* special case: unstippled and width=2 */
316 #define INTERP_INDEX 1
317 #define XMAJOR_PLOT(X,Y) \
318 pbx[count] = X; pbx[count+1] = X; \
319 pby[count] = Y; pby[count+1] = Y+1; \
320 pbz[count] = Z; pbz[count+1] = Z; \
321 pbfog[count] = fog0; pbfog[count+1] = fog0; \
322 pbi[count] = I; pbi[count+1] = I; \
325 #define YMAJOR_PLOT(X,Y) \
326 pbx[count] = X; pbx[count+1] = X+1; \
327 pby[count] = Y; pby[count+1] = Y; \
328 pbz[count] = Z; pbz[count+1] = Z; \
329 pbfog[count] = fog0; pbfog[count+1] = fog0; \
330 pbi[count] = I; pbi[count+1] = I; \
333 #include "s_linetemp.h"
336 /* unstippled, any width */
339 #define INTERP_INDEX 1
346 pbfog[count] = fog0; \
349 #include "s_linetemp.h"
358 /* Flat shaded, color index, any width, maybe stippled */
359 static void general_flat_ci_line( GLcontext
*ctx
,
363 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
367 GLdepth
*pbz
= PB
->z
;
368 GLfixed
*pbfog
= PB
->fog
;
369 PB_SET_INDEX( PB
, vert0
->index
);
372 if (ctx
->Line
.StippleFlag
) {
373 /* stippled, any width */
382 pbfog[count] = fog0; \
385 #include "s_linetemp.h"
389 if (ctx
->Line
.Width
==2.0F
) {
390 /* special case: unstippled and width=2 */
393 #define XMAJOR_PLOT(X,Y) \
394 pbx[count] = X; pbx[count+1] = X; \
395 pby[count] = Y; pby[count+1] = Y+1; \
396 pbz[count] = Z; pbz[count+1] = Z; \
397 pbfog[count] = fog0; pbfog[count+1] = fog0; \
400 #define YMAJOR_PLOT(X,Y) \
401 pbx[count] = X; pbx[count+1] = X+1; \
402 pby[count] = Y; pby[count+1] = Y; \
403 pbz[count] = Z; pbz[count+1] = Z; \
404 pbfog[count] = fog0; pbfog[count+1] = fog0; \
407 #include "s_linetemp.h"
410 /* unstippled, any width */
418 pbfog[count] = fog0; \
421 #include "s_linetemp.h"
431 static void general_smooth_rgba_line( GLcontext
*ctx
,
435 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
436 GLint count
= PB
->count
;
439 GLdepth
*pbz
= PB
->z
;
440 GLfixed
*pbfog
= PB
->fog
;
441 GLchan (*pbrgba
)[4] = PB
->rgba
;
445 if (ctx
->Line
.StippleFlag
) {
450 #define INTERP_ALPHA 1
457 pbfog[count] = fog0; \
458 pbrgba[count][RCOMP] = FixedToInt(r0); \
459 pbrgba[count][GCOMP] = FixedToInt(g0); \
460 pbrgba[count][BCOMP] = FixedToInt(b0); \
461 pbrgba[count][ACOMP] = FixedToInt(a0); \
464 #include "s_linetemp.h"
468 if (ctx
->Line
.Width
==2.0F
) {
469 /* special case: unstippled and width=2 */
473 #define INTERP_ALPHA 1
474 #define XMAJOR_PLOT(X,Y) \
475 pbx[count] = X; pbx[count+1] = X; \
476 pby[count] = Y; pby[count+1] = Y+1; \
477 pbz[count] = Z; pbz[count+1] = Z; \
478 pbfog[count] = fog0; pbfog[count+1] = fog0; \
479 pbrgba[count][RCOMP] = FixedToInt(r0); \
480 pbrgba[count][GCOMP] = FixedToInt(g0); \
481 pbrgba[count][BCOMP] = FixedToInt(b0); \
482 pbrgba[count][ACOMP] = FixedToInt(a0); \
483 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
484 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
485 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
486 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
489 #define YMAJOR_PLOT(X,Y) \
490 pbx[count] = X; pbx[count+1] = X+1; \
491 pby[count] = Y; pby[count+1] = Y; \
492 pbz[count] = Z; pbz[count+1] = Z; \
493 pbfog[count] = fog0; pbfog[count+1] = fog0; \
494 pbrgba[count][RCOMP] = FixedToInt(r0); \
495 pbrgba[count][GCOMP] = FixedToInt(g0); \
496 pbrgba[count][BCOMP] = FixedToInt(b0); \
497 pbrgba[count][ACOMP] = FixedToInt(a0); \
498 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
499 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
500 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
501 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
504 #include "s_linetemp.h"
507 /* unstippled, any width */
511 #define INTERP_ALPHA 1
517 pbfog[count] = fog0; \
518 pbrgba[count][RCOMP] = FixedToInt(r0); \
519 pbrgba[count][GCOMP] = FixedToInt(g0); \
520 pbrgba[count][BCOMP] = FixedToInt(b0); \
521 pbrgba[count][ACOMP] = FixedToInt(a0); \
524 #include "s_linetemp.h"
533 static void general_flat_rgba_line( GLcontext
*ctx
,
537 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
538 const GLchan
*color
= vert0
->color
;
539 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
541 if (ctx
->Line
.StippleFlag
) {
547 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
548 #include "s_linetemp.h"
552 if (ctx
->Line
.Width
==2.0F
) {
553 /* special case: unstippled and width=2 */
556 #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
557 PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0);
558 #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
559 PB_WRITE_PIXEL(PB, X+1, Y, Z, fog0);
560 #include "s_linetemp.h"
563 /* unstippled, any width */
567 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
568 #include "s_linetemp.h"
576 /* Flat-shaded, textured, any width, maybe stippled */
577 static void flat_textured_line( GLcontext
*ctx
,
581 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
585 GLdepth
*pbz
= PB
->z
;
586 GLfixed
*pbfog
= PB
->fog
;
587 GLfloat
*pbs
= PB
->s
[0];
588 GLfloat
*pbt
= PB
->t
[0];
589 GLfloat
*pbu
= PB
->u
[0];
590 GLchan
*color
= vert0
->color
;
591 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
594 if (ctx
->Line
.StippleFlag
) {
606 pbfog[count] = fog0; \
607 pbs[count] = fragTexcoord[0];\
608 pbt[count] = fragTexcoord[1];\
609 pbu[count] = fragTexcoord[2];\
613 #include "s_linetemp.h"
626 pbfog[count] = fog0; \
627 pbs[count] = fragTexcoord[0];\
628 pbt[count] = fragTexcoord[1];\
629 pbu[count] = fragTexcoord[2];\
633 #include "s_linetemp.h"
642 /* Smooth-shaded, textured, any width, maybe stippled */
643 static void smooth_textured_line( GLcontext
*ctx
,
647 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
648 GLint count
= PB
->count
;
651 GLdepth
*pbz
= PB
->z
;
652 GLfixed
*pbfog
= PB
->fog
;
653 GLfloat
*pbs
= PB
->s
[0];
654 GLfloat
*pbt
= PB
->t
[0];
655 GLfloat
*pbu
= PB
->u
[0];
656 GLchan (*pbrgba
)[4] = PB
->rgba
;
660 if (ctx
->Line
.StippleFlag
) {
665 #define INTERP_ALPHA 1
674 pbfog[count] = fog0; \
675 pbs[count] = fragTexcoord[0]; \
676 pbt[count] = fragTexcoord[1]; \
677 pbu[count] = fragTexcoord[2]; \
678 pbrgba[count][RCOMP] = FixedToInt(r0); \
679 pbrgba[count][GCOMP] = FixedToInt(g0); \
680 pbrgba[count][BCOMP] = FixedToInt(b0); \
681 pbrgba[count][ACOMP] = FixedToInt(a0); \
685 #include "s_linetemp.h"
692 #define INTERP_ALPHA 1
700 pbfog[count] = fog0; \
701 pbs[count] = fragTexcoord[0]; \
702 pbt[count] = fragTexcoord[1]; \
703 pbu[count] = fragTexcoord[2]; \
704 pbrgba[count][RCOMP] = FixedToInt(r0); \
705 pbrgba[count][GCOMP] = FixedToInt(g0); \
706 pbrgba[count][BCOMP] = FixedToInt(b0); \
707 pbrgba[count][ACOMP] = FixedToInt(a0); \
711 #include "s_linetemp.h"
719 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
720 * color interpolation.
722 static void smooth_multitextured_line( GLcontext
*ctx
,
726 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
727 GLint count
= PB
->count
;
730 GLdepth
*pbz
= PB
->z
;
731 GLfixed
*pbfog
= PB
->fog
;
732 GLchan (*pbrgba
)[4] = PB
->rgba
;
733 GLchan (*pbspec
)[3] = PB
->spec
;
737 if (ctx
->Line
.StippleFlag
) {
742 #define INTERP_SPEC 1
743 #define INTERP_ALPHA 1
744 #define INTERP_MULTITEX 1
753 pbfog[count] = fog0; \
754 pbrgba[count][RCOMP] = FixedToInt(r0); \
755 pbrgba[count][GCOMP] = FixedToInt(g0); \
756 pbrgba[count][BCOMP] = FixedToInt(b0); \
757 pbrgba[count][ACOMP] = FixedToInt(a0); \
758 pbspec[count][RCOMP] = FixedToInt(sr0); \
759 pbspec[count][GCOMP] = FixedToInt(sg0); \
760 pbspec[count][BCOMP] = FixedToInt(sb0); \
761 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
762 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
763 PB->s[u][0] = fragTexcoord[u][0]; \
764 PB->s[u][1] = fragTexcoord[u][1]; \
765 PB->s[u][2] = fragTexcoord[u][2]; \
766 PB->s[u][3] = fragTexcoord[u][3]; \
772 #include "s_linetemp.h"
779 #define INTERP_SPEC 1
780 #define INTERP_ALPHA 1
781 #define INTERP_MULTITEX 1
789 pbfog[count] = fog0; \
790 pbrgba[count][RCOMP] = FixedToInt(r0); \
791 pbrgba[count][GCOMP] = FixedToInt(g0); \
792 pbrgba[count][BCOMP] = FixedToInt(b0); \
793 pbrgba[count][ACOMP] = FixedToInt(a0); \
794 pbspec[count][RCOMP] = FixedToInt(sr0); \
795 pbspec[count][GCOMP] = FixedToInt(sg0); \
796 pbspec[count][BCOMP] = FixedToInt(sb0); \
797 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
798 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
799 PB->s[u][0] = fragTexcoord[u][0]; \
800 PB->s[u][1] = fragTexcoord[u][1]; \
801 PB->s[u][2] = fragTexcoord[u][2]; \
802 PB->s[u][3] = fragTexcoord[u][3]; \
808 #include "s_linetemp.h"
816 /* Flat-shaded, multitextured, any width, maybe stippled, separate specular
817 * color interpolation.
819 static void flat_multitextured_line( GLcontext
*ctx
,
823 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
824 GLint count
= PB
->count
;
827 GLdepth
*pbz
= PB
->z
;
828 GLfixed
*pbfog
= PB
->fog
;
829 GLchan (*pbrgba
)[4] = PB
->rgba
;
830 GLchan (*pbspec
)[3] = PB
->spec
;
831 GLchan
*color
= vert0
->color
;
832 GLchan sRed
= vert0
->specular
[0];
833 GLchan sGreen
= vert0
->specular
[1];
834 GLchan sBlue
= vert0
->specular
[2];
838 if (ctx
->Line
.StippleFlag
) {
842 #define INTERP_ALPHA 1
843 #define INTERP_MULTITEX 1
852 pbfog[count] = fog0; \
853 pbrgba[count][RCOMP] = color[0]; \
854 pbrgba[count][GCOMP] = color[1]; \
855 pbrgba[count][BCOMP] = color[2]; \
856 pbrgba[count][ACOMP] = color[3]; \
857 pbspec[count][RCOMP] = sRed; \
858 pbspec[count][GCOMP] = sGreen; \
859 pbspec[count][BCOMP] = sBlue; \
860 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
861 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
862 PB->s[u][0] = fragTexcoord[u][0]; \
863 PB->s[u][1] = fragTexcoord[u][1]; \
864 PB->s[u][2] = fragTexcoord[u][2]; \
865 PB->s[u][3] = fragTexcoord[u][3]; \
871 #include "s_linetemp.h"
877 #define INTERP_ALPHA 1
878 #define INTERP_MULTITEX 1
886 pbfog[count] = fog0; \
887 pbrgba[count][RCOMP] = color[0]; \
888 pbrgba[count][GCOMP] = color[1]; \
889 pbrgba[count][BCOMP] = color[2]; \
890 pbrgba[count][ACOMP] = color[3]; \
891 pbspec[count][RCOMP] = sRed; \
892 pbspec[count][GCOMP] = sGreen; \
893 pbspec[count][BCOMP] = sBlue; \
894 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
895 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
896 PB->s[u][0] = fragTexcoord[u][0]; \
897 PB->s[u][1] = fragTexcoord[u][1]; \
898 PB->s[u][2] = fragTexcoord[u][2]; \
899 PB->s[u][3] = fragTexcoord[u][3]; \
905 #include "s_linetemp.h"
916 _mesa_print_line_function(GLcontext
*ctx
); /* silence compiler warning */
918 _mesa_print_line_function(GLcontext
*ctx
)
920 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
922 printf("Line Func == ");
923 if (swrast
->Line
== flat_ci_line
)
924 printf("flat_ci_line\n");
925 else if (swrast
->Line
== flat_ci_z_line
)
926 printf("flat_ci_z_line\n");
927 else if (swrast
->Line
== flat_rgba_line
)
928 printf("flat_rgba_line\n");
929 else if (swrast
->Line
== flat_rgba_z_line
)
930 printf("flat_rgba_z_line\n");
931 else if (swrast
->Line
== smooth_ci_line
)
932 printf("smooth_ci_line\n");
933 else if (swrast
->Line
== smooth_ci_z_line
)
934 printf("smooth_ci_z_line\n");
935 else if (swrast
->Line
== smooth_rgba_line
)
936 printf("smooth_rgba_line\n");
937 else if (swrast
->Line
== smooth_rgba_z_line
)
938 printf("smooth_rgba_z_line\n");
939 else if (swrast
->Line
== general_smooth_ci_line
)
940 printf("general_smooth_ci_line\n");
941 else if (swrast
->Line
== general_flat_ci_line
)
942 printf("general_flat_ci_line\n");
943 else if (swrast
->Line
== general_smooth_rgba_line
)
944 printf("general_smooth_rgba_line\n");
945 else if (swrast
->Line
== general_flat_rgba_line
)
946 printf("general_flat_rgba_line\n");
947 else if (swrast
->Line
== flat_textured_line
)
948 printf("flat_textured_line\n");
949 else if (swrast
->Line
== smooth_textured_line
)
950 printf("smooth_textured_line\n");
951 else if (swrast
->Line
== smooth_multitextured_line
)
952 printf("smooth_multitextured_line\n");
953 else if (swrast
->Line
== flat_multitextured_line
)
954 printf("flat_multitextured_line\n");
956 printf("Driver func %p\n", swrast
->Line
);
963 * Determine which line drawing function to use given the current
966 * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
967 * tests to this code.
970 _swrast_choose_line( GLcontext
*ctx
)
972 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
973 const GLboolean rgbmode
= ctx
->Visual
.RGBAflag
;
975 if (ctx
->RenderMode
==GL_RENDER
) {
976 if (ctx
->Line
.SmoothFlag
) {
977 /* antialiased lines */
978 _swrast_choose_aa_line_function(ctx
);
979 ASSERT(swrast
->Triangle
);
981 else if (ctx
->Texture
._ReallyEnabled
) {
982 if (ctx
->Texture
._MultiTextureEnabled
983 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
984 || ctx
->Fog
.ColorSumEnabled
) {
985 /* multi-texture and/or separate specular color */
986 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
)
987 swrast
->Line
= smooth_multitextured_line
;
989 swrast
->Line
= flat_multitextured_line
;
992 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
993 swrast
->Line
= smooth_textured_line
;
996 swrast
->Line
= flat_textured_line
;
1000 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
) {
1001 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1003 swrast
->Line
= general_smooth_rgba_line
;
1005 swrast
->Line
= general_smooth_ci_line
;
1009 swrast
->Line
= general_flat_rgba_line
;
1011 swrast
->Line
= general_flat_ci_line
;
1015 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1016 /* Width==1, non-stippled, smooth-shaded */
1017 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1019 swrast
->Line
= smooth_rgba_z_line
;
1021 swrast
->Line
= smooth_ci_z_line
;
1025 swrast
->Line
= smooth_rgba_line
;
1027 swrast
->Line
= smooth_ci_line
;
1031 /* Width==1, non-stippled, flat-shaded */
1032 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1034 swrast
->Line
= flat_rgba_z_line
;
1036 swrast
->Line
= flat_ci_z_line
;
1040 swrast
->Line
= flat_rgba_line
;
1042 swrast
->Line
= flat_ci_line
;
1047 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1048 swrast
->Line
= gl_feedback_line
;
1051 /* GL_SELECT mode */
1052 swrast
->Line
= gl_select_line
;
1055 /*_mesa_print_line_function(ctx);*/