s_lines.c revision e3a051e0538a605551f4d58294c94f5eb00ed07f
1e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* $Id: s_lines.c,v 1.1 2000/10/31 18:00:04 keithw Exp $ */
2e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
3e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
4e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Mesa 3-D graphics library
5e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Version:  3.5
6e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
7e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
8e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
9e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
10e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * copy of this software and associated documentation files (the "Software"),
11e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to deal in the Software without restriction, including without limitation
12e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * and/or sell copies of the Software, and to permit persons to whom the
14e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Software is furnished to do so, subject to the following conditions:
15e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
16e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * The above copyright notice and this permission notice shall be included
17e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * in all copies or substantial portions of the Software.
18e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
19e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
26e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
27e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
28e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "glheader.h"
29e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "feedback.h"
30e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "macros.h"
31e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "mmath.h"
32e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "vb.h"
33e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
34e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_pb.h"
35e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_depth.h"
36e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
37e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
38e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
39e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/**********************************************************************/
40e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*****                    Rasterization                           *****/
41e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/**********************************************************************/
42e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
43e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
44e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
45e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * There are 4 pairs (RGBA, CI) of line drawing functions:
46e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *   1. simple:  width=1 and no special rasterization functions (fastest)
47e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *   2. flat:  width=1, non-stippled, flat-shaded, any raster operations
48e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *   3. smooth:  width=1, non-stippled, smooth-shaded, any raster operations
49e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *   4. general:  any other kind of line (slowest)
50e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
51e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
52e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
53e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
54e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * All line drawing functions have the same arguments:
55e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
56e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * pv     - provoking vertex: which vertex color/index to use for flat shading.
57e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
58e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
59e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
60e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
61e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
62e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
63e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
64e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#if MAX_WIDTH > MAX_HEIGHT
65e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#  define MAXPOINTS MAX_WIDTH
66e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#else
67e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#  define MAXPOINTS MAX_HEIGHT
68e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
69e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
70e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
71e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat, color index line */
72e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_ci_line( GLcontext *ctx,
73e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                          GLuint vert0, GLuint vert1, GLuint pvert )
74e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
75e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
76e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
77e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
78e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)  PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
79e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
80e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
81e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
82e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
83e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
84e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
85e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
86e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
87e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat, color index line with Z interpolation/testing */
88e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_ci_z_line( GLcontext *ctx,
89e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                            GLuint vert0, GLuint vert1, GLuint pvert )
90e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
91e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
92e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
93e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
94e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
95e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)  PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
96e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
97e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
98e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
99e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
100e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
101e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
102e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
103e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
104e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat-shaded, RGBA line */
105e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_rgba_line( GLcontext *ctx,
106e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                            GLuint vert0, GLuint vert1, GLuint pvert )
107e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
108e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   const GLchan *color = ctx->VB->ColorPtr->data[pvert];
109e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
110e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
111e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
112e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)   PB_WRITE_PIXEL(ctx->PB, X, Y, 0, 0);
113e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
114e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
115e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
116e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
117e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
118e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
119e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
120e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
121e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat-shaded, RGBA line with Z interpolation/testing */
122e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_rgba_z_line( GLcontext *ctx,
123e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                              GLuint vert0, GLuint vert1, GLuint pvert )
124e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
125e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   const GLchan *color = ctx->VB->ColorPtr->data[pvert];
126e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
127e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
128e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
129e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
130e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)   PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
131e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
132e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
133e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
134e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
135e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
136e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
137e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
138e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
139e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth shaded, color index line */
140e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_ci_line( GLcontext *ctx,
141e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                            GLuint vert0, GLuint vert1, GLuint pvert )
142e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
143e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
144e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
145e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
146e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLuint *pbi = ctx->PB->index;
147e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
148e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
149e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
150e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
151e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
152e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
153e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
154e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
155e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
156e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
157e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;		\
158e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;
159e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
160e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
161e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
162e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
163e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
164e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
165e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
166e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
167e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
168e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth shaded, color index line with Z interpolation/testing */
169e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_ci_z_line( GLcontext *ctx,
170e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                              GLuint vert0, GLuint vert1, GLuint pvert )
171e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
172e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
173e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
174e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
175e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
176e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLuint *pbi = ctx->PB->index;
177e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
178e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
179e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
180e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
181e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
182e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
183e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
184e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
185e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
186e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
187e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
188e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;		\
189e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;		\
190e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;
191e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
192e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
193e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
194e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
195e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
196e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
197e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
198e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
199e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
200e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth-shaded, RGBA line */
201e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_rgba_line( GLcontext *ctx,
202e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                       	      GLuint vert0, GLuint vert1, GLuint pvert )
203e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
204e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
205e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
206e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
207e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
208e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
209e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
210e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
211e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
212e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
213e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
214e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
215e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
216e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)			\
217e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;			\
218e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;			\
219e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);	\
220e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);	\
221e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);	\
222e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);	\
223e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;
224e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
225e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
226e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
227e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
228e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
229e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
230e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
231e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
232e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
233e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth-shaded, RGBA line with Z interpolation/testing */
234e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_rgba_z_line( GLcontext *ctx,
235e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                       	        GLuint vert0, GLuint vert1, GLuint pvert )
236e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
237e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
238e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
239e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
240e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
241e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
242e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
243e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
244e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
245e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
246e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
247e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
248e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
249e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
250e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
251e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
252e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
253e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)			\
254e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;			\
255e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;			\
256e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;			\
257e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;			\
258e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);	\
259e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);	\
260e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);	\
261e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);	\
262e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;
263e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
264e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
265e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
266e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
267e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
268e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
269e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
270e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
271e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define CHECK_FULL(count)			\
272e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	if (count >= PB_SIZE-MAX_WIDTH) {	\
273e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   ctx->PB->count = count;		\
274e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   gl_flush_pb(ctx);			\
275e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count = ctx->PB->count;		\
276e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
277e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
278e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
279e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
280e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth shaded, color index, any width, maybe stippled */
281e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void general_smooth_ci_line( GLcontext *ctx,
282e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                           	    GLuint vert0, GLuint vert1, GLuint pvert )
283e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
284e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
285e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
286e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
287e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
288e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
289e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLuint *pbi = ctx->PB->index;
290e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
291e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
292e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
293e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
294e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
295e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
296e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
297e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
298e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
299e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
300e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
301e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
302e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
303e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
304e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;		\
305e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;			\
306e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;		\
307e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;		\
308e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
309e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
310e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
311e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
312e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
313e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Line.Width==2.0F) {
314e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* special case: unstippled and width=2 */
315e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
316e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
317e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
318e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define XMAJOR_PLOT(X,Y)			\
319e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X;	\
320e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y+1;	\
321e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;	\
322e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
323e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;  pbi[count+1] = I;	\
324e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;				\
325e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
326e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define YMAJOR_PLOT(X,Y)			\
327e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X+1;	\
328e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y;	\
329e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;	\
330e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
331e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;  pbi[count+1] = I;	\
332e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;				\
333e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
334e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
335e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
336e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else {
337e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* unstippled, any width */
338e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
339e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
340e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
341e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
342e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
343e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
344e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
345e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;		\
346e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbi[count] = I;		\
347e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;	\
348e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;		\
349e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
350e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
351e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
352e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
353e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
354e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
355e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
356e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
357e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
358e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
359e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat shaded, color index, any width, maybe stippled */
360e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void general_flat_ci_line( GLcontext *ctx,
361e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                  GLuint vert0, GLuint vert1, GLuint pvert )
362e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
363e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count;
364e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
365e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
366e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
367e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
368e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
369e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   count = ctx->PB->count;
370e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
371e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
372e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled, any width */
373e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
374e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
375e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
376e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
377e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
378e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
379e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
380e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;		\
381e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;		\
382e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;		\
383e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
384e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
385e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
386e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
387e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
388e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Line.Width==2.0F) {
389e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* special case: unstippled and width=2 */
390e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
391e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
392e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define XMAJOR_PLOT(X,Y)			\
393e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X;	\
394e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y+1;	\
395e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;	\
396e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
397e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;				\
398e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
399e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define YMAJOR_PLOT(X,Y)			\
400e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X+1;	\
401e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y;	\
402e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;	\
403e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
404e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;				\
405e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
406e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
407e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
408e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else {
409e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* unstippled, any width */
410e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
411e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
412e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
413e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)		\
414e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;		\
415e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;		\
416e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;		\
417e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;		\
418e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;		\
419e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
420e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
421e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
422e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
423e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
424e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
425e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
426e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
427e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
428e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
429e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
430e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void general_smooth_rgba_line( GLcontext *ctx,
431e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                      GLuint vert0, GLuint vert1, GLuint pvert)
432e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
433e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
434e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
435e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
436e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
437e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
438e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
439e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
440e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
441e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
442e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
443e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
444e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
445e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
446e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
447e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
448e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
449e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
450e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
451e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
452e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)				\
453e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;				\
454e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;				\
455e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;				\
456e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;		\
457e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);	\
458e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);	\
459e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);	\
460e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);	\
461e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;				\
462e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
463e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
464e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
465e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
466e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
467e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Line.Width==2.0F) {
468e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* special case: unstippled and width=2 */
469e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
470e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
471e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
472e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
473e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define XMAJOR_PLOT(X,Y)				\
474e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X;		\
475e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y+1;		\
476e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;		\
477e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
478e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);		\
479e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);		\
480e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);		\
481e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);		\
482e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][RCOMP] = FixedToInt(r0);	\
483e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][GCOMP] = FixedToInt(g0);	\
484e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][BCOMP] = FixedToInt(b0);	\
485e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][ACOMP] = FixedToInt(a0);	\
486e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;					\
487e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
488e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define YMAJOR_PLOT(X,Y)				\
489e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;  pbx[count+1] = X+1;		\
490e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;  pby[count+1] = Y;		\
491e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;  pbz[count+1] = Z;		\
492e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  pbfog[count+1] = fog0;	\
493e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);		\
494e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);		\
495e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);		\
496e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);		\
497e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][RCOMP] = FixedToInt(r0);	\
498e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][GCOMP] = FixedToInt(g0);	\
499e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][BCOMP] = FixedToInt(b0);	\
500e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count+1][ACOMP] = FixedToInt(a0);	\
501e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count += 2;					\
502e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
503e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
504e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
505e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else {
506e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* unstippled, any width */
507e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
508e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
509e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
510e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
511e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
512e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)				\
513e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbx[count] = X;				\
514e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pby[count] = Y;				\
515e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbz[count] = Z;				\
516e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbfog[count] = fog0;  	\
517e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][RCOMP] = FixedToInt(r0);	\
518e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][GCOMP] = FixedToInt(g0);	\
519e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][BCOMP] = FixedToInt(b0);	\
520e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	pbrgba[count][ACOMP] = FixedToInt(a0);	\
521e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	count++;				\
522e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	CHECK_FULL(count);
523e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
524e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
525e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
526e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
527e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
528e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
529e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
530e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
531e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
532e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void general_flat_rgba_line( GLcontext *ctx,
533e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                    GLuint vert0, GLuint vert1, GLuint pvert )
534e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
535e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   const GLchan *color = ctx->VB->ColorPtr->data[pvert];
536e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
537e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
538e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
539e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
540e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
541e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
542e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
543e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
544e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)  PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
545e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
546e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
547e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
548e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
549e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Line.Width==2.0F) {
550e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* special case: unstippled and width=2 */
551e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
552e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
553e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
554e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                         PB_WRITE_PIXEL(ctx->PB, X, Y+1, Z, fog0);
555e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define YMAJOR_PLOT(X,Y)  PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0); \
556e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                          PB_WRITE_PIXEL(ctx->PB, X+1, Y, Z, fog0);
557e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
558e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
559e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else {
560e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* unstippled, any width */
561e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
562e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
563e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
564e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z, fog0);
565e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
566e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
567e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
568e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
569e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
570e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
571e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
572e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
573e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat-shaded, textured, any width, maybe stippled */
574e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_textured_line( GLcontext *ctx,
575e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                GLuint vert0, GLuint vert1, GLuint pv )
576e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
577e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count;
578e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
579e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
580e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
581e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
582e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbs = ctx->PB->s[0];
583e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbt = ctx->PB->t[0];
584e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbu = ctx->PB->u[0];
585e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan *color = ctx->VB->ColorPtr->data[pv];
586e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
587e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   count = ctx->PB->count;
588e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
589e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
590e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
591e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
592e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
593e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_TEX 1
594e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
595e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
596e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)			\
597e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{				\
598e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;		\
599e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;		\
600e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;		\
601e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
602e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbs[count] = fragTexcoord[0];\
603e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbt[count] = fragTexcoord[1];\
604e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbu[count] = fragTexcoord[2];\
605e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;			\
606e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);		\
607e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
608e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
609e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
610e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
611e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
612e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
613e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
614e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_TEX 1
615e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
616e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)			\
617e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{				\
618e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;		\
619e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;		\
620e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;		\
621e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
622e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbs[count] = fragTexcoord[0];\
623e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbt[count] = fragTexcoord[1];\
624e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbu[count] = fragTexcoord[2];\
625e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;			\
626e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);		\
627e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
628e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
629e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
630e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
631e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
632e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
633e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
634e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
635e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
636e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
637e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth-shaded, textured, any width, maybe stippled */
638e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_textured_line( GLcontext *ctx,
639e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                  GLuint vert0, GLuint vert1, GLuint pvert )
640e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
641e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
642e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
643e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
644e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
645e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
646e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbs = ctx->PB->s[0];
647e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbt = ctx->PB->t[0];
648e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfloat *pbu = ctx->PB->u[0];
649e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
650e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
651e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
652e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
653e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
654e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
655e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
656e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
657e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
658e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
659e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
660e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_TEX 1
661e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
662e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
663e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)					\
664e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{						\
665e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;				\
666e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;				\
667e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;				\
668e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
669e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbs[count] = fragTexcoord[0];		\
670e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbt[count] = fragTexcoord[1];		\
671e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbu[count] = fragTexcoord[2];		\
672e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = FixedToInt(r0);	\
673e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = FixedToInt(g0);	\
674e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = FixedToInt(b0);	\
675e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = FixedToInt(a0);	\
676e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;					\
677e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);				\
678e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
679e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
680e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
681e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
682e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
683e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
684e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
685e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
686e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
687e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_TEX 1
688e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
689e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)					\
690e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{						\
691e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;				\
692e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;				\
693e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;				\
694e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
695e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbs[count] = fragTexcoord[0];		\
696e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbt[count] = fragTexcoord[1];		\
697e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbu[count] = fragTexcoord[2];		\
698e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = FixedToInt(r0);	\
699e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = FixedToInt(g0);	\
700e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = FixedToInt(b0);	\
701e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = FixedToInt(a0);	\
702e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;					\
703e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);				\
704e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
705e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
706e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
707e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
708e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
709e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
710e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
711e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
712e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
713e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
714e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * color interpolation.
715e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
716e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void smooth_multitextured_line( GLcontext *ctx,
717e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                   GLuint vert0, GLuint vert1, GLuint pvert )
718e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
719e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
720e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
721e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
722e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
723e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
724e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
725e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbspec)[3] = ctx->PB->spec;
726e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
727e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
728e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
729e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
730e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
731e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
732e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
733e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
734e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
735e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
736e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_SPEC 1
737e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
738e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_MULTITEX 1
739e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
740e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
741e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)						\
742e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{							\
743e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   GLuint u;						\
744e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;					\
745e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;					\
746e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;					\
747e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
748e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = FixedToInt(r0);		\
749e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = FixedToInt(g0);		\
750e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = FixedToInt(b0);		\
751e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = FixedToInt(a0);		\
752e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][RCOMP] = FixedToInt(sr0);		\
753e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][GCOMP] = FixedToInt(sg0);		\
754e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][BCOMP] = FixedToInt(sb0);		\
755e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {	\
756e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      if (ctx->Texture.Unit[u].ReallyEnabled) {		\
757e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][0] = fragTexcoord[u][0];		\
758e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][1] = fragTexcoord[u][1];		\
759e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][2] = fragTexcoord[u][2];		\
760e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][3] = fragTexcoord[u][3];		\
761e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      }							\
762e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   }							\
763e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;						\
764e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);					\
765e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
766e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
767e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
768e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
769e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
770e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
771e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
772e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGB 1
773e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_SPEC 1
774e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
775e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_MULTITEX 1
776e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
777e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)						\
778e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{							\
779e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   GLuint u;						\
780e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;					\
781e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;					\
782e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;					\
783e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
784e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = FixedToInt(r0);		\
785e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = FixedToInt(g0);		\
786e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = FixedToInt(b0);		\
787e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = FixedToInt(a0);		\
788e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][RCOMP] = FixedToInt(sr0);		\
789e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][GCOMP] = FixedToInt(sg0);		\
790e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][BCOMP] = FixedToInt(sb0);		\
791e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {	\
792e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      if (ctx->Texture.Unit[u].ReallyEnabled) {		\
793e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][0] = fragTexcoord[u][0];		\
794e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][1] = fragTexcoord[u][1];		\
795e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][2] = fragTexcoord[u][2];		\
796e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][3] = fragTexcoord[u][3];		\
797e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      }							\
798e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   }							\
799e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;						\
800e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);					\
801e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
802e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
803e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
804e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
805e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
806e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
807e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
808e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
809e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
810e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/* Flat-shaded, multitextured, any width, maybe stippled, separate specular
811e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * color interpolation.
812e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
813e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void flat_multitextured_line( GLcontext *ctx,
814e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                     GLuint vert0, GLuint vert1, GLuint pvert )
815e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
816e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint count = ctx->PB->count;
817e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pbx = ctx->PB->x;
818e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLint *pby = ctx->PB->y;
819e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLdepth *pbz = ctx->PB->z;
820e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLfixed *pbfog = ctx->PB->fog;
821e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbrgba)[4] = ctx->PB->rgba;
822e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan (*pbspec)[3] = ctx->PB->spec;
823e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan *color = ctx->VB->ColorPtr->data[pvert];
824e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan sRed   = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][0] : 0;
825e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan sGreen = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][1] : 0;
826e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLchan sBlue  = ctx->VB->SecondaryColorPtr->data ? ctx->VB->SecondaryColorPtr->data[pvert][2] : 0;
827e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
828e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pvert;
829e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
830e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->mono = GL_FALSE;
831e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
832e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Line.StippleFlag) {
833e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* stippled */
834e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
835e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
836e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
837e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_MULTITEX 1
838e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
839e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define STIPPLE 1
840e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)						\
841e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{							\
842e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   GLuint u;						\
843e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;					\
844e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;					\
845e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;					\
846e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
847e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = color[0];			\
848e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = color[1];			\
849e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = color[2];			\
850e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = color[3];			\
851e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][RCOMP] = sRed;				\
852e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][GCOMP] = sGreen;			\
853e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][BCOMP] = sBlue;			\
854e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {	\
855e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      if (ctx->Texture.Unit[u].ReallyEnabled) {		\
856e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][0] = fragTexcoord[u][0];		\
857e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][1] = fragTexcoord[u][1];		\
858e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][2] = fragTexcoord[u][2];		\
859e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][3] = fragTexcoord[u][3];		\
860e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      }							\
861e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   }							\
862e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;						\
863e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);					\
864e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
865e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
866e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
867e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
868e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* unstippled */
869e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_XY 1
870e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_Z 1
871e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_ALPHA 1
872e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_MULTITEX 1
873e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define WIDE 1
874e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(X,Y)						\
875e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	{							\
876e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   GLuint u;						\
877e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbx[count] = X;					\
878e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pby[count] = Y;					\
879e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbz[count] = Z;					\
880e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	   pbfog[count] = fog0;		\
881e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][RCOMP] = color[0];			\
882e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][GCOMP] = color[1];			\
883e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][BCOMP] = color[2];			\
884e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbrgba[count][ACOMP] = color[3];			\
885e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][RCOMP] = sRed;				\
886e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][GCOMP] = sGreen;			\
887e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   pbspec[count][BCOMP] = sBlue;			\
888e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {	\
889e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      if (ctx->Texture.Unit[u].ReallyEnabled) {		\
890e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][0] = fragTexcoord[u][0];		\
891e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][1] = fragTexcoord[u][1];		\
892e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][2] = fragTexcoord[u][2];		\
893e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	         ctx->PB->s[u][3] = fragTexcoord[u][3];		\
894e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	      }							\
895e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   }							\
896e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   count++;						\
897e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	   CHECK_FULL(count);					\
898e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	}
899e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_linetemp.h"
900e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
901e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
902e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   ctx->PB->count = count;
903e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   gl_flush_pb(ctx);
904e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
905e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
906e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
907e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
908e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
909e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
910e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Antialiased RGBA line
911e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
912e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This AA line function isn't terribly efficient but it's pretty
913e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * straight-forward to understand.  Also, it doesn't exactly conform
914e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to the specification.
915e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
916e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void aa_rgba_line( GLcontext *ctx,
917e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                          GLuint vert0, GLuint vert1, GLuint pvert )
918e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
919e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGBA 1
920e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(x, y)						\
921e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   {								\
922e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, fog0,		\
923e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell			   red, green, blue, coverage );	\
924e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
925e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_lnaatemp.h"
926e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
927e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
928e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
929e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Antialiased Textured RGBA line
930e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
931e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This AA line function isn't terribly efficient but it's pretty
932e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * straight-forward to understand.  Also, it doesn't exactly conform
933e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to the specification.
934e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
935e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void aa_tex_rgba_line( GLcontext *ctx,
936e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                              GLuint vert0, GLuint vert1, GLuint pvert )
937e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
938e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGBA 1
939e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_TEX 1
940e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(x, y)							\
941e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   {									\
942e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      PB_WRITE_TEX_PIXEL( pb, (x), (y), z, fog0,                        \
943e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell			  red, green, blue, coverage,	                \
944e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                 fragTexcoord[0], fragTexcoord[1], fragTexcoord[2] );	\
945e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
946e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_lnaatemp.h"
947e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
948e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
949e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
950e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
951e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Antialiased Multitextured RGBA line
952e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
953e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * This AA line function isn't terribly efficient but it's pretty
954e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * straight-forward to understand.  Also, it doesn't exactly conform
955e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * to the specification.
956e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
957e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void aa_multitex_rgba_line( GLcontext *ctx,
958e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                                   GLuint vert0, GLuint vert1, GLuint pvert )
959e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
960e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_RGBA 1
961e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_SPEC 1
962e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_MULTITEX 1
963e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(x, y)							\
964e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   {									\
965e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, fog0,		\
966e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            red, green, blue, coverage, specRed, specGreen, specBlue,	\
967e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            fragTexcoord );						\
968e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
969e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_lnaatemp.h"
970e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
971e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
972e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
973e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
974e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Antialiased CI line.  Same comments for RGBA antialiased lines apply.
975e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
976e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void aa_ci_line( GLcontext *ctx,
977e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                        GLuint vert0, GLuint vert1, GLuint pvert )
978e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
979e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define INTERP_INDEX 1
980e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#define PLOT(x, y)						\
981e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   {								\
982e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      PB_WRITE_CI_PIXEL( pb, (x), (y), z, fog0, index + coverage );	\
983e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
984e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#include "s_lnaatemp.h"
985e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
986e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
987e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
988e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
989e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Null rasterizer for measuring transformation speed.
990e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
991e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellstatic void null_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
992e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
993e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) ctx;
994e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) v1;
995e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) v2;
996e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   (void) pv;
997e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
998e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
999e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1000e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1001e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#ifdef DEBUG
1002e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellvoid
1003e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell_mesa_print_line_function(GLcontext *ctx)
1004e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
1005e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   printf("Line Func == ");
1006e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->Driver.LineFunc == flat_ci_line)
1007e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_ci_line\n");
1008e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == flat_ci_z_line)
1009e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_ci_z_line\n");
1010e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == flat_rgba_line)
1011e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_rgba_line\n");
1012e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == flat_rgba_z_line)
1013e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_rgba_z_line\n");
1014e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_ci_line)
1015e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_ci_line\n");
1016e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_ci_z_line)
1017e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_ci_z_line\n");
1018e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_rgba_line)
1019e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_rgba_line\n");
1020e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_rgba_z_line)
1021e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_rgba_z_line\n");
1022e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == general_smooth_ci_line)
1023e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("general_smooth_ci_line\n");
1024e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == general_flat_ci_line)
1025e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("general_flat_ci_line\n");
1026e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == general_smooth_rgba_line)
1027e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("general_smooth_rgba_line\n");
1028e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == general_flat_rgba_line)
1029e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("general_flat_rgba_line\n");
1030e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == flat_textured_line)
1031e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_textured_line\n");
1032e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_textured_line)
1033e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_textured_line\n");
1034e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == smooth_multitextured_line)
1035e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("smooth_multitextured_line\n");
1036e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == flat_multitextured_line)
1037e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("flat_multitextured_line\n");
1038e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == aa_rgba_line)
1039e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("aa_rgba_line\n");
1040e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == aa_tex_rgba_line)
1041e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("aa_tex_rgba_line\n");
1042e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == aa_multitex_rgba_line)
1043e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("aa_multitex_rgba_line\n");
1044e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == aa_ci_line)
1045e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("aa_ci_line\n");
1046e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->Driver.LineFunc == null_line)
1047e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("null_line\n");
1048e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else
1049e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      printf("Driver func %p\n", ctx->Driver.LineFunc);
1050e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
1051e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell#endif
1052e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1053e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1054e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1055e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell/*
1056e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Determine which line drawing function to use given the current
1057e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * rendering context.
1058e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell *
1059e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
1060e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell * tests to this code.
1061e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell */
1062e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwellvoid
1063e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell_swrast_set_line_function( GLcontext *ctx )
1064e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell{
1065e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   GLboolean rgbmode = ctx->Visual.RGBAflag;
1066e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   /* TODO: antialiased lines */
1067e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1068e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   if (ctx->RenderMode==GL_RENDER) {
1069e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->NoRaster) {
1070e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         ctx->Driver.LineFunc = null_line;
1071e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         return;
1072e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1073e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Driver.LineFunc) {
1074e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* Device driver will draw lines. */
1075e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	 return;
1076e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1077e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1078e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      if (ctx->Line.SmoothFlag) {
1079e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         /* antialiased lines */
1080e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if (rgbmode) {
1081e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (ctx->Texture.ReallyEnabled) {
1082e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               if (ctx->Texture.MultiTextureEnabled
1083e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
1084e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell		  || ctx->Fog.ColorSumEnabled)
1085e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  /* Multitextured! */
1086e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = aa_multitex_rgba_line;
1087e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               else
1088e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = aa_tex_rgba_line;
1089e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            } else {
1090e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = aa_rgba_line;
1091e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1092e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1093e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
1094e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            ctx->Driver.LineFunc = aa_ci_line;
1095e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1096e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1097e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else if (ctx->Texture.ReallyEnabled) {
1098e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if (ctx->Texture.MultiTextureEnabled
1099e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell             || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
1100e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell 	     || ctx->Fog.ColorSumEnabled) {
1101e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            /* multi-texture and/or separate specular color */
1102e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (ctx->Light.ShadeModel==GL_SMOOTH)
1103e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = smooth_multitextured_line;
1104e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else
1105e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = flat_multitextured_line;
1106e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1107e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
1108e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (ctx->Light.ShadeModel==GL_SMOOTH) {
1109e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                ctx->Driver.LineFunc = smooth_textured_line;
1110e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1111e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else {
1112e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                ctx->Driver.LineFunc = flat_textured_line;
1113e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1114e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1115e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1116e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag
1117e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               || ctx->Line.SmoothFlag) {
1118e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         if (ctx->Light.ShadeModel==GL_SMOOTH) {
1119e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (rgbmode)
1120e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = general_smooth_rgba_line;
1121e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else
1122e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = general_smooth_ci_line;
1123e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1124e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
1125e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (rgbmode)
1126e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = general_flat_rgba_line;
1127e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else
1128e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               ctx->Driver.LineFunc = general_flat_ci_line;
1129e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1130e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1131e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      else {
1132e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	 if (ctx->Light.ShadeModel==GL_SMOOTH) {
1133e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	    /* Width==1, non-stippled, smooth-shaded */
1134e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (ctx->Depth.Test || ctx->Fog.Enabled) {
1135e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               if (rgbmode)
1136e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = smooth_rgba_z_line;
1137e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               else
1138e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = smooth_ci_z_line;
1139e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1140e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else {
1141e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               if (rgbmode)
1142e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = smooth_rgba_line;
1143e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               else
1144e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = smooth_ci_line;
1145e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1146e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	 }
1147e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         else {
1148e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell	    /* Width==1, non-stippled, flat-shaded */
1149e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            if (ctx->Depth.Test || ctx->Fog.Enabled) {
1150e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               if (rgbmode)
1151e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = flat_rgba_z_line;
1152e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               else
1153e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = flat_ci_z_line;
1154e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1155e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            else {
1156e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               if (rgbmode)
1157e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = flat_rgba_line;
1158e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell               else
1159e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell                  ctx->Driver.LineFunc = flat_ci_line;
1160e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell            }
1161e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell         }
1162e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      }
1163e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
1164e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else if (ctx->RenderMode==GL_FEEDBACK) {
1165e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      ctx->Driver.LineFunc = gl_feedback_line;
1166e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
1167e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   else {
1168e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      /* GL_SELECT mode */
1169e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell      ctx->Driver.LineFunc = gl_select_line;
1170e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   }
1171e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell
1172e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell   /*_mesa_print_line_function(ctx);*/
1173e3a051e0538a605551f4d58294c94f5eb00ed07fKeith Whitwell}
1174