1 /* $Id: s_lines.c,v 1.29 2002/04/19 14:05:50 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 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"
35 #include "s_feedback.h"
41 * Init the mask[] array to implement a line stipple.
44 compute_stipple_mask( GLcontext
*ctx
, GLuint len
, GLubyte mask
[] )
46 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
49 for (i
= 0; i
< len
; i
++) {
50 GLuint bit
= (swrast
->StippleCounter
/ ctx
->Line
.StippleFactor
) & 0xf;
51 if ((1 << bit
) & ctx
->Line
.StipplePattern
) {
57 swrast
->StippleCounter
++;
63 * To draw a wide line we can simply redraw the span N times, side by side.
66 draw_wide_line( GLcontext
*ctx
, struct sw_span
*span
, GLboolean xMajor
)
70 ASSERT(span
->end
< MAX_WIDTH
);
72 width
= (GLint
) CLAMP( ctx
->Line
.Width
, MIN_LINE_WIDTH
, MAX_LINE_WIDTH
);
77 start
= width
/ 2 - 1;
82 for (w
= 0; w
< width
; w
++) {
84 for (i
= 0; i
< span
->end
; i
++)
85 span
->yArray
[i
] -= start
;
88 for (i
= 0; i
< span
->end
; i
++)
91 if ((span
->interpMask
| span
->arrayMask
) & SPAN_TEXTURE
)
92 _mesa_write_texture_span(ctx
, span
);
93 else if ((span
->interpMask
| span
->arrayMask
) & SPAN_RGBA
)
94 _mesa_write_rgba_span(ctx
, span
);
96 _mesa_write_index_span(ctx
, span
);
102 for (w
= 0; w
< width
; w
++) {
104 for (i
= 0; i
< span
->end
; i
++)
105 span
->xArray
[i
] -= start
;
108 for (i
= 0; i
< span
->end
; i
++)
111 if ((span
->interpMask
| span
->arrayMask
) & SPAN_TEXTURE
)
112 _mesa_write_texture_span(ctx
, span
);
113 else if ((span
->interpMask
| span
->arrayMask
) & SPAN_RGBA
)
114 _mesa_write_rgba_span(ctx
, span
);
116 _mesa_write_index_span(ctx
, span
);
123 /**********************************************************************/
124 /***** Rasterization *****/
125 /**********************************************************************/
128 /* Flat, color index line */
129 static void flat_ci_line( GLcontext
*ctx
,
130 const SWvertex
*vert0
,
131 const SWvertex
*vert1
)
133 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
135 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
136 ASSERT(!ctx
->Line
.StippleFlag
);
137 ASSERT(ctx
->Line
.Width
== 1.0F
);
139 INIT_SPAN(span
, GL_LINE
, 0, SPAN_INDEX
, SPAN_XY
);
140 span
->index
= IntToFixed(vert1
->index
);
146 span->xArray[span->end] = X; \
147 span->yArray[span->end] = Y; \
151 #include "s_linetemp.h"
153 _mesa_write_index_span(ctx
, span
);
157 /* Flat-shaded, RGBA line */
158 static void flat_rgba_line( GLcontext
*ctx
,
159 const SWvertex
*vert0
,
160 const SWvertex
*vert1
)
162 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
164 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
165 ASSERT(!ctx
->Line
.StippleFlag
);
166 ASSERT(ctx
->Line
.Width
== 1.0F
);
168 INIT_SPAN(span
, GL_LINE
, 0, SPAN_RGBA
, SPAN_XY
);
169 span
->red
= ChanToFixed(vert1
->color
[0]);
170 span
->green
= ChanToFixed(vert1
->color
[1]);
171 span
->blue
= ChanToFixed(vert1
->color
[2]);
172 span
->alpha
= ChanToFixed(vert1
->color
[3]);
181 span->xArray[span->end] = X; \
182 span->yArray[span->end] = Y; \
186 #include "s_linetemp.h"
188 _mesa_write_rgba_span(ctx
, span
);
192 /* Smooth shaded, color index line */
193 static void smooth_ci_line( GLcontext
*ctx
,
194 const SWvertex
*vert0
,
195 const SWvertex
*vert1
)
197 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
199 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
200 ASSERT(!ctx
->Line
.StippleFlag
);
201 ASSERT(ctx
->Line
.Width
== 1.0F
);
203 INIT_SPAN(span
, GL_LINE
, 0, 0, SPAN_XY
| SPAN_INDEX
);
206 #define INTERP_INDEX 1
209 span->xArray[span->end] = X; \
210 span->yArray[span->end] = Y; \
211 span->color.index[span->end] = I; \
215 #include "s_linetemp.h"
217 _mesa_write_index_span(ctx
, span
);
221 /* Smooth-shaded, RGBA line */
222 static void smooth_rgba_line( GLcontext
*ctx
,
223 const SWvertex
*vert0
,
224 const SWvertex
*vert1
)
226 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
228 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
229 ASSERT(!ctx
->Line
.StippleFlag
);
230 ASSERT(ctx
->Line
.Width
== 1.0F
);
232 INIT_SPAN(span
, GL_LINE
, 0, 0, SPAN_XY
| SPAN_RGBA
);
236 #define INTERP_ALPHA 1
239 span->xArray[span->end] = X; \
240 span->yArray[span->end] = Y; \
241 span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
242 span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
243 span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
244 span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
248 #include "s_linetemp.h"
250 _mesa_write_rgba_span(ctx
, span
);
254 /* Smooth shaded, color index, any width, maybe stippled */
255 static void general_smooth_ci_line( GLcontext
*ctx
,
256 const SWvertex
*vert0
,
257 const SWvertex
*vert1
)
259 GLboolean xMajor
= GL_FALSE
;
260 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
262 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
264 INIT_SPAN(span
, GL_LINE
, 0, 0,
265 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_INDEX
);
271 #define INTERP_INDEX 1
274 span->xArray[span->end] = X; \
275 span->yArray[span->end] = Y; \
276 span->zArray[span->end] = Z; \
277 span->fogArray[span->end] = fog0; \
278 span->color.index[span->end] = I; \
281 #include "s_linetemp.h"
283 if (ctx
->Line
.StippleFlag
) {
284 span
->arrayMask
|= SPAN_MASK
;
285 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
288 if (ctx
->Line
.Width
> 1.0) {
289 draw_wide_line(ctx
, span
, xMajor
);
292 _mesa_write_index_span(ctx
, span
);
297 /* Flat shaded, color index, any width, maybe stippled */
298 static void general_flat_ci_line( GLcontext
*ctx
,
299 const SWvertex
*vert0
,
300 const SWvertex
*vert1
)
302 GLboolean xMajor
= GL_FALSE
;
303 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
305 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
307 INIT_SPAN(span
, GL_LINE
, 0, SPAN_INDEX
,
308 SPAN_XY
| SPAN_Z
| SPAN_FOG
);
309 span
->index
= IntToFixed(vert1
->index
);
318 span->xArray[span->end] = X; \
319 span->yArray[span->end] = Y; \
320 span->zArray[span->end] = Z; \
321 span->fogArray[span->end] = fog0; \
324 #include "s_linetemp.h"
326 if (ctx
->Line
.StippleFlag
) {
327 span
->arrayMask
|= SPAN_MASK
;
328 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
331 if (ctx
->Line
.Width
> 1.0) {
332 draw_wide_line(ctx
, span
, xMajor
);
335 _mesa_write_index_span(ctx
, span
);
341 static void general_smooth_rgba_line( GLcontext
*ctx
,
342 const SWvertex
*vert0
,
343 const SWvertex
*vert1
)
345 GLboolean xMajor
= GL_FALSE
;
346 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
348 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
350 INIT_SPAN(span
, GL_LINE
, 0, 0,
351 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_RGBA
);
358 #define INTERP_ALPHA 1
361 span->xArray[span->end] = X; \
362 span->yArray[span->end] = Y; \
363 span->zArray[span->end] = Z; \
364 span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
365 span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
366 span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
367 span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
368 span->fogArray[span->end] = fog0; \
371 #include "s_linetemp.h"
373 if (ctx
->Line
.StippleFlag
) {
374 span
->arrayMask
|= SPAN_MASK
;
375 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
378 if (ctx
->Line
.Width
> 1.0) {
379 draw_wide_line(ctx
, span
, xMajor
);
382 _mesa_write_rgba_span(ctx
, span
);
387 static void general_flat_rgba_line( GLcontext
*ctx
,
388 const SWvertex
*vert0
,
389 const SWvertex
*vert1
)
391 GLboolean xMajor
= GL_FALSE
;
392 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
394 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
396 INIT_SPAN(span
, GL_LINE
, 0, SPAN_RGBA
,
397 SPAN_XY
| SPAN_Z
| SPAN_FOG
);
398 span
->red
= ChanToFixed(vert1
->color
[0]);
399 span
->green
= ChanToFixed(vert1
->color
[1]);
400 span
->blue
= ChanToFixed(vert1
->color
[2]);
401 span
->alpha
= ChanToFixed(vert1
->color
[3]);
413 span->xArray[span->end] = X; \
414 span->yArray[span->end] = Y; \
415 span->zArray[span->end] = Z; \
416 span->fogArray[span->end] = fog0; \
419 #include "s_linetemp.h"
421 if (ctx
->Line
.StippleFlag
) {
422 span
->arrayMask
|= SPAN_MASK
;
423 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
426 if (ctx
->Line
.Width
> 1.0) {
427 draw_wide_line(ctx
, span
, xMajor
);
430 _mesa_write_rgba_span(ctx
, span
);
435 /* Flat-shaded, textured, any width, maybe stippled */
436 static void flat_textured_line( GLcontext
*ctx
,
437 const SWvertex
*vert0
,
438 const SWvertex
*vert1
)
440 GLboolean xMajor
= GL_FALSE
;
441 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
443 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
445 INIT_SPAN(span
, GL_LINE
, 0, SPAN_RGBA
| SPAN_SPEC
,
446 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_TEXTURE
| SPAN_LAMBDA
);
447 span
->red
= ChanToFixed(vert1
->color
[0]);
448 span
->green
= ChanToFixed(vert1
->color
[1]);
449 span
->blue
= ChanToFixed(vert1
->color
[2]);
450 span
->alpha
= ChanToFixed(vert1
->color
[3]);
455 span
->specRed
= ChanToFixed(vert1
->specular
[0]);
456 span
->specGreen
= ChanToFixed(vert1
->specular
[1]);
457 span
->specBlue
= ChanToFixed(vert1
->specular
[2]);
458 span
->specRedStep
= 0;
459 span
->specGreenStep
= 0;
460 span
->specBlueStep
= 0;
469 span->xArray[span->end] = X; \
470 span->yArray[span->end] = Y; \
471 span->zArray[span->end] = Z; \
472 span->fogArray[span->end] = fog0; \
473 span->texcoords[0][span->end][0] = fragTexcoord[0]; \
474 span->texcoords[0][span->end][1] = fragTexcoord[1]; \
475 span->texcoords[0][span->end][2] = fragTexcoord[2]; \
476 span->lambda[0][span->end] = 0.0; \
479 #include "s_linetemp.h"
481 if (ctx
->Line
.StippleFlag
) {
482 span
->arrayMask
|= SPAN_MASK
;
483 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
486 if (ctx
->Line
.Width
> 1.0) {
487 draw_wide_line(ctx
, span
, xMajor
);
490 _mesa_write_texture_span(ctx
, span
);
496 /* Smooth-shaded, textured, any width, maybe stippled */
497 static void smooth_textured_line( GLcontext
*ctx
,
498 const SWvertex
*vert0
,
499 const SWvertex
*vert1
)
501 GLboolean xMajor
= GL_FALSE
;
502 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
504 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
506 INIT_SPAN(span
, GL_LINE
, 0, 0,
507 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_RGBA
| SPAN_TEXTURE
| SPAN_LAMBDA
);
514 #define INTERP_ALPHA 1
518 span->xArray[span->end] = X; \
519 span->yArray[span->end] = Y; \
520 span->zArray[span->end] = Z; \
521 span->fogArray[span->end] = fog0; \
522 span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
523 span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
524 span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
525 span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
526 span->texcoords[0][span->end][0] = fragTexcoord[0]; \
527 span->texcoords[0][span->end][1] = fragTexcoord[1]; \
528 span->texcoords[0][span->end][2] = fragTexcoord[2]; \
529 span->lambda[0][span->end] = 0.0; \
532 #include "s_linetemp.h"
534 if (ctx
->Line
.StippleFlag
) {
535 span
->arrayMask
|= SPAN_MASK
;
536 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
539 if (ctx
->Line
.Width
> 1.0) {
540 draw_wide_line(ctx
, span
, xMajor
);
543 _mesa_write_texture_span(ctx
, span
);
548 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
549 * color interpolation.
551 static void smooth_multitextured_line( GLcontext
*ctx
,
552 const SWvertex
*vert0
,
553 const SWvertex
*vert1
)
555 GLboolean xMajor
= GL_FALSE
;
556 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
559 ASSERT(ctx
->Light
.ShadeModel
== GL_SMOOTH
);
561 INIT_SPAN(span
, GL_LINE
, 0, 0,
562 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_RGBA
| SPAN_SPEC
| SPAN_TEXTURE
| SPAN_LAMBDA
);
569 #define INTERP_SPEC 1
570 #define INTERP_ALPHA 1
571 #define INTERP_MULTITEX 1
574 span->xArray[span->end] = X; \
575 span->yArray[span->end] = Y; \
576 span->zArray[span->end] = Z; \
577 span->fogArray[span->end] = fog0; \
578 span->color.rgba[span->end][RCOMP] = FixedToInt(r0); \
579 span->color.rgba[span->end][GCOMP] = FixedToInt(g0); \
580 span->color.rgba[span->end][BCOMP] = FixedToInt(b0); \
581 span->color.rgba[span->end][ACOMP] = FixedToInt(a0); \
582 span->specArray[span->end][RCOMP] = FixedToInt(sr0); \
583 span->specArray[span->end][GCOMP] = FixedToInt(sb0); \
584 span->specArray[span->end][BCOMP] = FixedToInt(sb0); \
585 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
586 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
587 span->texcoords[u][span->end][0] = fragTexcoord[u][0]; \
588 span->texcoords[u][span->end][1] = fragTexcoord[u][1]; \
589 span->texcoords[u][span->end][2] = fragTexcoord[u][2]; \
590 span->lambda[u][span->end] = 0.0; \
595 #include "s_linetemp.h"
597 if (ctx
->Line
.StippleFlag
) {
598 span
->arrayMask
|= SPAN_MASK
;
599 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
602 if (ctx
->Line
.Width
> 1.0) {
603 draw_wide_line(ctx
, span
, xMajor
);
606 _mesa_write_texture_span(ctx
, span
);
611 /* Flat-shaded, multitextured, any width, maybe stippled, separate specular
612 * color interpolation.
614 static void flat_multitextured_line( GLcontext
*ctx
,
615 const SWvertex
*vert0
,
616 const SWvertex
*vert1
)
618 GLboolean xMajor
= GL_FALSE
;
619 struct sw_span
*span
= SWRAST_CONTEXT(ctx
)->span
;
622 ASSERT(ctx
->Light
.ShadeModel
== GL_FLAT
);
624 INIT_SPAN(span
, GL_LINE
, 0, SPAN_RGBA
| SPAN_SPEC
,
625 SPAN_XY
| SPAN_Z
| SPAN_FOG
| SPAN_TEXTURE
| SPAN_LAMBDA
);
626 span
->red
= ChanToFixed(vert1
->color
[0]);
627 span
->green
= ChanToFixed(vert1
->color
[1]);
628 span
->blue
= ChanToFixed(vert1
->color
[2]);
629 span
->alpha
= ChanToFixed(vert1
->color
[3]);
634 span
->specRed
= ChanToFixed(vert1
->specular
[0]);
635 span
->specGreen
= ChanToFixed(vert1
->specular
[1]);
636 span
->specBlue
= ChanToFixed(vert1
->specular
[2]);
637 span
->specRedStep
= 0;
638 span
->specGreenStep
= 0;
639 span
->specBlueStep
= 0;
645 #define INTERP_MULTITEX 1
648 span->xArray[span->end] = X; \
649 span->yArray[span->end] = Y; \
650 span->zArray[span->end] = Z; \
651 span->fogArray[span->end] = fog0; \
652 for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
653 if (ctx->Texture.Unit[u]._ReallyEnabled) { \
654 span->texcoords[u][span->end][0] = fragTexcoord[u][0]; \
655 span->texcoords[u][span->end][1] = fragTexcoord[u][1]; \
656 span->texcoords[u][span->end][2] = fragTexcoord[u][2]; \
657 span->lambda[u][span->end] = 0.0; \
662 #include "s_linetemp.h"
664 if (ctx
->Line
.StippleFlag
) {
665 span
->arrayMask
|= SPAN_MASK
;
666 compute_stipple_mask(ctx
, span
->end
, span
->mask
);
669 if (ctx
->Line
.Width
> 1.0) {
670 draw_wide_line(ctx
, span
, xMajor
);
673 _mesa_write_texture_span(ctx
, span
);
678 void _swrast_add_spec_terms_line( GLcontext
*ctx
,
682 SWvertex
*ncv0
= (SWvertex
*)v0
;
683 SWvertex
*ncv1
= (SWvertex
*)v1
;
685 COPY_CHAN4( c
[0], ncv0
->color
);
686 COPY_CHAN4( c
[1], ncv1
->color
);
687 ACC_3V( ncv0
->color
, ncv0
->specular
);
688 ACC_3V( ncv1
->color
, ncv1
->specular
);
689 SWRAST_CONTEXT(ctx
)->SpecLine( ctx
, ncv0
, ncv1
);
690 COPY_CHAN4( ncv0
->color
, c
[0] );
691 COPY_CHAN4( ncv1
->color
, c
[1] );
697 _mesa_print_line_function(GLcontext
*ctx
); /* silence compiler warning */
699 _mesa_print_line_function(GLcontext
*ctx
)
701 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
703 printf("Line Func == ");
704 if (swrast
->Line
== flat_ci_line
)
705 printf("flat_ci_line\n");
706 else if (swrast
->Line
== flat_rgba_line
)
707 printf("flat_rgba_line\n");
708 else if (swrast
->Line
== smooth_ci_line
)
709 printf("smooth_ci_line\n");
710 else if (swrast
->Line
== smooth_rgba_line
)
711 printf("smooth_rgba_line\n");
712 else if (swrast
->Line
== general_smooth_ci_line
)
713 printf("general_smooth_ci_line\n");
714 else if (swrast
->Line
== general_flat_ci_line
)
715 printf("general_flat_ci_line\n");
716 else if (swrast
->Line
== general_smooth_rgba_line
)
717 printf("general_smooth_rgba_line\n");
718 else if (swrast
->Line
== general_flat_rgba_line
)
719 printf("general_flat_rgba_line\n");
720 else if (swrast
->Line
== flat_textured_line
)
721 printf("flat_textured_line\n");
722 else if (swrast
->Line
== smooth_textured_line
)
723 printf("smooth_textured_line\n");
724 else if (swrast
->Line
== smooth_multitextured_line
)
725 printf("smooth_multitextured_line\n");
726 else if (swrast
->Line
== flat_multitextured_line
)
727 printf("flat_multitextured_line\n");
729 printf("Driver func %p\n", (void *) swrast
->Line
);
737 /* record the current line function name */
738 static const char *lineFuncName
= NULL
;
740 #define USE(lineFunc) \
742 lineFuncName = #lineFunc; \
743 /*printf("%s\n", lineFuncName);*/ \
744 swrast->Line = lineFunc; \
749 #define USE(lineFunc) swrast->Line = lineFunc
756 * Determine which line drawing function to use given the current
759 * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
760 * tests to this code.
763 _swrast_choose_line( GLcontext
*ctx
)
765 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
766 const GLboolean rgbmode
= ctx
->Visual
.rgbMode
;
768 if (ctx
->RenderMode
== GL_RENDER
) {
769 if (ctx
->Line
.SmoothFlag
) {
770 /* antialiased lines */
771 _swrast_choose_aa_line_function(ctx
);
772 ASSERT(swrast
->Triangle
);
774 else if (ctx
->Texture
._ReallyEnabled
) {
775 if (ctx
->Texture
._ReallyEnabled
> TEXTURE0_ANY
||
776 (ctx
->_TriangleCaps
& DD_SEPARATE_SPECULAR
)) {
777 /* multi-texture and/or separate specular color */
778 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
)
779 USE(smooth_multitextured_line
);
781 USE(flat_multitextured_line
);
784 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
785 USE(smooth_textured_line
);
788 USE(flat_textured_line
);
793 if (ctx
->Light
.ShadeModel
== GL_SMOOTH
) {
794 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
|| ctx
->Line
.Width
!= 1.0
795 || ctx
->Line
.StippleFlag
) {
797 USE(general_smooth_rgba_line
);
799 USE(general_smooth_ci_line
);
803 USE(smooth_rgba_line
);
809 if (ctx
->Depth
.Test
|| ctx
->Fog
.Enabled
|| ctx
->Line
.Width
!= 1.0
810 || ctx
->Line
.StippleFlag
) {
812 USE(general_flat_rgba_line
);
814 USE(general_flat_ci_line
);
825 else if (ctx
->RenderMode
== GL_FEEDBACK
) {
826 USE(_mesa_feedback_line
);
829 ASSERT(ctx
->RenderMode
== GL_SELECT
);
830 USE(_mesa_select_line
);
833 /*_mesa_print_line_function(ctx);*/