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