From 751d7a74ca00df44dbefee628b2a305e68638479 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 14:30:20 -0600 Subject: [PATCH] Obsolete --- src/mesa/pipe/xlib/xm_line.c | 691 ----------------- src/mesa/pipe/xlib/xm_tri.c | 1694 ------------------------------------------ 2 files changed, 2385 deletions(-) delete mode 100644 src/mesa/pipe/xlib/xm_line.c delete mode 100644 src/mesa/pipe/xlib/xm_tri.c diff --git a/src/mesa/pipe/xlib/xm_line.c b/src/mesa/pipe/xlib/xm_line.c deleted file mode 100644 index deeae50..0000000 --- a/src/mesa/pipe/xlib/xm_line.c +++ /dev/null @@ -1,691 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * This file contains "accelerated" point, line, and triangle functions. - * It should be fairly easy to write new special-purpose point, line or - * triangle functions and hook them into this module. - */ - - -#include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "mtypes.h" -#include "xmesaP.h" - -/* Internal swrast includes: - */ -#include "swrast/s_depth.h" -#include "swrast/s_points.h" -#include "swrast/s_lines.h" -#include "swrast/s_context.h" - - -/**********************************************************************/ -/*** Point rendering ***/ -/**********************************************************************/ - - -/* - * Render an array of points into a pixmap, any pixel format. - */ -#if 000 -/* XXX don't use this, it doesn't dither correctly */ -static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) -{ - XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; - - if (xmesa->xm_visual->mesa_visual.RGBAflag) { - register int x, y; - const GLubyte *color = vert->color; - unsigned long pixel = xmesa_color_to_pixel( xmesa, - color[0], color[1], - color[2], color[3], - xmesa->pixelformat); - XMesaSetForeground( dpy, gc, pixel ); - x = (GLint) vert->win[0]; - y = YFLIP( xrb, (GLint) vert->win[1] ); - XMesaDrawPoint( dpy, buffer, gc, x, y); - } - else { - /* Color index mode */ - register int x, y; - XMesaSetForeground( dpy, gc, vert->index ); - x = (GLint) vert->win[0]; - y = YFLIP( xrb, (GLint) vert->win[1] ); - XMesaDrawPoint( dpy, buffer, gc, x, y); - } -} -#endif - - -/* Override the swrast point-selection function. Try to use one of - * our internal point functions, otherwise fall back to the standard - * swrast functions. - */ -void xmesa_choose_point( GLcontext *ctx ) -{ -#if 0 - XMesaContext xmesa = XMESA_CONTEXT(ctx); - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - if (ctx->RenderMode == GL_RENDER - && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag - && swrast->_RasterMask == 0 - && !ctx->Texture._EnabledUnits - && xmesa->xm_buffer->buffer != XIMAGE) { - swrast->Point = draw_points_ANY_pixmap; - } - else { - _swrast_choose_point( ctx ); - } -#else - _swrast_choose_point( ctx ); -#endif -} - - - -/**********************************************************************/ -/*** Line rendering ***/ -/**********************************************************************/ - - -#if CHAN_BITS == 8 - - -#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) - - -/* - * Draw a flat-shaded, PF_TRUECOLOR line into an XImage. - */ -#define NAME flat_TRUECOLOR_line -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - unsigned long pixel; \ - PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); -#define CLIP_HACK 1 -#define PLOT(X,Y) XMesaPutPixel(xrb->ximage, X, YFLIP(xrb, Y), pixel ); -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, PF_8A8B8G8R line into an XImage. - */ -#define NAME flat_8A8B8G8R_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]); -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) *pixelPtr = pixel; -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, PF_8A8R8G8B line into an XImage. - */ -#define NAME flat_8A8R8G8B_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]); -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, 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. - */ -#define NAME flat_8R8G8B_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, 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. - */ -#define NAME flat_8R8G8B24_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) { \ - pixelPtr->r = color[RCOMP]; \ - pixelPtr->g = color[GCOMP]; \ - pixelPtr->b = color[BCOMP]; \ -} -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, PF_5R6G5B line into an XImage. - */ -#define NAME flat_5R6G5B_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, 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. - */ -#define NAME flat_DITHER_5R6G5B_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, 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. - */ -#define NAME flat_DITHER8_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; \ - DITHER_SETUP; -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, 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. - */ -#define NAME flat_LOOKUP8_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - 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 (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, 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. - */ -#define NAME flat_HPCR_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, 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. - */ -#define NAME flat_TRUECOLOR_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; \ - unsigned long pixel; \ - PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - XMesaPutPixel(xrb->ximage, X, YFLIP(xrb, Y), pixel); \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage. - */ -#define NAME flat_8A8B8G8R_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]); -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_8A8R8G8B line into an XImage. - */ -#define NAME flat_8A8R8G8B_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]); -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage. - */ -#define NAME flat_8R8G8B_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - 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 -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage. - */ -#define NAME flat_8R8G8B24_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - pixelPtr->r = color[RCOMP]; \ - 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. - */ -#define NAME flat_5R6G5B_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - 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 -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage. - */ -#define NAME flat_DITHER_5R6G5B_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - 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. - */ -#define NAME flat_DITHER8_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; \ - DITHER_SETUP; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *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. - */ -#define NAME flat_LOOKUP8_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - 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 -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage. - */ -#define NAME flat_HPCR_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \ - } -#include "swrast/s_linetemp.h" - - - - -#ifndef XFree86Server -/** - * Draw fast, XOR line with XDrawLine in front color buffer. - * WARNING: this isn't fully OpenGL conformant because different pixels - * will be hit versus using the other line functions. - * Don't use the code in X server GLcore module since we need a wrapper - * for the XSetLineAttributes() function call. - */ -static void -xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) -{ - XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaGC gc = xmesa->xm_buffer->gc; - GET_XRB(xrb); - unsigned long pixel = xmesa_color_to_pixel(ctx, - vert1->color[0], vert1->color[1], - vert1->color[2], vert1->color[3], - xmesa->pixelformat); - int x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; - int y0 = YFLIP(xrb, (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]); - int x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; - int y1 = YFLIP(xrb, (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]); - XMesaSetForeground(dpy, gc, pixel); - XMesaSetFunction(dpy, gc, GXxor); - XSetLineAttributes(dpy, gc, (int) ctx->Line.Width, - LineSolid, CapButt, JoinMiter); - XDrawLine(dpy, xrb->pixmap, gc, x0, y0, x1, y1); - XMesaSetFunction(dpy, gc, GXcopy); /* this gc is used elsewhere */ -} -#endif /* XFree86Server */ - - -#endif /* CHAN_BITS == 8 */ - - -/** - * Return pointer to line drawing function, or NULL if we should use a - * swrast fallback. - */ -static swrast_line_func -get_line_func(GLcontext *ctx) -{ -#if CHAN_BITS == 8 - SWcontext *swrast = SWRAST_CONTEXT(ctx); - XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); - const struct xmesa_renderbuffer *xrb; - - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) - return (swrast_line_func) NULL; - if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL; - if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL; - if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL; - if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL; - if (ctx->Line.StippleFlag) return (swrast_line_func) NULL; - if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; - if (xmbuf->swAlpha) return (swrast_line_func) NULL; - - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - - if (xrb->ximage - && swrast->_RasterMask==DEPTH_BIT - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS - && ctx->Line.Width==1.0F) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - return flat_TRUECOLOR_z_line; - case PF_8A8B8G8R: - return flat_8A8B8G8R_z_line; - case PF_8A8R8G8B: - return flat_8A8R8G8B_z_line; - case PF_8R8G8B: - return flat_8R8G8B_z_line; - case PF_8R8G8B24: - return flat_8R8G8B24_z_line; - case PF_5R6G5B: - return flat_5R6G5B_z_line; - case PF_Dither_5R6G5B: - return flat_DITHER_5R6G5B_z_line; - case PF_Dither: - return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL; - case PF_Lookup: - return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL; - case PF_HPCR: - return flat_HPCR_z_line; - default: - return (swrast_line_func)NULL; - } - } - if (xrb->ximage - && swrast->_RasterMask==0 - && ctx->Line.Width==1.0F) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - return flat_TRUECOLOR_line; - case PF_8A8B8G8R: - return flat_8A8B8G8R_line; - case PF_8A8R8G8B: - return flat_8A8R8G8B_line; - case PF_8R8G8B: - return flat_8R8G8B_line; - case PF_8R8G8B24: - return flat_8R8G8B24_line; - case PF_5R6G5B: - return flat_5R6G5B_line; - case PF_Dither_5R6G5B: - return flat_DITHER_5R6G5B_line; - case PF_Dither: - return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL; - case PF_Lookup: - return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL; - case PF_HPCR: - return flat_HPCR_line; - default: - return (swrast_line_func)NULL; - } - } - -#ifndef XFree86Server - if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1 - && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT - && swrast->_RasterMask == LOGIC_OP_BIT - && ctx->Color.LogicOp == GL_XOR - && !ctx->Line.StippleFlag - && !ctx->Line.SmoothFlag) { - return xor_line; - } -#endif /* XFree86Server */ - -#endif /* CHAN_BITS == 8 */ - return (swrast_line_func) NULL; -} - - -/** - * Override for the swrast line-selection function. Try to use one - * of our internal line functions, otherwise fall back to the - * standard swrast functions. - */ -void -xmesa_choose_line(GLcontext *ctx) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - if (!(swrast->Line = get_line_func( ctx ))) - _swrast_choose_line( ctx ); -} diff --git a/src/mesa/pipe/xlib/xm_tri.c b/src/mesa/pipe/xlib/xm_tri.c deleted file mode 100644 index 9f17083..0000000 --- a/src/mesa/pipe/xlib/xm_tri.c +++ /dev/null @@ -1,1694 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2006 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"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * This file contains "accelerated" triangle functions. It should be - * fairly easy to write new special-purpose triangle functions and hook - * them into this module. - */ - - -#include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "xmesaP.h" - -/* Internal swrast includes: - */ -#include "swrast/s_context.h" -#include "swrast/s_depth.h" -#include "swrast/s_triangle.h" - - -#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) - - -/**********************************************************************/ -/*** Triangle rendering ***/ -/**********************************************************************/ - - -#if CHAN_BITS == 8 - -/* - * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle. - */ -#define NAME smooth_TRUECOLOR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); - -#define RENDER_SPAN( span ) \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - GLuint i; \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p; \ - PACK_TRUECOLOR(p, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(xrb->ximage, x, y, p); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } - -#include "swrast/s_tritemp.h" - - - - -/* - * XImage, smooth, depth-buffered, PF_8A8B8G8R triangle. - */ -#define NAME smooth_8A8B8G8R_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = PACK_8A8B8G8R(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue), \ - FixedToInt(span.alpha)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - span.z += span.zStep; \ - } - -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_8A8R8G8B triangle. - */ -#define NAME smooth_8A8R8G8B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); - -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = PACK_8A8R8G8B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue), \ - FixedToInt(span.alpha)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - span.z += span.zStep; \ - } - -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_8R8G8B triangle. - */ -#define NAME smooth_8R8G8B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); - -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } - -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_8R8G8B24 triangle. - */ -#define NAME smooth_8R8G8B24_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - PIXEL_TYPE *ptr = pRow + i; \ - ptr->r = FixedToInt(span.red); \ - ptr->g = FixedToInt(span.green); \ - ptr->b = FixedToInt(span.blue); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_TRUEDITHER triangle. - */ -#define NAME smooth_TRUEDITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p; \ - PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(xrb->ximage, x, y, p); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_5R6G5B triangle. - */ -#define NAME smooth_5R6G5B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = PACK_5R6G5B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_DITHER_5R6G5B triangle. - */ -#define NAME smooth_DITHER_5R6G5B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle. - */ -#define NAME smooth_DITHER8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_DITHER triangle. - */ -#define NAME smooth_DITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p = XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(img, x, y, p); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME smooth_LOOKUP8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - LOOKUP_SETUP; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = LOOKUP(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME smooth_HPCR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_TRUECOLOR triangle. - */ -#define NAME flat_TRUECOLOR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - unsigned long pixel; \ - PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - XMesaPutPixel(img, x, y, pixel); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_8A8B8G8R triangle. - */ -#define NAME flat_8A8B8G8R_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - GLuint p = PACK_8A8B8G8R( v2->color[0], v2->color[1],\ - v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_8A8R8G8B triangle. - */ -#define NAME flat_8A8R8G8B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - GLuint p = PACK_8A8R8G8B(v2->color[0], v2->color[1], \ - v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_8R8G8B triangle. - */ -#define NAME flat_8R8G8B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - GLuint p = PACK_8R8G8B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } - -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_8R8G8B24 triangle. - */ -#define NAME flat_8R8G8B24_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - PIXEL_TYPE *ptr = pRow + i; \ - ptr->r = color[RCOMP]; \ - ptr->g = color[GCOMP]; \ - ptr->b = color[BCOMP]; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_TRUEDITHER triangle. - */ -#define NAME flat_TRUEDITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p; \ - PACK_TRUEDITHER(p, x, y, v2->color[0], \ - v2->color[1], v2->color[2]); \ - XMesaPutPixel(img, x, y, p); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_5R6G5B triangle. - */ -#define NAME flat_5R6G5B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - GLushort p = PACK_5R6G5B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_DITHER_5R6G5B triangle. - */ -#define NAME flat_DITHER_5R6G5B_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ - color[GCOMP], color[BCOMP]); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME flat_DITHER8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_DITHER triangle. - */ -#define NAME flat_DITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p = FLAT_DITHER(x); \ - XMesaPutPixel(img, x, y, p); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME flat_HPCR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME flat_LOOKUP8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - LOOKUP_SETUP; \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; \ - GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle. - */ -#define NAME smooth_TRUECOLOR_triangle -#define INTERP_RGB 1 -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p; \ - PACK_TRUECOLOR(p, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(img, x, y, p); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_8A8B8G8R triangle. - */ -#define NAME smooth_8A8B8G8R_triangle -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = PACK_8A8B8G8R(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue), \ - FixedToInt(span.alpha)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_8A8R8G8B triangle. - */ -#define NAME smooth_8A8R8G8B_triangle -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = PACK_8A8R8G8B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue), \ - FixedToInt(span.alpha)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. - */ -#define NAME smooth_8R8G8B_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. - */ -#define NAME smooth_8R8G8B24_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - PIXEL_TYPE *pixel = pRow; \ - for (i = 0; i < span.end; i++, pixel++) { \ - pixel->r = FixedToInt(span.red); \ - pixel->g = FixedToInt(span.green); \ - pixel->b = FixedToInt(span.blue); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_TRUEDITHER triangle. - */ -#define NAME smooth_TRUEDITHER_triangle -#define INTERP_RGB 1 -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p; \ - PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(img, x, y, p ); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_5R6G5B triangle. - */ -#define NAME smooth_5R6G5B_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_DITHER_5R6G5B triangle. - */ -#define NAME smooth_DITHER_5R6G5B_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME smooth_DITHER8_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_DITHER triangle. - */ -#define NAME smooth_DITHER_triangle -#define INTERP_RGB 1 -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p = XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - XMesaPutPixel(img, x, y, p); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME smooth_LOOKUP8_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - LOOKUP_SETUP; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = LOOKUP(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME smooth_HPCR_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle. - */ -#define NAME flat_TRUECOLOR_triangle -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - unsigned long pixel; \ - PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - XMesaPutPixel(img, x, y, pixel); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle. - */ -#define NAME flat_8A8B8G8R_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - unsigned long p = PACK_8B8G8R( v2->color[0], \ - v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_8A8R8G8B triangle. - */ -#define NAME flat_8A8R8G8B_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - unsigned long p = PACK_8R8G8B( v2->color[0], \ - v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_8R8G8B triangle. - */ -#define NAME flat_8R8G8B_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) -#define PIXEL_TYPE GLuint -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - unsigned long p = PACK_8R8G8B( v2->color[0], \ - v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle. - */ -#define NAME flat_8R8G8B24_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) -#define PIXEL_TYPE bgr_t -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ - GLuint i; \ - PIXEL_TYPE *pixel = pRow; \ - for (i = 0; i < span.end; i++, pixel++) { \ - pixel->r = color[RCOMP]; \ - pixel->g = color[GCOMP]; \ - pixel->b = color[BCOMP]; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_TRUEDITHER triangle. - */ -#define NAME flat_TRUEDITHER_triangle -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p; \ - PACK_TRUEDITHER(p, x, y, v2->color[0], \ - v2->color[1], v2->color[2] ); \ - XMesaPutPixel(img, x, y, p); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_5R6G5B triangle. - */ -#define NAME flat_5R6G5B_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - unsigned long p = PACK_5R6G5B( v2->color[0], \ - v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle. - */ -#define NAME flat_DITHER_5R6G5B_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) -#define PIXEL_TYPE GLushort -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ - color[GCOMP], color[BCOMP]); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME flat_DITHER8_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_DITHER triangle. - */ -#define NAME flat_DITHER_triangle -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p = FLAT_DITHER(x); \ - XMesaPutPixel(img, x, y, p ); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME flat_HPCR_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME flat_LOOKUP8_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - LOOKUP_SETUP; \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; \ - GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } -#include "swrast/s_tritemp.h" - - -#endif /* CHAN_BITS == 8 */ - - -#if defined(DEBUG) && CHAN_BITS == 8 -extern void _xmesa_print_triangle_func( swrast_tri_func triFunc ); -void _xmesa_print_triangle_func( swrast_tri_func triFunc ) -{ - _mesa_printf("XMesa tri func = "); - if (triFunc ==smooth_TRUECOLOR_z_triangle) - _mesa_printf("smooth_TRUECOLOR_z_triangle\n"); - else if (triFunc ==smooth_8A8B8G8R_z_triangle) - _mesa_printf("smooth_8A8B8G8R_z_triangle\n"); - else if (triFunc ==smooth_8A8R8G8B_z_triangle) - _mesa_printf("smooth_8A8R8G8B_z_triangle\n"); - else if (triFunc ==smooth_8R8G8B_z_triangle) - _mesa_printf("smooth_8R8G8B_z_triangle\n"); - else if (triFunc ==smooth_8R8G8B24_z_triangle) - _mesa_printf("smooth_8R8G8B24_z_triangle\n"); - else if (triFunc ==smooth_TRUEDITHER_z_triangle) - _mesa_printf("smooth_TRUEDITHER_z_triangle\n"); - else if (triFunc ==smooth_5R6G5B_z_triangle) - _mesa_printf("smooth_5R6G5B_z_triangle\n"); - else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle) - _mesa_printf("smooth_DITHER_5R6G5B_z_triangle\n"); - else if (triFunc ==smooth_HPCR_z_triangle) - _mesa_printf("smooth_HPCR_z_triangle\n"); - else if (triFunc ==smooth_DITHER8_z_triangle) - _mesa_printf("smooth_DITHER8_z_triangle\n"); - else if (triFunc ==smooth_LOOKUP8_z_triangle) - _mesa_printf("smooth_LOOKUP8_z_triangle\n"); - else if (triFunc ==flat_TRUECOLOR_z_triangle) - _mesa_printf("flat_TRUECOLOR_z_triangle\n"); - else if (triFunc ==flat_8A8B8G8R_z_triangle) - _mesa_printf("flat_8A8B8G8R_z_triangle\n"); - else if (triFunc ==flat_8A8R8G8B_z_triangle) - _mesa_printf("flat_8A8R8G8B_z_triangle\n"); - else if (triFunc ==flat_8R8G8B_z_triangle) - _mesa_printf("flat_8R8G8B_z_triangle\n"); - else if (triFunc ==flat_8R8G8B24_z_triangle) - _mesa_printf("flat_8R8G8B24_z_triangle\n"); - else if (triFunc ==flat_TRUEDITHER_z_triangle) - _mesa_printf("flat_TRUEDITHER_z_triangle\n"); - else if (triFunc ==flat_5R6G5B_z_triangle) - _mesa_printf("flat_5R6G5B_z_triangle\n"); - else if (triFunc ==flat_DITHER_5R6G5B_z_triangle) - _mesa_printf("flat_DITHER_5R6G5B_z_triangle\n"); - else if (triFunc ==flat_HPCR_z_triangle) - _mesa_printf("flat_HPCR_z_triangle\n"); - else if (triFunc ==flat_DITHER8_z_triangle) - _mesa_printf("flat_DITHER8_z_triangle\n"); - else if (triFunc ==flat_LOOKUP8_z_triangle) - _mesa_printf("flat_LOOKUP8_z_triangle\n"); - else if (triFunc ==smooth_TRUECOLOR_triangle) - _mesa_printf("smooth_TRUECOLOR_triangle\n"); - else if (triFunc ==smooth_8A8B8G8R_triangle) - _mesa_printf("smooth_8A8B8G8R_triangle\n"); - else if (triFunc ==smooth_8A8R8G8B_triangle) - _mesa_printf("smooth_8A8R8G8B_triangle\n"); - else if (triFunc ==smooth_8R8G8B_triangle) - _mesa_printf("smooth_8R8G8B_triangle\n"); - else if (triFunc ==smooth_8R8G8B24_triangle) - _mesa_printf("smooth_8R8G8B24_triangle\n"); - else if (triFunc ==smooth_TRUEDITHER_triangle) - _mesa_printf("smooth_TRUEDITHER_triangle\n"); - else if (triFunc ==smooth_5R6G5B_triangle) - _mesa_printf("smooth_5R6G5B_triangle\n"); - else if (triFunc ==smooth_DITHER_5R6G5B_triangle) - _mesa_printf("smooth_DITHER_5R6G5B_triangle\n"); - else if (triFunc ==smooth_HPCR_triangle) - _mesa_printf("smooth_HPCR_triangle\n"); - else if (triFunc ==smooth_DITHER8_triangle) - _mesa_printf("smooth_DITHER8_triangle\n"); - else if (triFunc ==smooth_LOOKUP8_triangle) - _mesa_printf("smooth_LOOKUP8_triangle\n"); - else if (triFunc ==flat_TRUECOLOR_triangle) - _mesa_printf("flat_TRUECOLOR_triangle\n"); - else if (triFunc ==flat_TRUEDITHER_triangle) - _mesa_printf("flat_TRUEDITHER_triangle\n"); - else if (triFunc ==flat_8A8B8G8R_triangle) - _mesa_printf("flat_8A8B8G8R_triangle\n"); - else if (triFunc ==flat_8A8R8G8B_triangle) - _mesa_printf("flat_8A8R8G8B_triangle\n"); - else if (triFunc ==flat_8R8G8B_triangle) - _mesa_printf("flat_8R8G8B_triangle\n"); - else if (triFunc ==flat_8R8G8B24_triangle) - _mesa_printf("flat_8R8G8B24_triangle\n"); - else if (triFunc ==flat_5R6G5B_triangle) - _mesa_printf("flat_5R6G5B_triangle\n"); - else if (triFunc ==flat_DITHER_5R6G5B_triangle) - _mesa_printf("flat_DITHER_5R6G5B_triangle\n"); - else if (triFunc ==flat_HPCR_triangle) - _mesa_printf("flat_HPCR_triangle\n"); - else if (triFunc ==flat_DITHER8_triangle) - _mesa_printf("flat_DITHER8_triangle\n"); - else if (triFunc ==flat_LOOKUP8_triangle) - _mesa_printf("flat_LOOKUP8_triangle\n"); - else - _mesa_printf("???\n"); -} -#endif - - -#ifdef DEBUG - -/* record the current triangle function name */ -static const char *triFuncName = NULL; - -#define USE(triFunc) \ -do { \ - triFuncName = #triFunc; \ - return triFunc; \ -} while (0) - -#else - -#define USE(triFunc) return triFunc - -#endif - - -#if 0 -GLboolean xmesa_get_cbuf_details( GLcontext *ctx, - void **ptr, - GLuint *cpp, - GLint *stride, - GLuint *format ) -{ - XMesaContext xmesa = XMESA_CONTEXT(ctx); - struct gl_framebuffer *fb = ctx->DrawBuffer; - struct gl_renderbuffer *crb = fb->_ColorDrawBuffers[0][0]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(crb->Wrapped); - - *ptr = crb->GetPointer(ctx, crb, 0, 0); - *stride = ((GLubyte *)crb->GetPointer(ctx, crb, 0, 1) - - (GLubyte *)crb->GetPointer(ctx, crb, 0, 0)); - - if (!ptr) - goto bad; - - switch (xmesa->pixelformat) { - case PF_8A8B8G8R: - case PF_8A8R8G8B: - *format = 1; /* whatever */ - *cpp = 4; - break; - default: - goto bad; - } - - return GL_TRUE; - - bad: - *ptr = NULL; - *stride = 0; - *format = 0; - return GL_FALSE; -} -#endif - - -/** - * Return pointer to line drawing function, or NULL if we should use a - * swrast fallback. - */ -static swrast_tri_func -get_triangle_func(GLcontext *ctx) -{ -#if CHAN_BITS == 8 - SWcontext *swrast = SWRAST_CONTEXT(ctx); - XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); - const struct xmesa_renderbuffer *xrb; - -#ifdef DEBUG - triFuncName = NULL; -#endif - - /* trivial fallback tests */ - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) - return (swrast_tri_func) NULL; - if (ctx->RenderMode != GL_RENDER) - return (swrast_tri_func) NULL; - if (ctx->Polygon.SmoothFlag) - return (swrast_tri_func) NULL; - if (ctx->Texture._EnabledUnits) - return (swrast_tri_func) NULL; - if (swrast->_RasterMask & MULTI_DRAW_BIT) - return (swrast_tri_func) NULL; - if (ctx->Polygon.CullFlag && - ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) - return (swrast_tri_func) NULL; - if (xmbuf->swAlpha) - return (swrast_tri_func) NULL; - - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - - if (xrb->ximage) { - if ( ctx->Light.ShadeModel==GL_SMOOTH - && swrast->_RasterMask==DEPTH_BIT - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS - && ctx->Polygon.StippleFlag==GL_FALSE) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - USE(smooth_TRUECOLOR_z_triangle); - case PF_8A8B8G8R: - USE(smooth_8A8B8G8R_z_triangle); - case PF_8A8R8G8B: - USE(smooth_8A8R8G8B_z_triangle); - case PF_8R8G8B: - USE(smooth_8R8G8B_z_triangle); - case PF_8R8G8B24: - USE(smooth_8R8G8B24_z_triangle); - case PF_Dither_True: - USE(smooth_TRUEDITHER_z_triangle); - case PF_5R6G5B: - USE(smooth_5R6G5B_z_triangle); - case PF_Dither_5R6G5B: - USE(smooth_DITHER_5R6G5B_z_triangle); - case PF_HPCR: - USE(smooth_HPCR_z_triangle); - case PF_Dither: - if (depth == 8) - USE(smooth_DITHER8_z_triangle); - else - USE(smooth_DITHER_z_triangle); - case PF_Lookup: - if (depth == 8) - USE(smooth_LOOKUP8_z_triangle); - else - return (swrast_tri_func) NULL; - default: - return (swrast_tri_func) NULL; - } - } - if ( ctx->Light.ShadeModel==GL_FLAT - && swrast->_RasterMask==DEPTH_BIT - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS - && ctx->Polygon.StippleFlag==GL_FALSE) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - USE(flat_TRUECOLOR_z_triangle); - case PF_8A8B8G8R: - USE(flat_8A8B8G8R_z_triangle); - case PF_8A8R8G8B: - USE(flat_8A8R8G8B_z_triangle); - case PF_8R8G8B: - USE(flat_8R8G8B_z_triangle); - case PF_8R8G8B24: - USE(flat_8R8G8B24_z_triangle); - case PF_Dither_True: - USE(flat_TRUEDITHER_z_triangle); - case PF_5R6G5B: - USE(flat_5R6G5B_z_triangle); - case PF_Dither_5R6G5B: - USE(flat_DITHER_5R6G5B_z_triangle); - case PF_HPCR: - USE(flat_HPCR_z_triangle); - case PF_Dither: - if (depth == 8) - USE(flat_DITHER8_z_triangle); - else - USE(flat_DITHER_z_triangle); - case PF_Lookup: - if (depth == 8) - USE(flat_LOOKUP8_z_triangle); - else - return (swrast_tri_func) NULL; - default: - return (swrast_tri_func) NULL; - } - } - if ( swrast->_RasterMask==0 /* no depth test */ - && ctx->Light.ShadeModel==GL_SMOOTH - && ctx->Polygon.StippleFlag==GL_FALSE) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - USE(smooth_TRUECOLOR_triangle); - case PF_8A8B8G8R: - USE(smooth_8A8B8G8R_triangle); - case PF_8A8R8G8B: - USE(smooth_8A8R8G8B_triangle); - case PF_8R8G8B: - USE(smooth_8R8G8B_triangle); - case PF_8R8G8B24: - USE(smooth_8R8G8B24_triangle); - case PF_Dither_True: - USE(smooth_TRUEDITHER_triangle); - case PF_5R6G5B: - USE(smooth_5R6G5B_triangle); - case PF_Dither_5R6G5B: - USE(smooth_DITHER_5R6G5B_triangle); - case PF_HPCR: - USE(smooth_HPCR_triangle); - case PF_Dither: - if (depth == 8) - USE(smooth_DITHER8_triangle); - else - USE(smooth_DITHER_triangle); - case PF_Lookup: - if (depth == 8) - USE(smooth_LOOKUP8_triangle); - else - return (swrast_tri_func) NULL; - default: - return (swrast_tri_func) NULL; - } - } - - if ( swrast->_RasterMask==0 /* no depth test */ - && ctx->Light.ShadeModel==GL_FLAT - && ctx->Polygon.StippleFlag==GL_FALSE) { - switch (xmesa->pixelformat) { - case PF_Truecolor: - USE(flat_TRUECOLOR_triangle); - case PF_Dither_True: - USE(flat_TRUEDITHER_triangle); - case PF_8A8B8G8R: - USE(flat_8A8B8G8R_triangle); - case PF_8A8R8G8B: - USE(flat_8A8R8G8B_triangle); - case PF_8R8G8B: - USE(flat_8R8G8B_triangle); - case PF_8R8G8B24: - USE(flat_8R8G8B24_triangle); - case PF_5R6G5B: - USE(flat_5R6G5B_triangle); - case PF_Dither_5R6G5B: - USE(flat_DITHER_5R6G5B_triangle); - case PF_HPCR: - USE(flat_HPCR_triangle); - case PF_Dither: - if (depth == 8) - USE(flat_DITHER8_triangle); - else - USE(flat_DITHER_triangle); - case PF_Lookup: - if (depth == 8) - USE(flat_LOOKUP8_triangle); - else - return (swrast_tri_func) NULL; - default: - return (swrast_tri_func) NULL; - } - } - } -#endif /* CHAN_BITS == 8 */ - - return (swrast_tri_func) NULL; -} - - -/* Override for the swrast tri-selection function. Try to use one - * of our internal tri functions, otherwise fall back to the - * standard swrast functions. - */ -void xmesa_choose_triangle( GLcontext *ctx ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - if (!(swrast->Triangle = get_triangle_func( ctx ))) - _swrast_choose_triangle( ctx ); -} - -- 2.7.4