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