xm_line.c revision 449e47f06a46c42fb9895d13f37b599600225e56
1/* $Id: xm_line.c,v 1.22 2003/02/17 16:35:57 brianp Exp $ */
2
3/*
4 * Mesa 3-D graphics library
5 * Version:  5.1
6 *
7 * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28/*
29 * This file contains "accelerated" point, line, and triangle functions.
30 * It should be fairly easy to write new special-purpose point, line or
31 * triangle functions and hook them into this module.
32 */
33
34
35#include "glxheader.h"
36#include "depth.h"
37#include "macros.h"
38#include "mmath.h"
39#include "mtypes.h"
40#include "xmesaP.h"
41
42/* Internal swrast includes:
43 */
44#include "swrast/s_depth.h"
45#include "swrast/s_points.h"
46#include "swrast/s_lines.h"
47#include "swrast/s_context.h"
48
49
50/**********************************************************************/
51/***                    Point rendering                             ***/
52/**********************************************************************/
53
54
55/*
56 * Render an array of points into a pixmap, any pixel format.
57 */
58#if 000
59/* XXX don't use this, it doesn't dither correctly */
60static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
61{
62   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
63   XMesaDisplay *dpy = xmesa->xm_visual->display;
64   XMesaDrawable buffer = xmesa->xm_buffer->buffer;
65   XMesaGC gc = xmesa->xm_buffer->gc;
66
67   if (xmesa->xm_visual->mesa_visual.RGBAflag) {
68      register int x, y;
69      const GLubyte *color = vert->color;
70      unsigned long pixel = xmesa_color_to_pixel( xmesa,
71						  color[0], color[1],
72						  color[2], color[3],
73						  xmesa->pixelformat);
74      XMesaSetForeground( dpy, gc, pixel );
75      x =                         (GLint) vert->win[0];
76      y = FLIP( xmesa->xm_buffer, (GLint) vert->win[1] );
77      XMesaDrawPoint( dpy, buffer, gc, x, y);
78   }
79   else {
80      /* Color index mode */
81      register int x, y;
82      XMesaSetForeground( dpy, gc, vert->index );
83      x =                         (GLint) vert->win[0];
84      y = FLIP( xmesa->xm_buffer, (GLint) vert->win[1] );
85      XMesaDrawPoint( dpy, buffer, gc, x, y);
86   }
87}
88#endif
89
90
91/* Override the swrast point-selection function.  Try to use one of
92 * our internal point functions, otherwise fall back to the standard
93 * swrast functions.
94 */
95void xmesa_choose_point( GLcontext *ctx )
96{
97#if 0
98   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
99   SWcontext *swrast = SWRAST_CONTEXT(ctx);
100
101   if (ctx->RenderMode == GL_RENDER
102       && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag
103       && swrast->_RasterMask == 0
104       && !ctx->Texture._EnabledUnits
105       && xmesa->xm_buffer->buffer != XIMAGE) {
106      swrast->Point = draw_points_ANY_pixmap;
107   }
108   else {
109      _swrast_choose_point( ctx );
110   }
111#else
112   _swrast_choose_point( ctx );
113#endif
114}
115
116
117
118/**********************************************************************/
119/***                      Line rendering                            ***/
120/**********************************************************************/
121
122
123/*
124 * Draw a flat-shaded, PF_TRUECOLOR line into an XImage.
125 */
126#define NAME flat_TRUECOLOR_line
127#define SETUP_CODE					\
128   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;	\
129   const GLubyte *color = vert1->color;			\
130   XMesaImage *img = xmesa->xm_buffer->backimage;	\
131   unsigned long pixel;					\
132   PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
133#define CLIP_HACK 1
134#define PLOT(X,Y) XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel );
135#include "swrast/s_linetemp.h"
136
137
138
139/*
140 * Draw a flat-shaded, PF_8A8B8G8R line into an XImage.
141 */
142#define NAME flat_8A8B8G8R_line
143#define SETUP_CODE						\
144   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
145   const GLubyte *color = vert1->color;				\
146   GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
147#define PIXEL_TYPE GLuint
148#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
149#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
150#define CLIP_HACK 1
151#define PLOT(X,Y) *pixelPtr = pixel;
152#include "swrast/s_linetemp.h"
153
154
155
156/*
157 * Draw a flat-shaded, PF_8R8G8B line into an XImage.
158 */
159#define NAME flat_8R8G8B_line
160#define SETUP_CODE						\
161   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
162   const GLubyte *color = vert1->color;				\
163   GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
164#define PIXEL_TYPE GLuint
165#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
166#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
167#define CLIP_HACK 1
168#define PLOT(X,Y) *pixelPtr = pixel;
169#include "swrast/s_linetemp.h"
170
171
172
173/*
174 * Draw a flat-shaded, PF_8R8G8B24 line into an XImage.
175 */
176#define NAME flat_8R8G8B24_line
177#define SETUP_CODE						\
178   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
179   const GLubyte *color = vert1->color;
180#define PIXEL_TYPE bgr_t
181#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
182#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
183#define CLIP_HACK 1
184#define PLOT(X,Y) {			\
185      pixelPtr->r = color[RCOMP];	\
186      pixelPtr->g = color[GCOMP];	\
187      pixelPtr->b = color[BCOMP];	\
188}
189#include "swrast/s_linetemp.h"
190
191
192
193/*
194 * Draw a flat-shaded, PF_5R6G5B line into an XImage.
195 */
196#define NAME flat_5R6G5B_line
197#define SETUP_CODE						\
198   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
199   const GLubyte *color = vert1->color;				\
200   GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
201#define PIXEL_TYPE GLushort
202#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
203#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
204#define CLIP_HACK 1
205#define PLOT(X,Y) *pixelPtr = pixel;
206#include "swrast/s_linetemp.h"
207
208
209
210/*
211 * Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage.
212 */
213#define NAME flat_DITHER_5R6G5B_line
214#define SETUP_CODE						\
215   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
216   const GLubyte *color = vert1->color;
217#define PIXEL_TYPE GLushort
218#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
219#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
220#define CLIP_HACK 1
221#define PLOT(X,Y) PACK_TRUEDITHER( *pixelPtr, X, Y, color[0], color[1], color[2] );
222#include "swrast/s_linetemp.h"
223
224
225
226
227/*
228 * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage.
229 */
230#define NAME flat_DITHER8_line
231#define SETUP_CODE						\
232   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
233   const GLubyte *color = vert1->color;				\
234   GLint r = color[0], g = color[1], b = color[2];		\
235   DITHER_SETUP;
236#define PIXEL_TYPE GLubyte
237#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
238#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
239#define CLIP_HACK 1
240#define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b);
241#include "swrast/s_linetemp.h"
242
243
244
245/*
246 * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage.
247 */
248#define NAME flat_LOOKUP8_line
249#define SETUP_CODE						\
250   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
251   const GLubyte *color = vert1->color;				\
252   GLubyte pixel;						\
253   LOOKUP_SETUP;						\
254   pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
255#define PIXEL_TYPE GLubyte
256#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
257#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
258#define CLIP_HACK 1
259#define PLOT(X,Y) *pixelPtr = pixel;
260#include "swrast/s_linetemp.h"
261
262
263
264/*
265 * Draw a flat-shaded, PF_HPCR line into an XImage.
266 */
267#define NAME flat_HPCR_line
268#define SETUP_CODE						\
269   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
270   const GLubyte *color = vert1->color;				\
271   GLint r = color[0], g = color[1], b = color[2];
272#define PIXEL_TYPE GLubyte
273#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
274#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
275#define CLIP_HACK 1
276#define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b);
277#include "swrast/s_linetemp.h"
278
279
280
281
282/*
283 * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage.
284 */
285#define NAME flat_TRUECOLOR_z_line
286#define SETUP_CODE						\
287   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
288   const GLubyte *color = vert1->color;				\
289   XMesaImage *img = xmesa->xm_buffer->backimage;		\
290   unsigned long pixel;						\
291   PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
292#define INTERP_Z 1
293#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
294#define CLIP_HACK 1
295#define PLOT(X,Y)							\
296	if (Z < *zPtr) {						\
297	   *zPtr = Z;							\
298           XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel );	\
299	}
300#include "swrast/s_linetemp.h"
301
302
303
304/*
305 * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage.
306 */
307#define NAME flat_8A8B8G8R_z_line
308#define SETUP_CODE						\
309   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
310   const GLubyte *color = vert1->color;				\
311   GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
312#define INTERP_Z 1
313#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
314#define PIXEL_TYPE GLuint
315#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
316#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
317#define CLIP_HACK 1
318#define PLOT(X,Y)		\
319	if (Z < *zPtr) {	\
320	   *zPtr = Z;		\
321	   *pixelPtr = pixel;	\
322	}
323#include "swrast/s_linetemp.h"
324
325
326
327/*
328 * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage.
329 */
330#define NAME flat_8R8G8B_z_line
331#define SETUP_CODE						\
332   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
333   const GLubyte *color = vert1->color;				\
334   GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
335#define INTERP_Z 1
336#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
337#define PIXEL_TYPE GLuint
338#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
339#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
340#define CLIP_HACK 1
341#define PLOT(X,Y)		\
342	if (Z < *zPtr) {	\
343	   *zPtr = Z;		\
344	   *pixelPtr = pixel;	\
345	}
346#include "swrast/s_linetemp.h"
347
348
349
350/*
351 * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage.
352 */
353#define NAME flat_8R8G8B24_z_line
354#define SETUP_CODE						\
355   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
356   const GLubyte *color = vert1->color;
357#define INTERP_Z 1
358#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
359#define PIXEL_TYPE bgr_t
360#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
361#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
362#define CLIP_HACK 1
363#define PLOT(X,Y)			\
364	if (Z < *zPtr) {		\
365	   *zPtr = Z;			\
366           pixelPtr->r = color[RCOMP];	\
367           pixelPtr->g = color[GCOMP];	\
368           pixelPtr->b = color[BCOMP];	\
369	}
370#include "swrast/s_linetemp.h"
371
372
373
374/*
375 * Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage.
376 */
377#define NAME flat_5R6G5B_z_line
378#define SETUP_CODE						\
379   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
380   const GLubyte *color = vert1->color;				\
381   GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
382#define INTERP_Z 1
383#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
384#define PIXEL_TYPE GLushort
385#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
386#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
387#define CLIP_HACK 1
388#define PLOT(X,Y)		\
389	if (Z < *zPtr) {	\
390	   *zPtr = Z;		\
391	   *pixelPtr = pixel;	\
392	}
393#include "swrast/s_linetemp.h"
394
395
396
397/*
398 * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage.
399 */
400#define NAME flat_DITHER_5R6G5B_z_line
401#define SETUP_CODE					\
402   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;	\
403   const GLubyte *color = vert1->color;
404#define INTERP_Z 1
405#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
406#define PIXEL_TYPE GLushort
407#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
408#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
409#define CLIP_HACK 1
410#define PLOT(X,Y)		\
411	if (Z < *zPtr) {	\
412	   *zPtr = Z;		\
413	   PACK_TRUEDITHER(*pixelPtr, X, Y, color[0], color[1], color[2]); \
414	}
415#include "swrast/s_linetemp.h"
416
417
418
419/*
420 * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage.
421 */
422#define NAME flat_DITHER8_z_line
423#define SETUP_CODE					\
424   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;	\
425   const GLubyte *color = vert1->color;			\
426   GLint r = color[0], g = color[1], b = color[2];	\
427   DITHER_SETUP;
428#define INTERP_Z 1
429#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
430#define PIXEL_TYPE GLubyte
431#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
432#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
433#define CLIP_HACK 1
434#define PLOT(X,Y)						\
435	if (Z < *zPtr) {					\
436	   *zPtr = Z;						\
437	   *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b);	\
438	}
439#include "swrast/s_linetemp.h"
440
441
442
443/*
444 * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage.
445 */
446#define NAME flat_LOOKUP8_z_line
447#define SETUP_CODE						\
448   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
449   const GLubyte *color = vert1->color;				\
450   GLubyte pixel;						\
451   LOOKUP_SETUP;						\
452   pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
453#define INTERP_Z 1
454#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
455#define PIXEL_TYPE GLubyte
456#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
457#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
458#define CLIP_HACK 1
459#define PLOT(X,Y)		\
460	if (Z < *zPtr) {	\
461	   *zPtr = Z;		\
462	   *pixelPtr = pixel;	\
463	}
464#include "swrast/s_linetemp.h"
465
466
467
468/*
469 * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage.
470 */
471#define NAME flat_HPCR_z_line
472#define SETUP_CODE 						\
473   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;		\
474   const GLubyte *color = vert1->color;				\
475   GLint r = color[0], g = color[1], b = color[2];
476#define INTERP_Z 1
477#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
478#define PIXEL_TYPE GLubyte
479#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
480#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
481#define CLIP_HACK 1
482#define PLOT(X,Y)						\
483	if (Z < *zPtr) {					\
484	   *zPtr = Z;						\
485	   *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b);	\
486	}
487#include "swrast/s_linetemp.h"
488
489
490
491static swrast_line_func get_line_func( GLcontext *ctx )
492{
493   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
494   SWcontext *swrast = SWRAST_CONTEXT(ctx);
495   int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
496
497   (void) DitherValues;  /* silence unused var warning */
498   (void) kernel1;  /* silence unused var warning */
499
500   if (ctx->RenderMode != GL_RENDER)      return (swrast_line_func) NULL;
501   if (ctx->Line.SmoothFlag)              return (swrast_line_func) NULL;
502   if (ctx->Texture._EnabledUnits)        return (swrast_line_func) NULL;
503   if (ctx->Light.ShadeModel != GL_FLAT)  return (swrast_line_func) NULL;
504   if (ctx->Line.StippleFlag)             return (swrast_line_func) NULL;
505   if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
506
507   if (xmesa->xm_buffer->buffer==XIMAGE
508       && swrast->_RasterMask==DEPTH_BIT
509       && ctx->Depth.Func==GL_LESS
510       && ctx->Depth.Mask==GL_TRUE
511       && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS
512       && ctx->Line.Width==1.0F) {
513      switch (xmesa->pixelformat) {
514         case PF_Truecolor:
515            return flat_TRUECOLOR_z_line;
516         case PF_8A8B8G8R:
517            return flat_8A8B8G8R_z_line;
518         case PF_8R8G8B:
519            return flat_8R8G8B_z_line;
520         case PF_8R8G8B24:
521            return flat_8R8G8B24_z_line;
522         case PF_5R6G5B:
523            return flat_5R6G5B_z_line;
524         case PF_Dither_5R6G5B:
525            return flat_DITHER_5R6G5B_z_line;
526         case PF_Dither:
527            return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL;
528         case PF_Lookup:
529            return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL;
530         case PF_HPCR:
531            return flat_HPCR_z_line;
532         default:
533            return (swrast_line_func)NULL;
534      }
535   }
536   if (xmesa->xm_buffer->buffer==XIMAGE
537       && swrast->_RasterMask==0
538       && ctx->Line.Width==1.0F) {
539      switch (xmesa->pixelformat) {
540         case PF_Truecolor:
541            return flat_TRUECOLOR_line;
542         case PF_8A8B8G8R:
543            return flat_8A8B8G8R_line;
544         case PF_8R8G8B:
545            return flat_8R8G8B_line;
546         case PF_8R8G8B24:
547            return flat_8R8G8B24_line;
548         case PF_5R6G5B:
549            return flat_5R6G5B_line;
550         case PF_Dither_5R6G5B:
551            return flat_DITHER_5R6G5B_line;
552         case PF_Dither:
553            return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL;
554         case PF_Lookup:
555            return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL;
556         case PF_HPCR:
557            return flat_HPCR_line;
558	 default:
559	    return (swrast_line_func)NULL;
560      }
561   }
562
563   return (swrast_line_func) NULL;
564}
565
566/* Override for the swrast line-selection function.  Try to use one
567 * of our internal line functions, otherwise fall back to the
568 * standard swrast functions.
569 */
570void xmesa_choose_line( GLcontext *ctx )
571{
572   SWcontext *swrast = SWRAST_CONTEXT(ctx);
573
574   if (!(swrast->Line = get_line_func( ctx )))
575      _swrast_choose_line( ctx );
576}
577