diff options
author | Brian Paul <[email protected]> | 2002-11-14 03:48:03 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-11-14 03:48:03 +0000 |
commit | 22a47c5251ee7b91dc8f7f4f7dbeb3ad5a117b70 (patch) | |
tree | 932537a4b6ba815fbd2189b706594f82c89a5148 /src/mesa/drivers | |
parent | 483982458717a285e18ff86b3a69250c7f507948 (diff) |
Overhaul of line drawing template code. Make better use of sw_span mechanism.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/osmesa/osmesa.c | 217 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 254 |
2 files changed, 111 insertions, 360 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 2699890186a..09d52073ed7 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,8 +1,8 @@ -/* $Id: osmesa.c,v 1.97 2002/11/13 16:57:44 brianp Exp $ */ +/* $Id: osmesa.c,v 1.98 2002/11/14 03:48:03 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 5.0 + * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -393,14 +393,12 @@ do { \ /* * Draw a flat-shaded, RGB line into an osmesa buffer. */ -static void -flat_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) -{ - const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); +#define NAME flat_rgba_line +#define CLIP_HACK 1 +#define SETUP_CODE \ + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \ const GLchan *color = vert1->color; -#define INTERP_XY 1 -#define CLIP_HACK 1 #define PLOT(X, Y) \ do { \ GLchan *p = PIXELADDR4(X, Y); \ @@ -412,22 +410,20 @@ do { \ #else #include "swrast/s_linetemp.h" #endif -} + /* * Draw a flat-shaded, Z-less, RGB line into an osmesa buffer. */ -static void -flat_rgba_z_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) -{ - const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); - const GLchan *color = vert1->color; - -#define INTERP_XY 1 +#define NAME flat_rgba_z_line +#define CLIP_HACK 1 #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define CLIP_HACK 1 +#define SETUP_CODE \ + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); \ + const GLchan *color = vert1->color; + #define PLOT(X, Y) \ do { \ if (Z < *zPtr) { \ @@ -438,167 +434,13 @@ do { \ } \ } while (0) - #ifdef WIN32 #include "..\swrast\s_linetemp.h" #else #include "swrast/s_linetemp.h" #endif -} -/* - * Draw a flat-shaded, alpha-blended, RGB line into an osmesa buffer. - * XXX update for GLchan - */ -static void -flat_blend_rgba_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); - const GLint rshift = osmesa->rshift; - const GLint gshift = osmesa->gshift; - const GLint bshift = osmesa->bshift; - const GLint avalue = vert0->color[3]; - const GLint msavalue = CHAN_MAX - avalue; - const GLint rvalue = vert1->color[0]*avalue; - const GLint gvalue = vert1->color[1]*avalue; - const GLint bvalue = vert1->color[2]*avalue; - -#define INTERP_XY 1 -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - { GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ - GLuint pixel = 0; \ - pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift);\ - pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift);\ - pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift);\ - *ptr4 = pixel; \ - } - -#if 0 /* XXX use this in the future */ -#define PLOT(X,Y) \ - { \ - GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ - pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ - pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ - pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ - pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ - } -#endif - -#ifdef WIN32 -#include "..\swrast\s_linetemp.h" -#else -#include "swrast/s_linetemp.h" -#endif -} - - -/* - * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. - * But don't write to Z buffer. - * XXX update for GLchan - */ -static void -flat_blend_rgba_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); - const GLint rshift = osmesa->rshift; - const GLint gshift = osmesa->gshift; - const GLint bshift = osmesa->bshift; - const GLint avalue = vert0->color[3]; - const GLint msavalue = 256 - avalue; - const GLint rvalue = vert1->color[0]*avalue; - const GLint gvalue = vert1->color[1]*avalue; - const GLint bvalue = vert1->color[2]*avalue; - -#define INTERP_XY 1 -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ - GLuint pixel = 0; \ - pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ - pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ - pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ - *ptr4 = pixel; \ - } - -#if 0 /* XXX use this in the future */ -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ - pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ - pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ - pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ - pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ - } -#endif - -#ifdef WIN32 -#include "..\swrast\s_linetemp.h" -#else -#include "swrast/s_linetemp.h" -#endif -} - - -/* - * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. - * XXX update for GLchan - */ -static void -flat_blend_rgba_z_line_write( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); - const GLint rshift = osmesa->rshift; - const GLint gshift = osmesa->gshift; - const GLint bshift = osmesa->bshift; - const GLint avalue = vert0->color[3]; - const GLint msavalue = 256 - avalue; - const GLint rvalue = vert1->color[0]*avalue; - const GLint gvalue = vert1->color[1]*avalue; - const GLint bvalue = vert1->color[2]*avalue; - -#define INTERP_XY 1 -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - GLuint *ptr4 = (GLuint *) PIXELADDR4(X, Y); \ - GLuint pixel = 0; \ - pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ - pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ - pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ - *ptr4 = pixel; \ - *zPtr = Z; \ - } - -#if 0 /* XXX use this in the future */ -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - GLchan *pixel = (GLchan *) PIXELADDR4(X, Y); \ - pixel[rInd] = (pixel[rInd] * msavalue + rvalue) >> CHAN_BITS; \ - pixel[gInd] = (pixel[gInd] * msavalue + gvalue) >> CHAN_BITS; \ - pixel[bInd] = (pixel[bInd] * msavalue + bvalue) >> CHAN_BITS; \ - pixel[aInd] = (pixel[aInd] * msavalue + avalue) >> CHAN_BITS; \ - *zPtr = Z; \ - } -#endif - -#ifdef WIN32 -#include "..\swrast\s_linetemp.h" -#else -#include "swrast/s_linetemp.h" -#endif -} - /* * Analyze context state to see if we can provide a fast line drawing @@ -633,39 +475,6 @@ osmesa_choose_line_function( GLcontext *ctx ) return (swrast_line_func) flat_rgba_line; } - if (swrast->_RasterMask==(DEPTH_BIT|BLEND_BIT) - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS - && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA - && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendSrcA==GL_SRC_ALPHA - && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { - return (swrast_line_func) flat_blend_rgba_z_line_write; - } - - if (swrast->_RasterMask==(DEPTH_BIT|BLEND_BIT) - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_FALSE - && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS - && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA - && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendSrcA==GL_SRC_ALPHA - && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { - return (swrast_line_func) flat_blend_rgba_z_line; - } - - if (swrast->_RasterMask==BLEND_BIT - && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA - && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendSrcA==GL_SRC_ALPHA - && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA - && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { - return (swrast_line_func) flat_blend_rgba_line; - } - return (swrast_line_func) NULL; } diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 989969d024d..55cc5c7790b 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -1,10 +1,10 @@ -/* $Id: xm_line.c,v 1.20 2002/06/15 03:03:10 brianp Exp $ */ +/* $Id: xm_line.c,v 1.21 2002/11/14 03:48:03 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.1 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -123,73 +123,60 @@ void xmesa_choose_point( GLcontext *ctx ) /* * Draw a flat-shaded, PF_TRUECOLOR line into an XImage. */ -static void flat_TRUECOLOR_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - XMesaImage *img = xmesa->xm_buffer->backimage; - unsigned long pixel; +#define NAME flat_TRUECOLOR_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + XMesaImage *img = xmesa->xm_buffer->backimage; \ + unsigned long pixel; \ PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); - -#define INTERP_XY 1 #define CLIP_HACK 1 #define PLOT(X,Y) XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel ); - #include "swrast/s_linetemp.h" -} /* * Draw a flat-shaded, PF_8A8B8G8R line into an XImage. */ -static void flat_8A8B8G8R_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_8A8B8G8R_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); - #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_8R8G8B line into an XImage. */ -static void flat_8R8G8B_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_8R8G8B_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); - #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_8R8G8B24 line into an XImage. */ -static void flat_8R8G8B24_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; +#define NAME flat_8R8G8B24_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ const GLubyte *color = vert1->color; - #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) @@ -199,130 +186,109 @@ static void flat_8R8G8B24_line( GLcontext *ctx, pixelPtr->g = color[GCOMP]; \ pixelPtr->b = color[BCOMP]; \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_5R6G5B line into an XImage. */ -static void flat_5R6G5B_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_5R6G5B_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); - #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage. */ -static void flat_DITHER_5R6G5B_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; +#define NAME flat_DITHER_5R6G5B_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ const GLubyte *color = vert1->color; - #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) PACK_TRUEDITHER( *pixelPtr, X, Y, color[0], color[1], color[2] ); - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage. */ -static void flat_DITHER8_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - GLint r = color[0], g = color[1], b = color[2]; +#define NAME flat_DITHER8_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + GLint r = color[0], g = color[1], b = color[2]; \ DITHER_SETUP; - -#define INTERP_XY 1 #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b); - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage. */ -static void flat_LOOKUP8_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - GLubyte pixel; - LOOKUP_SETUP; +#define NAME flat_LOOKUP8_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + GLubyte pixel; \ + LOOKUP_SETUP; \ pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); - #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, PF_HPCR line into an XImage. */ -static void flat_HPCR_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_HPCR_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; - -#define INTERP_XY 1 #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b); - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage. */ -static void flat_TRUECOLOR_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - XMesaImage *img = xmesa->xm_buffer->backimage; - unsigned long pixel; +#define NAME flat_TRUECOLOR_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + XMesaImage *img = xmesa->xm_buffer->backimage; \ + unsigned long pixel; \ PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); - -#define INTERP_XY 1 #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define CLIP_HACK 1 @@ -331,21 +297,18 @@ static void flat_TRUECOLOR_z_line( GLcontext *ctx, *zPtr = Z; \ XMesaPutPixel( img, X, FLIP(xmesa->xm_buffer, Y), pixel ); \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage. */ -static void flat_8A8B8G8R_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_8A8B8G8R_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint @@ -357,21 +320,18 @@ static void flat_8A8B8G8R_z_line( GLcontext *ctx, *zPtr = Z; \ *pixelPtr = pixel; \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage. */ -static void flat_8R8G8B_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_8R8G8B_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint @@ -383,20 +343,17 @@ static void flat_8R8G8B_z_line( GLcontext *ctx, *zPtr = Z; \ *pixelPtr = pixel; \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage. */ -static void flat_8R8G8B24_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; +#define NAME flat_8R8G8B24_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ const GLubyte *color = vert1->color; - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE bgr_t @@ -410,21 +367,18 @@ static void flat_8R8G8B24_z_line( GLcontext *ctx, pixelPtr->g = color[GCOMP]; \ pixelPtr->b = color[BCOMP]; \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage. */ -static void flat_5R6G5B_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_5R6G5B_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort @@ -437,18 +391,16 @@ static void flat_5R6G5B_z_line( GLcontext *ctx, *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage. */ -static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; +#define NAME flat_DITHER_5R6G5B_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ const GLubyte *color = vert1->color; - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort @@ -461,21 +413,18 @@ static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx, PACK_TRUEDITHER(*pixelPtr, X, Y, color[0], color[1], color[2]); \ } #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage. */ -static void flat_DITHER8_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - GLint r = color[0], g = color[1], b = color[2]; +#define NAME flat_DITHER8_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + GLint r = color[0], g = color[1], b = color[2]; \ DITHER_SETUP; - -#define INTERP_XY 1 #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte @@ -488,21 +437,19 @@ static void flat_DITHER8_z_line( GLcontext *ctx, *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b); \ } #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage. */ -static void flat_LOOKUP8_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; - GLubyte pixel; - LOOKUP_SETUP; +#define NAME flat_LOOKUP8_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ + GLubyte pixel; \ + LOOKUP_SETUP; \ pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte @@ -514,22 +461,18 @@ static void flat_LOOKUP8_z_line( GLcontext *ctx, *zPtr = Z; \ *pixelPtr = pixel; \ } - #include "swrast/s_linetemp.h" -} + /* * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage. */ -static void flat_HPCR_z_line( GLcontext *ctx, - const SWvertex *vert0, const SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = vert1->color; +#define NAME flat_HPCR_z_line +#define SETUP_CODE \ + XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \ + const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; - -#define INTERP_XY 1 #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte @@ -541,9 +484,8 @@ static void flat_HPCR_z_line( GLcontext *ctx, *zPtr = Z; \ *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \ } - #include "swrast/s_linetemp.h" -} + static swrast_line_func get_line_func( GLcontext *ctx ) |