1 /* $Id: s_lines.c,v 1.6 2000/11/16 21:05:41 keithw 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.
33 #include "s_context.h"
36 #include "s_feedback.h"
40 /**********************************************************************/
41 /***** Rasterization *****/
42 /**********************************************************************/
46 * There are 4 pairs (RGBA, CI) of line drawing functions:
47 * 1. simple: width=1 and no special rasterization functions (fastest)
48 * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
49 * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
50 * 4. general: any other kind of line (slowest)
55 /* Flat, color index line */
56 static void flat_ci_line( GLcontext
*ctx
,
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
,
79 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
80 PB_SET_INDEX( PB
, vert0
->index
);
84 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
86 #include "s_linetemp.h"
93 /* Flat-shaded, RGBA line */
94 static void flat_rgba_line( GLcontext
*ctx
,
98 const GLchan
*color
= vert0
->color
;
99 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
100 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
103 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0);
105 #include "s_linetemp.h"
112 /* Flat-shaded, RGBA line with Z interpolation/testing */
113 static void flat_rgba_z_line( GLcontext
*ctx
,
117 const GLchan
*color
= vert0
->color
;
118 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
119 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
123 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
125 #include "s_linetemp.h"
132 /* Smooth shaded, color index line */
133 static void smooth_ci_line( GLcontext
*ctx
,
137 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
138 GLint count
= PB
->count
;
141 GLuint
*pbi
= PB
->index
;
146 #define INTERP_INDEX 1
154 #include "s_linetemp.h"
162 /* Smooth shaded, color index line with Z interpolation/testing */
163 static void smooth_ci_z_line( GLcontext
*ctx
,
167 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
168 GLint count
= PB
->count
;
171 GLdepth
*pbz
= PB
->z
;
172 GLuint
*pbi
= PB
->index
;
178 #define INTERP_INDEX 1
187 #include "s_linetemp.h"
195 /* Smooth-shaded, RGBA line */
196 static void smooth_rgba_line( GLcontext
*ctx
,
200 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
201 GLint count
= PB
->count
;
204 GLchan (*pbrgba
)[4] = PB
->rgba
;
210 #define INTERP_ALPHA 1
215 pbrgba[count][RCOMP] = FixedToInt(r0); \
216 pbrgba[count][GCOMP] = FixedToInt(g0); \
217 pbrgba[count][BCOMP] = FixedToInt(b0); \
218 pbrgba[count][ACOMP] = FixedToInt(a0); \
221 #include "s_linetemp.h"
229 /* Smooth-shaded, RGBA line with Z interpolation/testing */
230 static void smooth_rgba_z_line( GLcontext
*ctx
,
234 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
235 GLint count
= PB
->count
;
238 GLdepth
*pbz
= PB
->z
;
239 GLfixed
*pbfog
= PB
->fog
;
240 GLchan (*pbrgba
)[4] = PB
->rgba
;
248 #define INTERP_ALPHA 1
254 pbfog[count] = fog0; \
255 pbrgba[count][RCOMP] = FixedToInt(r0); \
256 pbrgba[count][GCOMP] = FixedToInt(g0); \
257 pbrgba[count][BCOMP] = FixedToInt(b0); \
258 pbrgba[count][ACOMP] = FixedToInt(a0); \
261 #include "s_linetemp.h"
268 #define CHECK_FULL(count) \
269 if (count >= PB_SIZE-MAX_WIDTH) { \
277 /* Smooth shaded, color index, any width, maybe stippled */
278 static void general_smooth_ci_line( GLcontext
*ctx
,
282 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
283 GLint count
= PB
->count
;
286 GLdepth
*pbz
= PB
->z
;
287 GLfixed
*pbfog
= PB
->fog
;
288 GLuint
*pbi
= PB
->index
;
292 if (ctx
->Line
.StippleFlag
) {
296 #define INTERP_INDEX 1
303 pbfog[count] = fog0; \
307 #include "s_linetemp.h"
311 if (ctx
->Line
.Width
==2.0F
) {
312 /* special case: unstippled and width=2 */
315 #define INTERP_INDEX 1
316 #define XMAJOR_PLOT(X,Y) \
317 pbx[count] = X; pbx[count+1] = X; \
318 pby[count] = Y; pby[count+1] = Y+1; \
319 pbz[count] = Z; pbz[count+1] = Z; \
320 pbfog[count] = fog0; pbfog[count+1] = fog0; \
321 pbi[count] = I; pbi[count+1] = I; \
324 #define YMAJOR_PLOT(X,Y) \
325 pbx[count] = X; pbx[count+1] = X+1; \
326 pby[count] = Y; pby[count+1] = Y; \
327 pbz[count] = Z; pbz[count+1] = Z; \
328 pbfog[count] = fog0; pbfog[count+1] = fog0; \
329 pbi[count] = I; pbi[count+1] = I; \
332 #include "s_linetemp.h"
335 /* unstippled, any width */
338 #define INTERP_INDEX 1
345 pbfog[count] = fog0; \
348 #include "s_linetemp.h"
357 /* Flat shaded, color index, any width, maybe stippled */
358 static void general_flat_ci_line( GLcontext
*ctx
,
362 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
366 GLdepth
*pbz
= PB
->z
;
367 GLfixed
*pbfog
= PB
->fog
;
368 PB_SET_INDEX( PB
, vert0
->index
);
371 if (ctx
->Line
.StippleFlag
) {
372 /* stippled, any width */
381 pbfog[count] = fog0; \
384 #include "s_linetemp.h"
388 if (ctx
->Line
.Width
==2.0F
) {
389 /* special case: unstippled and width=2 */
392 #define XMAJOR_PLOT(X,Y) \
393 pbx[count] = X; pbx[count+1] = X; \
394 pby[count] = Y; pby[count+1] = Y+1; \
395 pbz[count] = Z; pbz[count+1] = Z; \
396 pbfog[count] = fog0; pbfog[count+1] = fog0; \
399 #define YMAJOR_PLOT(X,Y) \
400 pbx[count] = X; pbx[count+1] = X+1; \
401 pby[count] = Y; pby[count+1] = Y; \
402 pbz[count] = Z; pbz[count+1] = Z; \
403 pbfog[count] = fog0; pbfog[count+1] = fog0; \
406 #include "s_linetemp.h"
409 /* unstippled, any width */
417 pbfog[count] = fog0; \
420 #include "s_linetemp.h"
430 static void general_smooth_rgba_line( GLcontext
*ctx
,
434 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
435 GLint count
= PB
->count
;
438 GLdepth
*pbz
= PB
->z
;
439 GLfixed
*pbfog
= PB
->fog
;
440 GLchan (*pbrgba
)[4] = PB
->rgba
;
444 if (ctx
->Line
.StippleFlag
) {
449 #define INTERP_ALPHA 1
456 pbfog[count] = fog0; \
457 pbrgba[count][RCOMP] = FixedToInt(r0); \
458 pbrgba[count][GCOMP] = FixedToInt(g0); \
459 pbrgba[count][BCOMP] = FixedToInt(b0); \
460 pbrgba[count][ACOMP] = FixedToInt(a0); \
463 #include "s_linetemp.h"
467 if (ctx
->Line
.Width
==2.0F
) {
468 /* special case: unstippled and width=2 */
472 #define INTERP_ALPHA 1
473 #define XMAJOR_PLOT(X,Y) \
474 pbx[count] = X; pbx[count+1] = X; \
475 pby[count] = Y; pby[count+1] = Y+1; \
476 pbz[count] = Z; pbz[count+1] = Z; \
477 pbfog[count] = fog0; pbfog[count+1] = fog0; \
478 pbrgba[count][RCOMP] = FixedToInt(r0); \
479 pbrgba[count][GCOMP] = FixedToInt(g0); \
480 pbrgba[count][BCOMP] = FixedToInt(b0); \
481 pbrgba[count][ACOMP] = FixedToInt(a0); \
482 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
483 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
484 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
485 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
488 #define YMAJOR_PLOT(X,Y) \
489 pbx[count] = X; pbx[count+1] = X+1; \
490 pby[count] = Y; pby[count+1] = Y; \
491 pbz[count] = Z; pbz[count+1] = Z; \
492 pbfog[count] = fog0; pbfog[count+1] = fog0; \
493 pbrgba[count][RCOMP] = FixedToInt(r0); \
494 pbrgba[count][GCOMP] = FixedToInt(g0); \
495 pbrgba[count][BCOMP] = FixedToInt(b0); \
496 pbrgba[count][ACOMP] = FixedToInt(a0); \
497 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
498 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
499 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
500 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
503 #include "s_linetemp.h"
506 /* unstippled, any width */
510 #define INTERP_ALPHA 1
516 pbfog[count] = fog0; \
517 pbrgba[count][RCOMP] = FixedToInt(r0); \
518 pbrgba[count][GCOMP] = FixedToInt(g0); \
519 pbrgba[count][BCOMP] = FixedToInt(b0); \
520 pbrgba[count][ACOMP] = FixedToInt(a0); \
523 #include "s_linetemp.h"
532 static void general_flat_rgba_line( GLcontext
*ctx
,
536 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
537 const GLchan
*color
= vert0
->color
;
538 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
540 if (ctx
->Line
.StippleFlag
) {
546 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
547 #include "s_linetemp.h"
551 if (ctx
->Line
.Width
==2.0F
) {
552 /* special case: unstippled and width=2 */
555 #define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
556 PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0);
557 #define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \
558 PB_WRITE_PIXEL(PB, X+1, Y, Z, fog0);
559 #include "s_linetemp.h"
562 /* unstippled, any width */
566 #define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0);
567 #include "s_linetemp.h"
575 /* Flat-shaded, textured, any width, maybe stippled */
576 static void flat_textured_line( GLcontext
*ctx
,
580 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
584 GLdepth
*pbz
= PB
->z
;
585 GLfixed
*pbfog
= PB
->fog
;
586 GLfloat
*pbs
= PB
->s
[0];
587 GLfloat
*pbt
= PB
->t
[0];
588 GLfloat
*pbu
= PB
->u
[0];
589 GLchan
*color
= vert0
->color
;
590 PB_SET_COLOR( PB
, color
[0], color
[1], color
[2], color
[3] );
593 if (ctx
->Line
.StippleFlag
) {
605 pbfog[count] = fog0; \
606 pbs[count] = fragTexcoord[0];\
607 pbt[count] = fragTexcoord[1];\
608 pbu[count] = fragTexcoord[2];\
612 #include "s_linetemp.h"
625 pbfog[count] = fog0; \
626 pbs[count] = fragTexcoord[0];\
627 pbt[count] = fragTexcoord[1];\
628 pbu[count] = fragTexcoord[2];\
632 #include "s_linetemp.h"
641 /* Smooth-shaded, textured, any width, maybe stippled */
642 static void smooth_textured_line( GLcontext
*ctx
,
646 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
647 GLint count
= PB
->count
;
650 GLdepth
*pbz
= PB
->z
;
651 GLfixed
*pbfog
= PB
->fog
;
652 GLfloat
*pbs
= PB
->s
[0];
653 GLfloat
*pbt
= PB
->t
[0];
654 GLfloat
*pbu
= PB
->u
[0];
655 GLchan (*pbrgba
)[4] = PB
->rgba
;
659 if (ctx
->Line
.StippleFlag
) {
664 #define INTERP_ALPHA 1
673 pbfog[count] = fog0; \
674 pbs[count] = fragTexcoord[0]; \
675 pbt[count] = fragTexcoord[1]; \
676 pbu[count] = fragTexcoord[2]; \
677 pbrgba[count][RCOMP] = FixedToInt(r0); \
678 pbrgba[count][GCOMP] = FixedToInt(g0); \
679 pbrgba[count][BCOMP] = FixedToInt(b0); \
680 pbrgba[count][ACOMP] = FixedToInt(a0); \
684 #include "s_linetemp.h"
691 #define INTERP_ALPHA 1
699 pbfog[count] = fog0; \
700 pbs[count] = fragTexcoord[0]; \
701 pbt[count] = fragTexcoord[1]; \
702 pbu[count] = fragTexcoord[2]; \
703 pbrgba[count][RCOMP] = FixedToInt(r0); \
704 pbrgba[count][GCOMP] = FixedToInt(g0); \
705 pbrgba[count][BCOMP] = FixedToInt(b0); \
706 pbrgba[count][ACOMP] = FixedToInt(a0); \
710 #include "s_linetemp.h"
718 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
719 * color interpolation.
721 static void smooth_multitextured_line( GLcontext
*ctx
,
725 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
726 GLint count
= PB
->count
;
729 GLdepth
*pbz
= PB
->z
;
730 GLfixed
*pbfog
= PB
->fog
;
731 GLchan (*pbrgba
)[4] = PB
->rgba
;
732 GLchan (*pbspec
)[3] = PB
->spec
;
736 if (ctx
->Line
.StippleFlag
) {
741 #define INTERP_SPEC 1
742 #define INTERP_ALPHA 1
743 #define INTERP_MULTITEX 1
752 pbfog[count] = fog0; \
753 pbrgba[count][RCOMP] = FixedToInt(r0); \
754 pbrgba[count][GCOMP] = FixedToInt(g0); \
755 pbrgba[count][BCOMP] = FixedToInt(b0); \
756 pbrgba[count][ACOMP] = FixedToInt(a0); \
757 pbspec[count][RCOMP] = FixedToInt(sr0); \
758 pbspec[count][GCOMP] = FixedToInt(sg0); \
759 pbspec[count][BCOMP] = FixedToInt(sb0); \
760 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
761 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
762 PB->s[u][0] = fragTexcoord[u][0]; \
763 PB->s[u][1] = fragTexcoord[u][1]; \
764 PB->s[u][2] = fragTexcoord[u][2]; \
765 PB->s[u][3] = fragTexcoord[u][3]; \
771 #include "s_linetemp.h"
778 #define INTERP_SPEC 1
779 #define INTERP_ALPHA 1
780 #define INTERP_MULTITEX 1
788 pbfog[count] = fog0; \
789 pbrgba[count][RCOMP] = FixedToInt(r0); \
790 pbrgba[count][GCOMP] = FixedToInt(g0); \
791 pbrgba[count][BCOMP] = FixedToInt(b0); \
792 pbrgba[count][ACOMP] = FixedToInt(a0); \
793 pbspec[count][RCOMP] = FixedToInt(sr0); \
794 pbspec[count][GCOMP] = FixedToInt(sg0); \
795 pbspec[count][BCOMP] = FixedToInt(sb0); \
796 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
797 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
798 PB->s[u][0] = fragTexcoord[u][0]; \
799 PB->s[u][1] = fragTexcoord[u][1]; \
800 PB->s[u][2] = fragTexcoord[u][2]; \
801 PB->s[u][3] = fragTexcoord[u][3]; \
807 #include "s_linetemp.h"
815 /* Flat-shaded, multitextured, any width, maybe stippled, separate specular
816 * color interpolation.
818 static void flat_multitextured_line( GLcontext
*ctx
,
822 struct pixel_buffer
*PB
= SWRAST_CONTEXT(ctx
)->PB
;
823 GLint count
= PB
->count
;
826 GLdepth
*pbz
= PB
->z
;
827 GLfixed
*pbfog
= PB
->fog
;
828 GLchan (*pbrgba
)[4] = PB
->rgba
;
829 GLchan (*pbspec
)[3] = PB
->spec
;
830 GLchan
*color
= vert0
->color
;
831 GLchan sRed
= vert0
->specular
[0];
832 GLchan sGreen
= vert0
->specular
[1];
833 GLchan sBlue
= vert0
->specular
[2];
837 if (ctx
->Line
.StippleFlag
) {
841 #define INTERP_ALPHA 1
842 #define INTERP_MULTITEX 1
851 pbfog[count] = fog0; \
852 pbrgba[count][RCOMP] = color[0]; \
853 pbrgba[count][GCOMP] = color[1]; \
854 pbrgba[count][BCOMP] = color[2]; \
855 pbrgba[count][ACOMP] = color[3]; \
856 pbspec[count][RCOMP] = sRed; \
857 pbspec[count][GCOMP] = sGreen; \
858 pbspec[count][BCOMP] = sBlue; \
859 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
860 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
861 PB->s[u][0] = fragTexcoord[u][0]; \
862 PB->s[u][1] = fragTexcoord[u][1]; \
863 PB->s[u][2] = fragTexcoord[u][2]; \
864 PB->s[u][3] = fragTexcoord[u][3]; \
870 #include "s_linetemp.h"
876 #define INTERP_ALPHA 1
877 #define INTERP_MULTITEX 1
885 pbfog[count] = fog0; \
886 pbrgba[count][RCOMP] = color[0]; \
887 pbrgba[count][GCOMP] = color[1]; \
888 pbrgba[count][BCOMP] = color[2]; \
889 pbrgba[count][ACOMP] = color[3]; \
890 pbspec[count][RCOMP] = sRed; \
891 pbspec[count][GCOMP] = sGreen; \
892 pbspec[count][BCOMP] = sBlue; \
893 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
894 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
895 PB->s[u][0] = fragTexcoord[u][0]; \
896 PB->s[u][1] = fragTexcoord[u][1]; \
897 PB->s[u][2] = fragTexcoord[u][2]; \
898 PB->s[u][3] = fragTexcoord[u][3]; \
904 #include "s_linetemp.h"
915 _mesa_print_line_function(GLcontext
*ctx
); /* silence compiler warning */
917 _mesa_print_line_function(GLcontext
*ctx
)
919 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
921 printf("Line Func == ");
922 if (swrast
->Line
== flat_ci_line
)
923 printf("flat_ci_line\n");
924 else if (swrast
->Line
== flat_ci_z_line
)
925 printf("flat_ci_z_line\n");
926 else if (swrast
->Line
== flat_rgba_line
)
927 printf("flat_rgba_line\n");
928 else if (swrast
->Line
== flat_rgba_z_line
)
929 printf("flat_rgba_z_line\n");
930 else if (swrast
->Line
== smooth_ci_line
)
931 printf("smooth_ci_line\n");
932 else if (swrast
->Line
== smooth_ci_z_line
)
933 printf("smooth_ci_z_line\n");
934 else if (swrast
->Line
== smooth_rgba_line
)
935 printf("smooth_rgba_line\n");
936 else if (swrast
->Line
== smooth_rgba_z_line
)
937 printf("smooth_rgba_z_line\n");
938 else if (swrast
->Line
== general_smooth_ci_line
)
939 printf("general_smooth_ci_line\n");
940 else if (swrast
->Line
== general_flat_ci_line
)
941 printf("general_flat_ci_line\n");
942 else if (swrast
->Line
== general_smooth_rgba_line
)
943 printf("general_smooth_rgba_line\n");
944 else if (swrast
->Line
== general_flat_rgba_line
)
945 printf("general_flat_rgba_line\n");
946 else if (swrast
->Line
== flat_textured_line
)
947 printf("flat_textured_line\n");
948 else if (swrast
->Line
== smooth_textured_line
)
949 printf("smooth_textured_line\n");
950 else if (swrast
->Line
== smooth_multitextured_line
)
951 printf("smooth_multitextured_line\n");
952 else if (swrast
->Line
== flat_multitextured_line
)
953 printf("flat_multitextured_line\n");
955 printf("Driver func %p\n", swrast
->Line
);
962 * Determine which line drawing function to use given the current
965 * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
966 * tests to this code.
969 _swrast_choose_line( GLcontext
*ctx
)
971 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
972 const GLboolean rgbmode
= ctx
->Visual
.RGBAflag
;
974 if (ctx
->RenderMode
==GL_RENDER
) {
975 if (ctx
->Line
.SmoothFlag
) {
976 /* antialiased lines */
977 _swrast_choose_aa_line_function(ctx
);
978 ASSERT(swrast
->Triangle
);
980 else if (ctx
->Texture
._ReallyEnabled
) {
981 if (swrast
->_MultiTextureEnabled
982 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
983 || ctx
->Fog
.ColorSumEnabled
) {
984 /* multi-texture and/or separate specular color */
985 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
)
986 swrast
->Line
= smooth_multitextured_line
;
988 swrast
->Line
= flat_multitextured_line
;
991 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
992 swrast
->Line
= smooth_textured_line
;
995 swrast
->Line
= flat_textured_line
;
999 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
) {
1000 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1002 swrast
->Line
= general_smooth_rgba_line
;
1004 swrast
->Line
= general_smooth_ci_line
;
1008 swrast
->Line
= general_flat_rgba_line
;
1010 swrast
->Line
= general_flat_ci_line
;
1014 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1015 /* Width==1, non-stippled, smooth-shaded */
1016 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1018 swrast
->Line
= smooth_rgba_z_line
;
1020 swrast
->Line
= smooth_ci_z_line
;
1024 swrast
->Line
= smooth_rgba_line
;
1026 swrast
->Line
= smooth_ci_line
;
1030 /* Width==1, non-stippled, flat-shaded */
1031 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
) {
1033 swrast
->Line
= flat_rgba_z_line
;
1035 swrast
->Line
= flat_ci_z_line
;
1039 swrast
->Line
= flat_rgba_line
;
1041 swrast
->Line
= flat_ci_line
;
1046 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1047 swrast
->Line
= gl_feedback_line
;
1050 /* GL_SELECT mode */
1051 swrast
->Line
= gl_select_line
;
1054 /*_mesa_print_line_function(ctx);*/