xref: /reactos/dll/opengl/mesa/lines.c (revision 5f2bebf7)
1*5f2bebf7SJérôme Gardou /* $Id: lines.c,v 1.19 1998/02/03 23:46:00 brianp Exp $ */
2*5f2bebf7SJérôme Gardou 
3*5f2bebf7SJérôme Gardou /*
4*5f2bebf7SJérôme Gardou  * Mesa 3-D graphics library
5*5f2bebf7SJérôme Gardou  * Version:  2.4
6*5f2bebf7SJérôme Gardou  * Copyright (C) 1995-1997  Brian Paul
7*5f2bebf7SJérôme Gardou  *
8*5f2bebf7SJérôme Gardou  * This library is free software; you can redistribute it and/or
9*5f2bebf7SJérôme Gardou  * modify it under the terms of the GNU Library General Public
10*5f2bebf7SJérôme Gardou  * License as published by the Free Software Foundation; either
11*5f2bebf7SJérôme Gardou  * version 2 of the License, or (at your option) any later version.
12*5f2bebf7SJérôme Gardou  *
13*5f2bebf7SJérôme Gardou  * This library is distributed in the hope that it will be useful,
14*5f2bebf7SJérôme Gardou  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15*5f2bebf7SJérôme Gardou  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16*5f2bebf7SJérôme Gardou  * Library General Public License for more details.
17*5f2bebf7SJérôme Gardou  *
18*5f2bebf7SJérôme Gardou  * You should have received a copy of the GNU Library General Public
19*5f2bebf7SJérôme Gardou  * License along with this library; if not, write to the Free
20*5f2bebf7SJérôme Gardou  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*5f2bebf7SJérôme Gardou  */
22*5f2bebf7SJérôme Gardou 
23*5f2bebf7SJérôme Gardou 
24*5f2bebf7SJérôme Gardou /*
25*5f2bebf7SJérôme Gardou  * $Log: lines.c,v $
26*5f2bebf7SJérôme Gardou  * Revision 1.19  1998/02/03 23:46:00  brianp
27*5f2bebf7SJérôme Gardou  * fixed a few problems with condition expressions for Amiga StormC compiler
28*5f2bebf7SJérôme Gardou  *
29*5f2bebf7SJérôme Gardou  * Revision 1.18  1997/07/24 01:24:11  brianp
30*5f2bebf7SJérôme Gardou  * changed precompiled header symbol from PCH to PC_HEADER
31*5f2bebf7SJérôme Gardou  *
32*5f2bebf7SJérôme Gardou  * Revision 1.17  1997/07/05 16:03:51  brianp
33*5f2bebf7SJérôme Gardou  * fixed PB overflow problem
34*5f2bebf7SJérôme Gardou  *
35*5f2bebf7SJérôme Gardou  * Revision 1.16  1997/06/20 02:01:49  brianp
36*5f2bebf7SJérôme Gardou  * changed color components from GLfixed to GLubyte
37*5f2bebf7SJérôme Gardou  *
38*5f2bebf7SJérôme Gardou  * Revision 1.15  1997/06/03 01:38:22  brianp
39*5f2bebf7SJérôme Gardou  * fixed divide by zero problem in feedback function (William Mitchell)
40*5f2bebf7SJérôme Gardou  *
41*5f2bebf7SJérôme Gardou  * Revision 1.14  1997/05/28 03:25:26  brianp
42*5f2bebf7SJérôme Gardou  * added precompiled header (PCH) support
43*5f2bebf7SJérôme Gardou  *
44*5f2bebf7SJérôme Gardou  * Revision 1.13  1997/05/03 00:51:02  brianp
45*5f2bebf7SJérôme Gardou  * removed calls to gl_texturing_enabled()
46*5f2bebf7SJérôme Gardou  *
47*5f2bebf7SJérôme Gardou  * Revision 1.12  1997/04/14 02:00:39  brianp
48*5f2bebf7SJérôme Gardou  * #include "texstate.h" instead of "texture.h"
49*5f2bebf7SJérôme Gardou  *
50*5f2bebf7SJérôme Gardou  * Revision 1.11  1997/04/12 12:25:01  brianp
51*5f2bebf7SJérôme Gardou  * replaced ctx->LineFunc with ctx->Driver.LineFunc, fixed PB->count bug
52*5f2bebf7SJérôme Gardou  *
53*5f2bebf7SJérôme Gardou  * Revision 1.10  1997/03/16 02:07:31  brianp
54*5f2bebf7SJérôme Gardou  * now use linetemp.h in line drawing functions
55*5f2bebf7SJérôme Gardou  *
56*5f2bebf7SJérôme Gardou  * Revision 1.9  1997/03/08 02:04:27  brianp
57*5f2bebf7SJérôme Gardou  * better implementation of feedback function
58*5f2bebf7SJérôme Gardou  *
59*5f2bebf7SJérôme Gardou  * Revision 1.8  1997/02/09 18:44:20  brianp
60*5f2bebf7SJérôme Gardou  * added GL_EXT_texture3D support
61*5f2bebf7SJérôme Gardou  *
62*5f2bebf7SJérôme Gardou  * Revision 1.7  1997/01/09 19:48:00  brianp
63*5f2bebf7SJérôme Gardou  * now call gl_texturing_enabled()
64*5f2bebf7SJérôme Gardou  *
65*5f2bebf7SJérôme Gardou  * Revision 1.6  1996/11/08 02:21:21  brianp
66*5f2bebf7SJérôme Gardou  * added null drawing function for GL_NO_RASTER
67*5f2bebf7SJérôme Gardou  *
68*5f2bebf7SJérôme Gardou  * Revision 1.5  1996/09/27 01:28:56  brianp
69*5f2bebf7SJérôme Gardou  * removed unused variables
70*5f2bebf7SJérôme Gardou  *
71*5f2bebf7SJérôme Gardou  * Revision 1.4  1996/09/25 02:01:54  brianp
72*5f2bebf7SJérôme Gardou  * new texture coord interpolation
73*5f2bebf7SJérôme Gardou  *
74*5f2bebf7SJérôme Gardou  * Revision 1.3  1996/09/15 14:18:10  brianp
75*5f2bebf7SJérôme Gardou  * now use GLframebuffer and GLvisual
76*5f2bebf7SJérôme Gardou  *
77*5f2bebf7SJérôme Gardou  * Revision 1.2  1996/09/15 01:48:58  brianp
78*5f2bebf7SJérôme Gardou  * removed #define NULL 0
79*5f2bebf7SJérôme Gardou  *
80*5f2bebf7SJérôme Gardou  * Revision 1.1  1996/09/13 01:38:16  brianp
81*5f2bebf7SJérôme Gardou  * Initial revision
82*5f2bebf7SJérôme Gardou  *
83*5f2bebf7SJérôme Gardou  */
84*5f2bebf7SJérôme Gardou 
85*5f2bebf7SJérôme Gardou 
86*5f2bebf7SJérôme Gardou #ifdef PC_HEADER
87*5f2bebf7SJérôme Gardou #include "all.h"
88*5f2bebf7SJérôme Gardou #else
89*5f2bebf7SJérôme Gardou #include "context.h"
90*5f2bebf7SJérôme Gardou #include "depth.h"
91*5f2bebf7SJérôme Gardou #include "feedback.h"
92*5f2bebf7SJérôme Gardou #include "lines.h"
93*5f2bebf7SJérôme Gardou #include "dlist.h"
94*5f2bebf7SJérôme Gardou #include "macros.h"
95*5f2bebf7SJérôme Gardou #include "pb.h"
96*5f2bebf7SJérôme Gardou #include "texstate.h"
97*5f2bebf7SJérôme Gardou #include "types.h"
98*5f2bebf7SJérôme Gardou #include "vb.h"
99*5f2bebf7SJérôme Gardou #include <wine/debug.h>
100*5f2bebf7SJérôme Gardou #endif
101*5f2bebf7SJérôme Gardou 
102*5f2bebf7SJérôme Gardou WINE_DEFAULT_DEBUG_CHANNEL(opengl32);
103*5f2bebf7SJérôme Gardou 
gl_LineWidth(GLcontext * ctx,GLfloat width)104*5f2bebf7SJérôme Gardou void gl_LineWidth( GLcontext *ctx, GLfloat width )
105*5f2bebf7SJérôme Gardou {
106*5f2bebf7SJérôme Gardou    if (width<=0.0) {
107*5f2bebf7SJérôme Gardou       gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" );
108*5f2bebf7SJérôme Gardou       return;
109*5f2bebf7SJérôme Gardou    }
110*5f2bebf7SJérôme Gardou    if (INSIDE_BEGIN_END(ctx)) {
111*5f2bebf7SJérôme Gardou       gl_error( ctx, GL_INVALID_OPERATION, "glLineWidth" );
112*5f2bebf7SJérôme Gardou       return;
113*5f2bebf7SJérôme Gardou    }
114*5f2bebf7SJérôme Gardou    ctx->Line.Width = width;
115*5f2bebf7SJérôme Gardou    ctx->NewState |= NEW_RASTER_OPS;
116*5f2bebf7SJérôme Gardou }
117*5f2bebf7SJérôme Gardou 
118*5f2bebf7SJérôme Gardou 
119*5f2bebf7SJérôme Gardou 
gl_LineStipple(GLcontext * ctx,GLint factor,GLushort pattern)120*5f2bebf7SJérôme Gardou void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
121*5f2bebf7SJérôme Gardou {
122*5f2bebf7SJérôme Gardou    if (INSIDE_BEGIN_END(ctx)) {
123*5f2bebf7SJérôme Gardou       gl_error( ctx, GL_INVALID_OPERATION, "glLineStipple" );
124*5f2bebf7SJérôme Gardou       return;
125*5f2bebf7SJérôme Gardou    }
126*5f2bebf7SJérôme Gardou    ctx->Line.StippleFactor = CLAMP( factor, 1, 256 );
127*5f2bebf7SJérôme Gardou    ctx->Line.StipplePattern = pattern;
128*5f2bebf7SJérôme Gardou    ctx->NewState |= NEW_RASTER_OPS;
129*5f2bebf7SJérôme Gardou }
130*5f2bebf7SJérôme Gardou 
131*5f2bebf7SJérôme Gardou 
132*5f2bebf7SJérôme Gardou 
133*5f2bebf7SJérôme Gardou /**********************************************************************/
134*5f2bebf7SJérôme Gardou /*****                    Rasterization                           *****/
135*5f2bebf7SJérôme Gardou /**********************************************************************/
136*5f2bebf7SJérôme Gardou 
137*5f2bebf7SJérôme Gardou 
138*5f2bebf7SJérôme Gardou /*
139*5f2bebf7SJérôme Gardou  * There are 4 pairs (RGBA, CI) of line drawing functions:
140*5f2bebf7SJérôme Gardou  *   1. simple:  width=1 and no special rasterization functions (fastest)
141*5f2bebf7SJérôme Gardou  *   2. flat:  width=1, non-stippled, flat-shaded, any raster operations
142*5f2bebf7SJérôme Gardou  *   3. smooth:  width=1, non-stippled, smooth-shaded, any raster operations
143*5f2bebf7SJérôme Gardou  *   4. general:  any other kind of line (slowest)
144*5f2bebf7SJérôme Gardou  */
145*5f2bebf7SJérôme Gardou 
146*5f2bebf7SJérôme Gardou 
147*5f2bebf7SJérôme Gardou /*
148*5f2bebf7SJérôme Gardou  * All line drawing functions have the same arguments:
149*5f2bebf7SJérôme Gardou  * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
150*5f2bebf7SJérôme Gardou  * pv     - provoking vertex: which vertex color/index to use for flat shading.
151*5f2bebf7SJérôme Gardou  */
152*5f2bebf7SJérôme Gardou 
153*5f2bebf7SJérôme Gardou 
154*5f2bebf7SJérôme Gardou 
feedback_line(GLcontext * ctx,GLuint v1,GLuint v2,GLuint pv)155*5f2bebf7SJérôme Gardou static void feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
156*5f2bebf7SJérôme Gardou {
157*5f2bebf7SJérôme Gardou    struct vertex_buffer *VB = ctx->VB;
158*5f2bebf7SJérôme Gardou    GLfloat x1, y1, z1, w1;
159*5f2bebf7SJérôme Gardou    GLfloat x2, y2, z2, w2;
160*5f2bebf7SJérôme Gardou    GLfloat tex1[4], tex2[4], invq;
161*5f2bebf7SJérôme Gardou    GLfloat invRedScale   = ctx->Visual->InvRedScale;
162*5f2bebf7SJérôme Gardou    GLfloat invGreenScale = ctx->Visual->InvGreenScale;
163*5f2bebf7SJérôme Gardou    GLfloat invBlueScale  = ctx->Visual->InvBlueScale;
164*5f2bebf7SJérôme Gardou    GLfloat invAlphaScale = ctx->Visual->InvAlphaScale;
165*5f2bebf7SJérôme Gardou 
166*5f2bebf7SJérôme Gardou    x1 = VB->Win[v1][0];
167*5f2bebf7SJérôme Gardou    y1 = VB->Win[v1][1];
168*5f2bebf7SJérôme Gardou    z1 = VB->Win[v1][2] / DEPTH_SCALE;
169*5f2bebf7SJérôme Gardou    w1 = VB->Clip[v1][3];
170*5f2bebf7SJérôme Gardou 
171*5f2bebf7SJérôme Gardou    x2 = VB->Win[v2][0];
172*5f2bebf7SJérôme Gardou    y2 = VB->Win[v2][1];
173*5f2bebf7SJérôme Gardou    z2 = VB->Win[v2][2] / DEPTH_SCALE;
174*5f2bebf7SJérôme Gardou    w2 = VB->Clip[v2][3];
175*5f2bebf7SJérôme Gardou 
176*5f2bebf7SJérôme Gardou    invq = (VB->TexCoord[v1][3]==0.0) ? 1.0 : (1.0F / VB->TexCoord[v1][3]);
177*5f2bebf7SJérôme Gardou    tex1[0] = VB->TexCoord[v1][0] * invq;
178*5f2bebf7SJérôme Gardou    tex1[1] = VB->TexCoord[v1][1] * invq;
179*5f2bebf7SJérôme Gardou    tex1[2] = VB->TexCoord[v1][2] * invq;
180*5f2bebf7SJérôme Gardou    tex1[3] = VB->TexCoord[v1][3];
181*5f2bebf7SJérôme Gardou    invq = (VB->TexCoord[v2][3]==0.0) ? 1.0 : (1.0F / VB->TexCoord[v2][3]);
182*5f2bebf7SJérôme Gardou    tex2[0] = VB->TexCoord[v2][0] * invq;
183*5f2bebf7SJérôme Gardou    tex2[1] = VB->TexCoord[v2][1] * invq;
184*5f2bebf7SJérôme Gardou    tex2[2] = VB->TexCoord[v2][2] * invq;
185*5f2bebf7SJérôme Gardou    tex2[3] = VB->TexCoord[v2][3];
186*5f2bebf7SJérôme Gardou 
187*5f2bebf7SJérôme Gardou    if (ctx->StippleCounter==0) {
188*5f2bebf7SJérôme Gardou       FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_LINE_RESET_TOKEN );
189*5f2bebf7SJérôme Gardou    }
190*5f2bebf7SJérôme Gardou    else {
191*5f2bebf7SJérôme Gardou       FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_LINE_TOKEN );
192*5f2bebf7SJérôme Gardou    }
193*5f2bebf7SJérôme Gardou 
194*5f2bebf7SJérôme Gardou    {
195*5f2bebf7SJérôme Gardou       GLfloat color[4];
196*5f2bebf7SJérôme Gardou       /* convert color from integer to a float in [0,1] */
197*5f2bebf7SJérôme Gardou       color[0] = (GLfloat) VB->Color[pv][0] * invRedScale;
198*5f2bebf7SJérôme Gardou       color[1] = (GLfloat) VB->Color[pv][1] * invGreenScale;
199*5f2bebf7SJérôme Gardou       color[2] = (GLfloat) VB->Color[pv][2] * invBlueScale;
200*5f2bebf7SJérôme Gardou       color[3] = (GLfloat) VB->Color[pv][3] * invAlphaScale;
201*5f2bebf7SJérôme Gardou       gl_feedback_vertex( ctx, x1,y1,z1,w1, color,
202*5f2bebf7SJérôme Gardou                           (GLfloat) VB->Index[pv], tex1 );
203*5f2bebf7SJérôme Gardou       gl_feedback_vertex( ctx, x2,y2,z2,w2, color,
204*5f2bebf7SJérôme Gardou                           (GLfloat) VB->Index[pv], tex2 );
205*5f2bebf7SJérôme Gardou    }
206*5f2bebf7SJérôme Gardou 
207*5f2bebf7SJérôme Gardou    ctx->StippleCounter++;
208*5f2bebf7SJérôme Gardou }
209*5f2bebf7SJérôme Gardou 
210*5f2bebf7SJérôme Gardou 
211*5f2bebf7SJérôme Gardou 
select_line(GLcontext * ctx,GLuint v1,GLuint v2,GLuint pv)212*5f2bebf7SJérôme Gardou static void select_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
213*5f2bebf7SJérôme Gardou {
214*5f2bebf7SJérôme Gardou    gl_update_hitflag( ctx, ctx->VB->Win[v1][2] / DEPTH_SCALE );
215*5f2bebf7SJérôme Gardou    gl_update_hitflag( ctx, ctx->VB->Win[v2][2] / DEPTH_SCALE );
216*5f2bebf7SJérôme Gardou }
217*5f2bebf7SJérôme Gardou 
218*5f2bebf7SJérôme Gardou 
219*5f2bebf7SJérôme Gardou 
220*5f2bebf7SJérôme Gardou #if MAX_WIDTH > MAX_HEIGHT
221*5f2bebf7SJérôme Gardou #  define MAXPOINTS MAX_WIDTH
222*5f2bebf7SJérôme Gardou #else
223*5f2bebf7SJérôme Gardou #  define MAXPOINTS MAX_HEIGHT
224*5f2bebf7SJérôme Gardou #endif
225*5f2bebf7SJérôme Gardou 
226*5f2bebf7SJérôme Gardou 
227*5f2bebf7SJérôme Gardou /* Flat, color index line */
flat_ci_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)228*5f2bebf7SJérôme Gardou static void flat_ci_line( GLcontext *ctx,
229*5f2bebf7SJérôme Gardou                           GLuint vert0, GLuint vert1, GLuint pvert )
230*5f2bebf7SJérôme Gardou {
231*5f2bebf7SJérôme Gardou    GLint count;
232*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
233*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
234*5f2bebf7SJérôme Gardou    PB_SET_INDEX( ctx, ctx->PB, ctx->VB->Index[pvert] );
235*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
236*5f2bebf7SJérôme Gardou 
237*5f2bebf7SJérôme Gardou #define INTERP_XY 1
238*5f2bebf7SJérôme Gardou 
239*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
240*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
241*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
242*5f2bebf7SJérôme Gardou 	count++;
243*5f2bebf7SJérôme Gardou 
244*5f2bebf7SJérôme Gardou #include "linetemp.h"
245*5f2bebf7SJérôme Gardou 
246*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
247*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
248*5f2bebf7SJérôme Gardou }
249*5f2bebf7SJérôme Gardou 
250*5f2bebf7SJérôme Gardou 
251*5f2bebf7SJérôme Gardou 
252*5f2bebf7SJérôme Gardou /* Flat, color index line with Z interpolation/testing */
flat_ci_z_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)253*5f2bebf7SJérôme Gardou static void flat_ci_z_line( GLcontext *ctx,
254*5f2bebf7SJérôme Gardou                             GLuint vert0, GLuint vert1, GLuint pvert )
255*5f2bebf7SJérôme Gardou {
256*5f2bebf7SJérôme Gardou    GLint count;
257*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
258*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
259*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
260*5f2bebf7SJérôme Gardou    PB_SET_INDEX( ctx, ctx->PB, ctx->VB->Index[pvert] );
261*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
262*5f2bebf7SJérôme Gardou 
263*5f2bebf7SJérôme Gardou #define INTERP_XY 1
264*5f2bebf7SJérôme Gardou #define INTERP_Z 1
265*5f2bebf7SJérôme Gardou 
266*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
267*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
268*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
269*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
270*5f2bebf7SJérôme Gardou 	count++;
271*5f2bebf7SJérôme Gardou 
272*5f2bebf7SJérôme Gardou #include "linetemp.h"
273*5f2bebf7SJérôme Gardou 
274*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
275*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
276*5f2bebf7SJérôme Gardou }
277*5f2bebf7SJérôme Gardou 
278*5f2bebf7SJérôme Gardou 
279*5f2bebf7SJérôme Gardou 
280*5f2bebf7SJérôme Gardou /* Flat-shaded, RGBA line */
flat_rgba_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)281*5f2bebf7SJérôme Gardou static void flat_rgba_line( GLcontext *ctx,
282*5f2bebf7SJérôme Gardou                             GLuint vert0, GLuint vert1, GLuint pvert )
283*5f2bebf7SJérôme Gardou {
284*5f2bebf7SJérôme Gardou    GLint count;
285*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
286*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
287*5f2bebf7SJérôme Gardou    GLubyte *color = ctx->VB->Color[pvert];
288*5f2bebf7SJérôme Gardou    PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
289*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
290*5f2bebf7SJérôme Gardou 
291*5f2bebf7SJérôme Gardou #define INTERP_XY 1
292*5f2bebf7SJérôme Gardou 
293*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
294*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
295*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
296*5f2bebf7SJérôme Gardou 	count++;
297*5f2bebf7SJérôme Gardou 
298*5f2bebf7SJérôme Gardou #include "linetemp.h"
299*5f2bebf7SJérôme Gardou 
300*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
301*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
302*5f2bebf7SJérôme Gardou }
303*5f2bebf7SJérôme Gardou 
304*5f2bebf7SJérôme Gardou 
305*5f2bebf7SJérôme Gardou 
306*5f2bebf7SJérôme Gardou /* Flat-shaded, RGBA line with Z interpolation/testing */
flat_rgba_z_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)307*5f2bebf7SJérôme Gardou static void flat_rgba_z_line( GLcontext *ctx,
308*5f2bebf7SJérôme Gardou                               GLuint vert0, GLuint vert1, GLuint pvert )
309*5f2bebf7SJérôme Gardou {
310*5f2bebf7SJérôme Gardou    GLint count;
311*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
312*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
313*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
314*5f2bebf7SJérôme Gardou    GLubyte *color = ctx->VB->Color[pvert];
315*5f2bebf7SJérôme Gardou    PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
316*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
317*5f2bebf7SJérôme Gardou 
318*5f2bebf7SJérôme Gardou #define INTERP_XY 1
319*5f2bebf7SJérôme Gardou #define INTERP_Z 1
320*5f2bebf7SJérôme Gardou 
321*5f2bebf7SJérôme Gardou #define PLOT(X,Y)	\
322*5f2bebf7SJérôme Gardou 	pbx[count] = X;	\
323*5f2bebf7SJérôme Gardou 	pby[count] = Y;	\
324*5f2bebf7SJérôme Gardou 	pbz[count] = Z;	\
325*5f2bebf7SJérôme Gardou 	count++;
326*5f2bebf7SJérôme Gardou 
327*5f2bebf7SJérôme Gardou #include "linetemp.h"
328*5f2bebf7SJérôme Gardou 
329*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
330*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
331*5f2bebf7SJérôme Gardou }
332*5f2bebf7SJérôme Gardou 
333*5f2bebf7SJérôme Gardou 
334*5f2bebf7SJérôme Gardou 
335*5f2bebf7SJérôme Gardou /* Smooth shaded, color index line */
smooth_ci_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)336*5f2bebf7SJérôme Gardou static void smooth_ci_line( GLcontext *ctx,
337*5f2bebf7SJérôme Gardou                             GLuint vert0, GLuint vert1, GLuint pvert )
338*5f2bebf7SJérôme Gardou {
339*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
340*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
341*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
342*5f2bebf7SJérôme Gardou    GLuint *pbi = ctx->PB->i;
343*5f2bebf7SJérôme Gardou 
344*5f2bebf7SJérôme Gardou #define INTERP_XY 1
345*5f2bebf7SJérôme Gardou #define INTERP_INDEX 1
346*5f2bebf7SJérôme Gardou 
347*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
348*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
349*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
350*5f2bebf7SJérôme Gardou 	pbi[count] = I;		\
351*5f2bebf7SJérôme Gardou 	count++;
352*5f2bebf7SJérôme Gardou 
353*5f2bebf7SJérôme Gardou #include "linetemp.h"
354*5f2bebf7SJérôme Gardou 
355*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
356*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
357*5f2bebf7SJérôme Gardou }
358*5f2bebf7SJérôme Gardou 
359*5f2bebf7SJérôme Gardou 
360*5f2bebf7SJérôme Gardou 
361*5f2bebf7SJérôme Gardou /* Smooth shaded, color index line with Z interpolation/testing */
smooth_ci_z_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)362*5f2bebf7SJérôme Gardou static void smooth_ci_z_line( GLcontext *ctx,
363*5f2bebf7SJérôme Gardou                               GLuint vert0, GLuint vert1, GLuint pvert )
364*5f2bebf7SJérôme Gardou {
365*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
366*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
367*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
368*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
369*5f2bebf7SJérôme Gardou    GLuint *pbi = ctx->PB->i;
370*5f2bebf7SJérôme Gardou 
371*5f2bebf7SJérôme Gardou #define INTERP_XY 1
372*5f2bebf7SJérôme Gardou #define INTERP_Z 1
373*5f2bebf7SJérôme Gardou #define INTERP_INDEX 1
374*5f2bebf7SJérôme Gardou 
375*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
376*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
377*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
378*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
379*5f2bebf7SJérôme Gardou 	pbi[count] = I;		\
380*5f2bebf7SJérôme Gardou 	count++;
381*5f2bebf7SJérôme Gardou 
382*5f2bebf7SJérôme Gardou #include "linetemp.h"
383*5f2bebf7SJérôme Gardou 
384*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
385*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
386*5f2bebf7SJérôme Gardou }
387*5f2bebf7SJérôme Gardou 
388*5f2bebf7SJérôme Gardou 
389*5f2bebf7SJérôme Gardou 
390*5f2bebf7SJérôme Gardou /* Smooth-shaded, RGBA line */
smooth_rgba_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)391*5f2bebf7SJérôme Gardou static void smooth_rgba_line( GLcontext *ctx,
392*5f2bebf7SJérôme Gardou                        	      GLuint vert0, GLuint vert1, GLuint pvert )
393*5f2bebf7SJérôme Gardou {
394*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
395*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
396*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
397*5f2bebf7SJérôme Gardou    GLubyte *pbr = ctx->PB->r;
398*5f2bebf7SJérôme Gardou    GLubyte *pbg = ctx->PB->g;
399*5f2bebf7SJérôme Gardou    GLubyte *pbb = ctx->PB->b;
400*5f2bebf7SJérôme Gardou    GLubyte *pba = ctx->PB->a;
401*5f2bebf7SJérôme Gardou 
402*5f2bebf7SJérôme Gardou #define INTERP_XY 1
403*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
404*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
405*5f2bebf7SJérôme Gardou 
406*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
407*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
408*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
409*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
410*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
411*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
412*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
413*5f2bebf7SJérôme Gardou 	count++;
414*5f2bebf7SJérôme Gardou 
415*5f2bebf7SJérôme Gardou #include "linetemp.h"
416*5f2bebf7SJérôme Gardou 
417*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
418*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
419*5f2bebf7SJérôme Gardou }
420*5f2bebf7SJérôme Gardou 
421*5f2bebf7SJérôme Gardou 
422*5f2bebf7SJérôme Gardou 
423*5f2bebf7SJérôme Gardou /* Smooth-shaded, RGBA line with Z interpolation/testing */
smooth_rgba_z_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)424*5f2bebf7SJérôme Gardou static void smooth_rgba_z_line( GLcontext *ctx,
425*5f2bebf7SJérôme Gardou                        	        GLuint vert0, GLuint vert1, GLuint pvert )
426*5f2bebf7SJérôme Gardou {
427*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
428*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
429*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
430*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
431*5f2bebf7SJérôme Gardou    GLubyte *pbr = ctx->PB->r;
432*5f2bebf7SJérôme Gardou    GLubyte *pbg = ctx->PB->g;
433*5f2bebf7SJérôme Gardou    GLubyte *pbb = ctx->PB->b;
434*5f2bebf7SJérôme Gardou    GLubyte *pba = ctx->PB->a;
435*5f2bebf7SJérôme Gardou 
436*5f2bebf7SJérôme Gardou #define INTERP_XY 1
437*5f2bebf7SJérôme Gardou #define INTERP_Z 1
438*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
439*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
440*5f2bebf7SJérôme Gardou 
441*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
442*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
443*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
444*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
445*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
446*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
447*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
448*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
449*5f2bebf7SJérôme Gardou 	count++;
450*5f2bebf7SJérôme Gardou 
451*5f2bebf7SJérôme Gardou #include "linetemp.h"
452*5f2bebf7SJérôme Gardou 
453*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
454*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
455*5f2bebf7SJérôme Gardou }
456*5f2bebf7SJérôme Gardou 
457*5f2bebf7SJérôme Gardou 
458*5f2bebf7SJérôme Gardou #define CHECK_FULL(count)			\
459*5f2bebf7SJérôme Gardou 	if (count >= PB_SIZE-MAX_WIDTH) {	\
460*5f2bebf7SJérôme Gardou 	   ctx->PB->count = count;		\
461*5f2bebf7SJérôme Gardou 	   gl_flush_pb(ctx);			\
462*5f2bebf7SJérôme Gardou 	   count = ctx->PB->count;		\
463*5f2bebf7SJérôme Gardou 	}
464*5f2bebf7SJérôme Gardou 
465*5f2bebf7SJérôme Gardou 
466*5f2bebf7SJérôme Gardou 
467*5f2bebf7SJérôme Gardou /* Smooth shaded, color index, any width, maybe stippled */
general_smooth_ci_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)468*5f2bebf7SJérôme Gardou static void general_smooth_ci_line( GLcontext *ctx,
469*5f2bebf7SJérôme Gardou                            	    GLuint vert0, GLuint vert1, GLuint pvert )
470*5f2bebf7SJérôme Gardou {
471*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
472*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
473*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
474*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
475*5f2bebf7SJérôme Gardou    GLuint *pbi = ctx->PB->i;
476*5f2bebf7SJérôme Gardou 
477*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
478*5f2bebf7SJérôme Gardou       /* stippled */
479*5f2bebf7SJérôme Gardou #define INTERP_XY 1
480*5f2bebf7SJérôme Gardou #define INTERP_Z 1
481*5f2bebf7SJérôme Gardou #define INTERP_INDEX 1
482*5f2bebf7SJérôme Gardou #define WIDE 1
483*5f2bebf7SJérôme Gardou #define STIPPLE 1
484*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
485*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
486*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
487*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
488*5f2bebf7SJérôme Gardou 	pbi[count] = I;		\
489*5f2bebf7SJérôme Gardou 	count++;		\
490*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
491*5f2bebf7SJérôme Gardou #include "linetemp.h"
492*5f2bebf7SJérôme Gardou    }
493*5f2bebf7SJérôme Gardou    else {
494*5f2bebf7SJérôme Gardou       /* unstippled */
495*5f2bebf7SJérôme Gardou       if (ctx->Line.Width==2.0F) {
496*5f2bebf7SJérôme Gardou          /* special case: unstippled and width=2 */
497*5f2bebf7SJérôme Gardou #define INTERP_XY 1
498*5f2bebf7SJérôme Gardou #define INTERP_Z 1
499*5f2bebf7SJérôme Gardou #define INTERP_INDEX 1
500*5f2bebf7SJérôme Gardou #define XMAJOR_PLOT(X,Y)			\
501*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X;	\
502*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y+1;	\
503*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
504*5f2bebf7SJérôme Gardou 	pbi[count] = I;  pbi[count+1] = I;	\
505*5f2bebf7SJérôme Gardou 	count += 2;
506*5f2bebf7SJérôme Gardou #define YMAJOR_PLOT(X,Y)			\
507*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X+1;	\
508*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y;	\
509*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
510*5f2bebf7SJérôme Gardou 	pbi[count] = I;  pbi[count+1] = I;	\
511*5f2bebf7SJérôme Gardou 	count += 2;
512*5f2bebf7SJérôme Gardou #include "linetemp.h"
513*5f2bebf7SJérôme Gardou       }
514*5f2bebf7SJérôme Gardou       else {
515*5f2bebf7SJérôme Gardou          /* unstippled, any width */
516*5f2bebf7SJérôme Gardou #define INTERP_XY 1
517*5f2bebf7SJérôme Gardou #define INTERP_Z 1
518*5f2bebf7SJérôme Gardou #define INTERP_INDEX 1
519*5f2bebf7SJérôme Gardou #define WIDE 1
520*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
521*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
522*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
523*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
524*5f2bebf7SJérôme Gardou 	pbi[count] = I;		\
525*5f2bebf7SJérôme Gardou 	count++;		\
526*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
527*5f2bebf7SJérôme Gardou #include "linetemp.h"
528*5f2bebf7SJérôme Gardou       }
529*5f2bebf7SJérôme Gardou    }
530*5f2bebf7SJérôme Gardou 
531*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
532*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
533*5f2bebf7SJérôme Gardou }
534*5f2bebf7SJérôme Gardou 
535*5f2bebf7SJérôme Gardou 
536*5f2bebf7SJérôme Gardou /* Flat shaded, color index, any width, maybe stippled */
general_flat_ci_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)537*5f2bebf7SJérôme Gardou static void general_flat_ci_line( GLcontext *ctx,
538*5f2bebf7SJérôme Gardou                                   GLuint vert0, GLuint vert1, GLuint pvert )
539*5f2bebf7SJérôme Gardou {
540*5f2bebf7SJérôme Gardou    GLint count;
541*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
542*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
543*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
544*5f2bebf7SJérôme Gardou    PB_SET_INDEX( ctx, ctx->PB, ctx->VB->Index[pvert] );
545*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
546*5f2bebf7SJérôme Gardou 
547*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
548*5f2bebf7SJérôme Gardou       /* stippled, any width */
549*5f2bebf7SJérôme Gardou #define INTERP_XY 1
550*5f2bebf7SJérôme Gardou #define INTERP_Z 1
551*5f2bebf7SJérôme Gardou #define WIDE 1
552*5f2bebf7SJérôme Gardou #define STIPPLE 1
553*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
554*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
555*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
556*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
557*5f2bebf7SJérôme Gardou 	count++;		\
558*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
559*5f2bebf7SJérôme Gardou #include "linetemp.h"
560*5f2bebf7SJérôme Gardou    }
561*5f2bebf7SJérôme Gardou    else {
562*5f2bebf7SJérôme Gardou       /* unstippled */
563*5f2bebf7SJérôme Gardou       if (ctx->Line.Width==2.0F) {
564*5f2bebf7SJérôme Gardou          /* special case: unstippled and width=2 */
565*5f2bebf7SJérôme Gardou #define INTERP_XY 1
566*5f2bebf7SJérôme Gardou #define INTERP_Z 1
567*5f2bebf7SJérôme Gardou #define XMAJOR_PLOT(X,Y)			\
568*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X;	\
569*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y+1;	\
570*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
571*5f2bebf7SJérôme Gardou 	count += 2;
572*5f2bebf7SJérôme Gardou #define YMAJOR_PLOT(X,Y)			\
573*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X+1;	\
574*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y;	\
575*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
576*5f2bebf7SJérôme Gardou 	count += 2;
577*5f2bebf7SJérôme Gardou #include "linetemp.h"
578*5f2bebf7SJérôme Gardou       }
579*5f2bebf7SJérôme Gardou       else {
580*5f2bebf7SJérôme Gardou          /* unstippled, any width */
581*5f2bebf7SJérôme Gardou #define INTERP_XY 1
582*5f2bebf7SJérôme Gardou #define INTERP_Z 1
583*5f2bebf7SJérôme Gardou #define WIDE 1
584*5f2bebf7SJérôme Gardou #define PLOT(X,Y)		\
585*5f2bebf7SJérôme Gardou 	pbx[count] = X;		\
586*5f2bebf7SJérôme Gardou 	pby[count] = Y;		\
587*5f2bebf7SJérôme Gardou 	pbz[count] = Z;		\
588*5f2bebf7SJérôme Gardou 	count++;		\
589*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
590*5f2bebf7SJérôme Gardou #include "linetemp.h"
591*5f2bebf7SJérôme Gardou       }
592*5f2bebf7SJérôme Gardou    }
593*5f2bebf7SJérôme Gardou 
594*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
595*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
596*5f2bebf7SJérôme Gardou }
597*5f2bebf7SJérôme Gardou 
598*5f2bebf7SJérôme Gardou 
599*5f2bebf7SJérôme Gardou 
general_smooth_rgba_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)600*5f2bebf7SJérôme Gardou static void general_smooth_rgba_line( GLcontext *ctx,
601*5f2bebf7SJérôme Gardou                                       GLuint vert0, GLuint vert1, GLuint pvert)
602*5f2bebf7SJérôme Gardou {
603*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
604*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
605*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
606*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
607*5f2bebf7SJérôme Gardou    GLubyte *pbr = ctx->PB->r;
608*5f2bebf7SJérôme Gardou    GLubyte *pbg = ctx->PB->g;
609*5f2bebf7SJérôme Gardou    GLubyte *pbb = ctx->PB->b;
610*5f2bebf7SJérôme Gardou    GLubyte *pba = ctx->PB->a;
611*5f2bebf7SJérôme Gardou 
612*5f2bebf7SJérôme Gardou    TRACE("Line %3.1f, %3.1f, %3.1f (r%u, g%u, b%u) --> %3.1f, %3.1f, %3.1f (r%u, g%u, b%u)\n",
613*5f2bebf7SJérôme Gardou            ctx->VB->Win[vert0][0], ctx->VB->Win[vert0][1], ctx->VB->Win[vert0][2], ctx->VB->Color[vert0][0], ctx->VB->Color[vert0][1], ctx->VB->Color[vert0][2],
614*5f2bebf7SJérôme Gardou            ctx->VB->Win[vert1][0], ctx->VB->Win[vert1][1], ctx->VB->Win[vert1][2], ctx->VB->Color[vert1][0], ctx->VB->Color[vert1][1], ctx->VB->Color[vert1][2]);
615*5f2bebf7SJérôme Gardou 
616*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
617*5f2bebf7SJérôme Gardou       /* stippled */
618*5f2bebf7SJérôme Gardou #define INTERP_XY 1
619*5f2bebf7SJérôme Gardou #define INTERP_Z 1
620*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
621*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
622*5f2bebf7SJérôme Gardou #define WIDE 1
623*5f2bebf7SJérôme Gardou #define STIPPLE 1
624*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
625*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
626*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
627*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
628*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
629*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
630*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
631*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
632*5f2bebf7SJérôme Gardou 	count++;			\
633*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
634*5f2bebf7SJérôme Gardou #include "linetemp.h"
635*5f2bebf7SJérôme Gardou    }
636*5f2bebf7SJérôme Gardou    else {
637*5f2bebf7SJérôme Gardou       /* unstippled */
638*5f2bebf7SJérôme Gardou       if (ctx->Line.Width==2.0F) {
639*5f2bebf7SJérôme Gardou          /* special case: unstippled and width=2 */
640*5f2bebf7SJérôme Gardou #define INTERP_XY 1
641*5f2bebf7SJérôme Gardou #define INTERP_Z 1
642*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
643*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
644*5f2bebf7SJérôme Gardou #define XMAJOR_PLOT(X,Y)						\
645*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X;				\
646*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y+1;				\
647*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;				\
648*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);  pbr[count+1] = FixedToInt(r0);	\
649*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);  pbg[count+1] = FixedToInt(g0);	\
650*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);  pbb[count+1] = FixedToInt(b0);	\
651*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);  pba[count+1] = FixedToInt(a0);	\
652*5f2bebf7SJérôme Gardou 	count += 2;
653*5f2bebf7SJérôme Gardou #define YMAJOR_PLOT(X,Y)						\
654*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X+1;				\
655*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y;				\
656*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;				\
657*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);  pbr[count+1] = FixedToInt(r0);	\
658*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);  pbg[count+1] = FixedToInt(g0);	\
659*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);  pbb[count+1] = FixedToInt(b0);	\
660*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);  pba[count+1] = FixedToInt(a0);	\
661*5f2bebf7SJérôme Gardou 	count += 2;
662*5f2bebf7SJérôme Gardou #include "linetemp.h"
663*5f2bebf7SJérôme Gardou       }
664*5f2bebf7SJérôme Gardou       else {
665*5f2bebf7SJérôme Gardou          /* unstippled, any width */
666*5f2bebf7SJérôme Gardou #define INTERP_XY 1
667*5f2bebf7SJérôme Gardou #define INTERP_Z 1
668*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
669*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
670*5f2bebf7SJérôme Gardou #define WIDE 1
671*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
672*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
673*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
674*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
675*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
676*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
677*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
678*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
679*5f2bebf7SJérôme Gardou 	count++;			\
680*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
681*5f2bebf7SJérôme Gardou #include "linetemp.h"
682*5f2bebf7SJérôme Gardou       }
683*5f2bebf7SJérôme Gardou    }
684*5f2bebf7SJérôme Gardou 
685*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
686*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
687*5f2bebf7SJérôme Gardou }
688*5f2bebf7SJérôme Gardou 
689*5f2bebf7SJérôme Gardou 
general_flat_rgba_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pvert)690*5f2bebf7SJérôme Gardou static void general_flat_rgba_line( GLcontext *ctx,
691*5f2bebf7SJérôme Gardou                                     GLuint vert0, GLuint vert1, GLuint pvert )
692*5f2bebf7SJérôme Gardou {
693*5f2bebf7SJérôme Gardou    GLint count;
694*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
695*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
696*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
697*5f2bebf7SJérôme Gardou    GLubyte *color = ctx->VB->Color[pvert];
698*5f2bebf7SJérôme Gardou    PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
699*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
700*5f2bebf7SJérôme Gardou 
701*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
702*5f2bebf7SJérôme Gardou       /* stippled */
703*5f2bebf7SJérôme Gardou #define INTERP_XY 1
704*5f2bebf7SJérôme Gardou #define INTERP_Z 1
705*5f2bebf7SJérôme Gardou #define WIDE 1
706*5f2bebf7SJérôme Gardou #define STIPPLE 1
707*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
708*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
709*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
710*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
711*5f2bebf7SJérôme Gardou 	count++;			\
712*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
713*5f2bebf7SJérôme Gardou #include "linetemp.h"
714*5f2bebf7SJérôme Gardou    }
715*5f2bebf7SJérôme Gardou    else {
716*5f2bebf7SJérôme Gardou       /* unstippled */
717*5f2bebf7SJérôme Gardou       if (ctx->Line.Width==2.0F) {
718*5f2bebf7SJérôme Gardou          /* special case: unstippled and width=2 */
719*5f2bebf7SJérôme Gardou #define INTERP_XY 1
720*5f2bebf7SJérôme Gardou #define INTERP_Z 1
721*5f2bebf7SJérôme Gardou #define XMAJOR_PLOT(X,Y)			\
722*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X;	\
723*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y+1;	\
724*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
725*5f2bebf7SJérôme Gardou 	count += 2;
726*5f2bebf7SJérôme Gardou #define YMAJOR_PLOT(X,Y)			\
727*5f2bebf7SJérôme Gardou 	pbx[count] = X;  pbx[count+1] = X+1;	\
728*5f2bebf7SJérôme Gardou 	pby[count] = Y;  pby[count+1] = Y;	\
729*5f2bebf7SJérôme Gardou 	pbz[count] = Z;  pbz[count+1] = Z;	\
730*5f2bebf7SJérôme Gardou 	count += 2;
731*5f2bebf7SJérôme Gardou #include "linetemp.h"
732*5f2bebf7SJérôme Gardou       }
733*5f2bebf7SJérôme Gardou       else {
734*5f2bebf7SJérôme Gardou          /* unstippled, any width */
735*5f2bebf7SJérôme Gardou #define INTERP_XY 1
736*5f2bebf7SJérôme Gardou #define INTERP_Z 1
737*5f2bebf7SJérôme Gardou #define WIDE 1
738*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
739*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
740*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
741*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
742*5f2bebf7SJérôme Gardou 	count++;			\
743*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
744*5f2bebf7SJérôme Gardou #include "linetemp.h"
745*5f2bebf7SJérôme Gardou       }
746*5f2bebf7SJérôme Gardou    }
747*5f2bebf7SJérôme Gardou 
748*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
749*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
750*5f2bebf7SJérôme Gardou }
751*5f2bebf7SJérôme Gardou 
752*5f2bebf7SJérôme Gardou 
753*5f2bebf7SJérôme Gardou 
754*5f2bebf7SJérôme Gardou /* Flat-shaded, textured, any width, maybe stippled */
flat_textured_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pv)755*5f2bebf7SJérôme Gardou static void flat_textured_line( GLcontext *ctx,
756*5f2bebf7SJérôme Gardou                                 GLuint vert0, GLuint vert1, GLuint pv )
757*5f2bebf7SJérôme Gardou {
758*5f2bebf7SJérôme Gardou    GLint count;
759*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
760*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
761*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
762*5f2bebf7SJérôme Gardou    GLfloat *pbs = ctx->PB->s;
763*5f2bebf7SJérôme Gardou    GLfloat *pbt = ctx->PB->t;
764*5f2bebf7SJérôme Gardou    GLfloat *pbu = ctx->PB->u;
765*5f2bebf7SJérôme Gardou    GLubyte *color = ctx->VB->Color[pv];
766*5f2bebf7SJérôme Gardou    PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] );
767*5f2bebf7SJérôme Gardou    count = ctx->PB->count;
768*5f2bebf7SJérôme Gardou 
769*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
770*5f2bebf7SJérôme Gardou       /* stippled */
771*5f2bebf7SJérôme Gardou #define INTERP_XY 1
772*5f2bebf7SJérôme Gardou #define INTERP_Z 1
773*5f2bebf7SJérôme Gardou #define INTERP_STW 1
774*5f2bebf7SJérôme Gardou #define INTERP_UV 1
775*5f2bebf7SJérôme Gardou #define WIDE 1
776*5f2bebf7SJérôme Gardou #define STIPPLE 1
777*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
778*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
779*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
780*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
781*5f2bebf7SJérôme Gardou 	pbs[count] = s0 / w0;		\
782*5f2bebf7SJérôme Gardou 	pbt[count] = t0 / w0;		\
783*5f2bebf7SJérôme Gardou 	pbu[count] = u0 / w0;		\
784*5f2bebf7SJérôme Gardou 	count++;			\
785*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
786*5f2bebf7SJérôme Gardou #include "linetemp.h"
787*5f2bebf7SJérôme Gardou    }
788*5f2bebf7SJérôme Gardou    else {
789*5f2bebf7SJérôme Gardou       /* unstippled */
790*5f2bebf7SJérôme Gardou #define INTERP_XY 1
791*5f2bebf7SJérôme Gardou #define INTERP_Z 1
792*5f2bebf7SJérôme Gardou #define INTERP_STW 1
793*5f2bebf7SJérôme Gardou #define INTERP_UV 1
794*5f2bebf7SJérôme Gardou #define WIDE 1
795*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
796*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
797*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
798*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
799*5f2bebf7SJérôme Gardou 	pbs[count] = s0 / w0;		\
800*5f2bebf7SJérôme Gardou 	pbt[count] = t0 / w0;		\
801*5f2bebf7SJérôme Gardou 	pbu[count] = u0 / w0;		\
802*5f2bebf7SJérôme Gardou 	count++;			\
803*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
804*5f2bebf7SJérôme Gardou #include "linetemp.h"
805*5f2bebf7SJérôme Gardou    }
806*5f2bebf7SJérôme Gardou 
807*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
808*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
809*5f2bebf7SJérôme Gardou }
810*5f2bebf7SJérôme Gardou 
811*5f2bebf7SJérôme Gardou 
812*5f2bebf7SJérôme Gardou 
813*5f2bebf7SJérôme Gardou /* Smooth-shaded, textured, any width, maybe stippled */
smooth_textured_line(GLcontext * ctx,GLuint vert0,GLuint vert1,GLuint pv)814*5f2bebf7SJérôme Gardou static void smooth_textured_line( GLcontext *ctx,
815*5f2bebf7SJérôme Gardou                                   GLuint vert0, GLuint vert1, GLuint pv )
816*5f2bebf7SJérôme Gardou {
817*5f2bebf7SJérôme Gardou    GLint count = ctx->PB->count;
818*5f2bebf7SJérôme Gardou    GLint *pbx = ctx->PB->x;
819*5f2bebf7SJérôme Gardou    GLint *pby = ctx->PB->y;
820*5f2bebf7SJérôme Gardou    GLdepth *pbz = ctx->PB->z;
821*5f2bebf7SJérôme Gardou    GLfloat *pbs = ctx->PB->s;
822*5f2bebf7SJérôme Gardou    GLfloat *pbt = ctx->PB->t;
823*5f2bebf7SJérôme Gardou    GLfloat *pbu = ctx->PB->u;
824*5f2bebf7SJérôme Gardou    GLubyte *pbr = ctx->PB->r;
825*5f2bebf7SJérôme Gardou    GLubyte *pbg = ctx->PB->g;
826*5f2bebf7SJérôme Gardou    GLubyte *pbb = ctx->PB->b;
827*5f2bebf7SJérôme Gardou    GLubyte *pba = ctx->PB->a;
828*5f2bebf7SJérôme Gardou 
829*5f2bebf7SJérôme Gardou    if (ctx->Line.StippleFlag) {
830*5f2bebf7SJérôme Gardou       /* stippled */
831*5f2bebf7SJérôme Gardou #define INTERP_XY 1
832*5f2bebf7SJérôme Gardou #define INTERP_Z 1
833*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
834*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
835*5f2bebf7SJérôme Gardou #define INTERP_STW 1
836*5f2bebf7SJérôme Gardou #define INTERP_UV 1
837*5f2bebf7SJérôme Gardou #define WIDE 1
838*5f2bebf7SJérôme Gardou #define STIPPLE 1
839*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
840*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
841*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
842*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
843*5f2bebf7SJérôme Gardou 	pbs[count] = s0 / w0;		\
844*5f2bebf7SJérôme Gardou 	pbt[count] = t0 / w0;		\
845*5f2bebf7SJérôme Gardou 	pbu[count] = u0 / w0;		\
846*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
847*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
848*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
849*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
850*5f2bebf7SJérôme Gardou 	count++;			\
851*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
852*5f2bebf7SJérôme Gardou #include "linetemp.h"
853*5f2bebf7SJérôme Gardou    }
854*5f2bebf7SJérôme Gardou    else {
855*5f2bebf7SJérôme Gardou       /* unstippled */
856*5f2bebf7SJérôme Gardou #define INTERP_XY 1
857*5f2bebf7SJérôme Gardou #define INTERP_Z 1
858*5f2bebf7SJérôme Gardou #define INTERP_RGB 1
859*5f2bebf7SJérôme Gardou #define INTERP_ALPHA 1
860*5f2bebf7SJérôme Gardou #define INTERP_STW 1
861*5f2bebf7SJérôme Gardou #define INTERP_UV 1
862*5f2bebf7SJérôme Gardou #define WIDE 1
863*5f2bebf7SJérôme Gardou #define PLOT(X,Y)			\
864*5f2bebf7SJérôme Gardou 	pbx[count] = X;			\
865*5f2bebf7SJérôme Gardou 	pby[count] = Y;			\
866*5f2bebf7SJérôme Gardou 	pbz[count] = Z;			\
867*5f2bebf7SJérôme Gardou 	pbs[count] = s0 / w0;		\
868*5f2bebf7SJérôme Gardou 	pbt[count] = t0 / w0;		\
869*5f2bebf7SJérôme Gardou 	pbu[count] = u0 / w0;		\
870*5f2bebf7SJérôme Gardou 	pbr[count] = FixedToInt(r0);	\
871*5f2bebf7SJérôme Gardou 	pbg[count] = FixedToInt(g0);	\
872*5f2bebf7SJérôme Gardou 	pbb[count] = FixedToInt(b0);	\
873*5f2bebf7SJérôme Gardou 	pba[count] = FixedToInt(a0);	\
874*5f2bebf7SJérôme Gardou 	count++;			\
875*5f2bebf7SJérôme Gardou 	CHECK_FULL(count);
876*5f2bebf7SJérôme Gardou #include "linetemp.h"
877*5f2bebf7SJérôme Gardou    }
878*5f2bebf7SJérôme Gardou 
879*5f2bebf7SJérôme Gardou    ctx->PB->count = count;
880*5f2bebf7SJérôme Gardou    PB_CHECK_FLUSH( ctx, ctx->PB );
881*5f2bebf7SJérôme Gardou }
882*5f2bebf7SJérôme Gardou 
883*5f2bebf7SJérôme Gardou 
884*5f2bebf7SJérôme Gardou 
885*5f2bebf7SJérôme Gardou /*
886*5f2bebf7SJérôme Gardou  * Null rasterizer for measuring transformation speed.
887*5f2bebf7SJérôme Gardou  */
null_line(GLcontext * ctx,GLuint v1,GLuint v2,GLuint pv)888*5f2bebf7SJérôme Gardou static void null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
889*5f2bebf7SJérôme Gardou {
890*5f2bebf7SJérôme Gardou }
891*5f2bebf7SJérôme Gardou 
892*5f2bebf7SJérôme Gardou 
893*5f2bebf7SJérôme Gardou 
894*5f2bebf7SJérôme Gardou /*
895*5f2bebf7SJérôme Gardou  * Determine which line drawing function to use given the current
896*5f2bebf7SJérôme Gardou  * rendering context.
897*5f2bebf7SJérôme Gardou  */
gl_set_line_function(GLcontext * ctx)898*5f2bebf7SJérôme Gardou void gl_set_line_function( GLcontext *ctx )
899*5f2bebf7SJérôme Gardou {
900*5f2bebf7SJérôme Gardou    GLboolean rgbmode = ctx->Visual->RGBAflag;
901*5f2bebf7SJérôme Gardou    /* TODO: antialiased lines */
902*5f2bebf7SJérôme Gardou 
903*5f2bebf7SJérôme Gardou    if (ctx->RenderMode==GL_RENDER) {
904*5f2bebf7SJérôme Gardou       if (ctx->NoRaster) {
905*5f2bebf7SJérôme Gardou          ctx->Driver.LineFunc = null_line;
906*5f2bebf7SJérôme Gardou          return;
907*5f2bebf7SJérôme Gardou       }
908*5f2bebf7SJérôme Gardou       if (ctx->Driver.LineFunc) {
909*5f2bebf7SJérôme Gardou          /* Device driver will draw lines. */
910*5f2bebf7SJérôme Gardou          ctx->Driver.LineFunc = ctx->Driver.LineFunc;
911*5f2bebf7SJérôme Gardou       }
912*5f2bebf7SJérôme Gardou       else if (ctx->Texture.Enabled) {
913*5f2bebf7SJérôme Gardou          if (ctx->Light.ShadeModel==GL_SMOOTH) {
914*5f2bebf7SJérôme Gardou             ctx->Driver.LineFunc = smooth_textured_line;
915*5f2bebf7SJérôme Gardou          }
916*5f2bebf7SJérôme Gardou          else {
917*5f2bebf7SJérôme Gardou             ctx->Driver.LineFunc = flat_textured_line;
918*5f2bebf7SJérôme Gardou          }
919*5f2bebf7SJérôme Gardou       }
920*5f2bebf7SJérôme Gardou       else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag
921*5f2bebf7SJérôme Gardou                || ctx->Line.SmoothFlag || ctx->Texture.Enabled) {
922*5f2bebf7SJérôme Gardou          if (ctx->Light.ShadeModel==GL_SMOOTH) {
923*5f2bebf7SJérôme Gardou             if (rgbmode)
924*5f2bebf7SJérôme Gardou                ctx->Driver.LineFunc = general_smooth_rgba_line;
925*5f2bebf7SJérôme Gardou             else
926*5f2bebf7SJérôme Gardou                ctx->Driver.LineFunc = general_smooth_ci_line;
927*5f2bebf7SJérôme Gardou          }
928*5f2bebf7SJérôme Gardou          else {
929*5f2bebf7SJérôme Gardou             if (rgbmode)
930*5f2bebf7SJérôme Gardou                ctx->Driver.LineFunc = general_flat_rgba_line;
931*5f2bebf7SJérôme Gardou             else
932*5f2bebf7SJérôme Gardou                ctx->Driver.LineFunc = general_flat_ci_line;
933*5f2bebf7SJérôme Gardou          }
934*5f2bebf7SJérôme Gardou       }
935*5f2bebf7SJérôme Gardou       else {
936*5f2bebf7SJérôme Gardou 	 if (ctx->Light.ShadeModel==GL_SMOOTH) {
937*5f2bebf7SJérôme Gardou 	    /* Width==1, non-stippled, smooth-shaded */
938*5f2bebf7SJérôme Gardou             if (ctx->Depth.Test
939*5f2bebf7SJérôme Gardou 	        || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
940*5f2bebf7SJérôme Gardou                if (rgbmode)
941*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = smooth_rgba_z_line;
942*5f2bebf7SJérôme Gardou                else
943*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = smooth_ci_z_line;
944*5f2bebf7SJérôme Gardou             }
945*5f2bebf7SJérôme Gardou             else {
946*5f2bebf7SJérôme Gardou                if (rgbmode)
947*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = smooth_rgba_line;
948*5f2bebf7SJérôme Gardou                else
949*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = smooth_ci_line;
950*5f2bebf7SJérôme Gardou             }
951*5f2bebf7SJérôme Gardou 	 }
952*5f2bebf7SJérôme Gardou          else {
953*5f2bebf7SJérôme Gardou 	    /* Width==1, non-stippled, flat-shaded */
954*5f2bebf7SJérôme Gardou             if (ctx->Depth.Test
955*5f2bebf7SJérôme Gardou                 || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) {
956*5f2bebf7SJérôme Gardou                if (rgbmode)
957*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = flat_rgba_z_line;
958*5f2bebf7SJérôme Gardou                else
959*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = flat_ci_z_line;
960*5f2bebf7SJérôme Gardou             }
961*5f2bebf7SJérôme Gardou             else {
962*5f2bebf7SJérôme Gardou                if (rgbmode)
963*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = flat_rgba_line;
964*5f2bebf7SJérôme Gardou                else
965*5f2bebf7SJérôme Gardou                   ctx->Driver.LineFunc = flat_ci_line;
966*5f2bebf7SJérôme Gardou             }
967*5f2bebf7SJérôme Gardou          }
968*5f2bebf7SJérôme Gardou       }
969*5f2bebf7SJérôme Gardou    }
970*5f2bebf7SJérôme Gardou    else if (ctx->RenderMode==GL_FEEDBACK) {
971*5f2bebf7SJérôme Gardou       ctx->Driver.LineFunc = feedback_line;
972*5f2bebf7SJérôme Gardou    }
973*5f2bebf7SJérôme Gardou    else {
974*5f2bebf7SJérôme Gardou       /* GL_SELECT mode */
975*5f2bebf7SJérôme Gardou       ctx->Driver.LineFunc = select_line;
976*5f2bebf7SJérôme Gardou    }
977*5f2bebf7SJérôme Gardou }
978*5f2bebf7SJérôme Gardou 
979