X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fswrast%2Fs_linetemp.h;h=f9f2d2934122e748f8f6f0fbc4bcd13592bbcc0b;hb=2e5764ccf440e59fc6f8441e329c0747ef4ed57b;hp=a79badbff19b6e9a97844b7ba4d45ed4c4e3d178;hpb=e3a051e0538a605551f4d58294c94f5eb00ed07f;p=mesa.git diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index a79badbff19..f9f2d293412 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -1,21 +1,19 @@ -/* $Id: s_linetemp.h,v 1.1 2000/10/31 18:00:04 keithw Exp $ */ - /* * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * + * Version: 7.0 + * + * Copyright (C) 1999-2007 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 @@ -32,13 +30,8 @@ * * The following macros may be defined to indicate what auxillary information * must be interplated along the line: - * INTERP_Z - if defined, interpolate Z and FOG values - * INTERP_RGB - if defined, interpolate RGB values - * INTERP_SPEC - if defined, interpolate specular RGB values - * INTERP_ALPHA - if defined, interpolate Alpha values - * INTERP_INDEX - if defined, interpolate color index values - * INTERP_TEX - if defined, interpolate unit 0 texcoords - * INTERP_MULTITEX - if defined, interpolate multi-texcoords + * INTERP_Z - if defined, interpolate Z values + * INTERP_ATTRIBS - if defined, interpolate attribs (texcoords, varying, etc) * * When one can directly address pixels in the color buffer the following * macros can be defined and used to directly compute pixel addresses during @@ -55,11 +48,7 @@ * Optionally, one may provide one-time setup code * SETUP_CODE - code which is to be executed once per line * - * To enable line stippling define STIPPLE = 1 - * To enable wide lines define WIDE = 1 - * - * To actually "plot" each pixel either the PLOT macro or - * (XMAJOR_PLOT and YMAJOR_PLOT macros) must be defined... + * To actually "plot" each pixel the PLOT macro must be defined... * PLOT(X,Y) - code to plot a pixel. Example: * if (Z < *zPtr) { * *zPtr = Z; @@ -73,144 +62,65 @@ */ -/*void line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert )*/ +static void +NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - const struct vertex_buffer *VB = ctx->VB; - GLint x0 = (GLint) VB->Win.data[vert0][0]; - GLint x1 = (GLint) VB->Win.data[vert1][0]; - GLint y0 = (GLint) VB->Win.data[vert0][1]; - GLint y1 = (GLint) VB->Win.data[vert1][1]; + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + SWspan span; + GLuint interpFlags = 0; + GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; + GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; + GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]; + GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]; GLint dx, dy; -#ifdef INTERP_XY + GLint numPixels; GLint xstep, ystep; -#endif -#ifdef INTERP_Z - GLint z0, z1, dz; - const GLint depthBits = ctx->Visual.DepthBits; +#if defined(DEPTH_TYPE) + const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; -# define FixedToDepth(F) ((F) >> fixedToDepthShift) -# ifdef DEPTH_TYPE - GLint zPtrXstep, zPtrYstep; - DEPTH_TYPE *zPtr; -# endif - GLfixed fog0 = FloatToFixed(VB->FogCoordPtr->data[vert0]); - GLfixed dfog = FloatToFixed(VB->FogCoordPtr->data[vert1]) - fog0; -#endif -#ifdef INTERP_RGB - GLfixed r0 = IntToFixed(VB->ColorPtr->data[vert0][0]); - GLfixed dr = IntToFixed(VB->ColorPtr->data[vert1][0]) - r0; - GLfixed g0 = IntToFixed(VB->ColorPtr->data[vert0][1]); - GLfixed dg = IntToFixed(VB->ColorPtr->data[vert1][1]) - g0; - GLfixed b0 = IntToFixed(VB->ColorPtr->data[vert0][2]); - GLfixed db = IntToFixed(VB->ColorPtr->data[vert1][2]) - b0; -#endif -#ifdef INTERP_SPEC - GLfixed sr0 = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert0][0]) : 0; - GLfixed dsr = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert1][0]) - sr0 : 0; - GLfixed sg0 = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert0][1]) : 0; - GLfixed dsg = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert1][1]) - sg0 : 0; - GLfixed sb0 = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert0][2]) : 0; - GLfixed dsb = VB->SecondaryColorPtr->data ? IntToFixed(VB->SecondaryColorPtr->data[vert1][2]) - sb0 : 0; -#endif -#ifdef INTERP_ALPHA - GLfixed a0 = IntToFixed(VB->ColorPtr->data[vert0][3]); - GLfixed da = IntToFixed(VB->ColorPtr->data[vert1][3]) - a0; -#endif -#ifdef INTERP_INDEX - GLint i0 = VB->IndexPtr->data[vert0] << 8; - GLint di = (GLint) (VB->IndexPtr->data[vert1] << 8) - i0; -#endif -#ifdef INTERP_TEX - const GLfloat invw0 = VB->Win.data[vert0][3]; - const GLfloat invw1 = VB->Win.data[vert1][3]; - GLfloat tex[4]; - GLfloat dtex[4]; - GLfloat fragTexcoord[4]; -#endif -#ifdef INTERP_MULTITEX - const GLfloat invw0 = VB->Win.data[vert0][3]; - const GLfloat invw1 = VB->Win.data[vert1][3]; - GLfloat tex[MAX_TEXTURE_UNITS][4]; - GLfloat dtex[MAX_TEXTURE_UNITS][4]; - GLfloat fragTexcoord[MAX_TEXTURE_UNITS][4]; + struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; +#define FixedToDepth(F) ((F) >> fixedToDepthShift) + GLint zPtrXstep, zPtrYstep; + DEPTH_TYPE *zPtr; +#elif defined(INTERP_Z) + const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; #endif #ifdef PIXEL_ADDRESS PIXEL_TYPE *pixelPtr; GLint pixelXstep, pixelYstep; #endif -#ifdef WIDE - /* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */ - GLint width, min, max; - width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); - min = (width-1) / -2; - max = min + width - 1; -#endif -#ifdef INTERP_TEX - { - tex[0] = invw0 * VB->TexCoordPtr[0]->data[vert0][0]; - dtex[0] = invw1 * VB->TexCoordPtr[0]->data[vert1][0] - tex[0]; - if (VB->TexCoordPtr[0]->size > 1) { - tex[1] = invw0 * VB->TexCoordPtr[0]->data[vert0][1]; - dtex[1] = invw1 * VB->TexCoordPtr[0]->data[vert1][1] - tex[1]; - } - else { - tex[1] = 0.0; - dtex[1] = 0.0; - } - if (VB->TexCoordPtr[0]->size > 2) { - tex[2] = invw0 * VB->TexCoordPtr[0]->data[vert0][2]; - dtex[2] = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - tex[2]; - } - else { - tex[2] = 0.0; - dtex[2] = 0.0; - } - if (VB->TexCoordPtr[0]->size > 3) { - tex[3] = invw0 * VB->TexCoordPtr[0]->data[vert0][3]; - dtex[3] = invw1 * VB->TexCoordPtr[0]->data[vert1][3] - tex[3]; - } - else { - tex[3] = invw0; - dtex[3] = invw1 - invw0; - } - } + +#ifdef SETUP_CODE + SETUP_CODE #endif -#ifdef INTERP_MULTITEX + + (void) swrast; + + /* Cull primitives with malformed coordinates. + */ { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - tex[u][0] = invw0 * VB->TexCoordPtr[u]->data[vert0][0]; - dtex[u][0] = invw1 * VB->TexCoordPtr[u]->data[vert1][0] - tex[u][0]; - if (VB->TexCoordPtr[u]->size > 1) { - tex[u][1] = invw0 * VB->TexCoordPtr[u]->data[vert0][1]; - dtex[u][1] = invw1 * VB->TexCoordPtr[u]->data[vert1][1] - tex[u][1]; - } - else { - tex[u][1] = 0.0; - dtex[u][1] = 0.0; - } - if (VB->TexCoordPtr[u]->size > 2) { - tex[u][2] = invw0 * VB->TexCoordPtr[u]->data[vert0][2]; - dtex[u][2] = invw1 * VB->TexCoordPtr[u]->data[vert1][2] - tex[u][2]; - } - else { - tex[u][2] = 0.0; - dtex[u][2] = 0.0; - } - if (VB->TexCoordPtr[u]->size > 3) { - tex[u][3] = invw0 * VB->TexCoordPtr[u]->data[vert0][3]; - dtex[u][3] = invw1 * VB->TexCoordPtr[u]->data[vert1][3] - tex[u][3]; - } - else { - tex[u][3] = invw0; - dtex[u][3] = invw1 - invw0; - } - } - } + GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1] + + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1]; + if (IS_INF_OR_NAN(tmp)) + return; } -#endif + /* + printf("%s():\n", __FUNCTION__); + printf(" (%f, %f, %f) -> (%f, %f, %f)\n", + vert0->attrib[FRAG_ATTRIB_WPOS][0], + vert0->attrib[FRAG_ATTRIB_WPOS][1], + vert0->attrib[FRAG_ATTRIB_WPOS][2], + vert1->attrib[FRAG_ATTRIB_WPOS][0], + vert1->attrib[FRAG_ATTRIB_WPOS][1], + vert1->attrib[FRAG_ATTRIB_WPOS][2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->color[0], vert0->color[1], vert0->color[2], + vert1->color[0], vert1->color[1], vert1->color[2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->specular[0], vert0->specular[1], vert0->specular[2], + vert1->specular[0], vert1->specular[1], vert1->specular[2]); + */ /* * Despite being clipped to the view volume, the line's window coordinates @@ -237,31 +147,26 @@ } } #endif + dx = x1 - x0; dy = y1 - y0; - if (dx==0 && dy==0) { + if (dx == 0 && dy == 0) return; - } /* - * Setup - */ -#ifdef SETUP_CODE - SETUP_CODE -#endif + printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy, + vert0->attrib[FRAG_ATTRIB_COL1][0], + vert0->attrib[FRAG_ATTRIB_COL1][1], + vert0->attrib[FRAG_ATTRIB_COL1][2], + vert0->attrib[FRAG_ATTRIB_COL1][3], + vert1->attrib[FRAG_ATTRIB_COL1][0], + vert1->attrib[FRAG_ATTRIB_COL1][1], + vert1->attrib[FRAG_ATTRIB_COL1][2], + vert1->attrib[FRAG_ATTRIB_COL1][3]); + */ -#ifdef INTERP_Z -# ifdef DEPTH_TYPE - zPtr = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, x0, y0); -# endif - if (depthBits <= 16) { - z0 = FloatToFixed(VB->Win.data[vert0][2] + ctx->LineZoffset); - z1 = FloatToFixed(VB->Win.data[vert1][2] + ctx->LineZoffset); - } - else { - z0 = (int) VB->Win.data[vert0][2] + ctx->LineZoffset; - z1 = (int) VB->Win.data[vert1][2] + ctx->LineZoffset; - } +#ifdef DEPTH_TYPE + zPtr = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, x0, y0); #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0); @@ -269,10 +174,8 @@ if (dx<0) { dx = -dx; /* make positive */ -#ifdef INTERP_XY xstep = -1; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) +#ifdef DEPTH_TYPE zPtrXstep = -((GLint)sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS @@ -280,10 +183,8 @@ #endif } else { -#ifdef INTERP_XY xstep = 1; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) +#ifdef DEPTH_TYPE zPtrXstep = ((GLint)sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS @@ -293,193 +194,142 @@ if (dy<0) { dy = -dy; /* make positive */ -#ifdef INTERP_XY ystep = -1; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) - zPtrYstep = -ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE)); +#ifdef DEPTH_TYPE + zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE))); #endif #ifdef PIXEL_ADDRESS pixelYstep = BYTES_PER_ROW; #endif } else { -#ifdef INTERP_XY ystep = 1; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) - zPtrYstep = ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE)); +#ifdef DEPTH_TYPE + zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS pixelYstep = -(BYTES_PER_ROW); #endif } + ASSERT(dx >= 0); + ASSERT(dy >= 0); + + numPixels = MAX2(dx, dy); + + /* + * Span setup: compute start and step values for all interpolated values. + */ + interpFlags |= SPAN_RGBA; + if (ctx->Light.ShadeModel == GL_SMOOTH) { + span.red = ChanToFixed(vert0->color[0]); + span.green = ChanToFixed(vert0->color[1]); + span.blue = ChanToFixed(vert0->color[2]); + span.alpha = ChanToFixed(vert0->color[3]); + span.redStep = (ChanToFixed(vert1->color[0]) - span.red ) / numPixels; + span.greenStep = (ChanToFixed(vert1->color[1]) - span.green) / numPixels; + span.blueStep = (ChanToFixed(vert1->color[2]) - span.blue ) / numPixels; + span.alphaStep = (ChanToFixed(vert1->color[3]) - span.alpha) / numPixels; + } + else { + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + } +#if defined(INTERP_Z) || defined(DEPTH_TYPE) + interpFlags |= SPAN_Z; + { + if (depthBits <= 16) { + span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF; + span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2] + - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels; + } + else { + /* don't use fixed point */ + span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2]; + span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2] + - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels); + } + } +#endif +#if defined(INTERP_ATTRIBS) + { + const GLfloat invLen = 1.0F / numPixels; + const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3]; + + span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0; + span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen; + span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + + ATTRIB_LOOP_BEGIN + if (swrast->_InterpMode[attr] == GL_FLAT) { + COPY_4V(span.attrStart[attr], vert1->attrib[attr]); + ASSIGN_4V(span.attrStepX[attr], 0.0, 0.0, 0.0, 0.0); + } + else { + GLuint c; + for (c = 0; c < 4; c++) { + float da; + span.attrStart[attr][c] = invw0 * vert0->attrib[attr][c]; + da = (invw1 * vert1->attrib[attr][c]) - span.attrStart[attr][c]; + span.attrStepX[attr][c] = da * invLen; + } + } + ASSIGN_4V(span.attrStepY[attr], 0.0, 0.0, 0.0, 0.0); + ATTRIB_LOOP_END + } +#endif + + INIT_SPAN(span, GL_LINE); + span.end = numPixels; + span.interpMask = interpFlags; + span.arrayMask = SPAN_XY; + + span.facing = swrast->PointLineFacing; + + /* * Draw */ - if (dx>dy) { + if (dx > dy) { /*** X-major line ***/ GLint i; GLint errorInc = dy+dy; GLint error = errorInc-dx; GLint errorDec = error-dx; -#ifdef INTERP_Z - dz = (z1-z0) / dx; - dfog /= dx; -#endif -#ifdef INTERP_RGB - dr /= dx; /* convert from whole line delta to per-pixel delta */ - dg /= dx; - db /= dx; -#endif -#ifdef INTERP_SPEC - dsr /= dx; /* convert from whole line delta to per-pixel delta */ - dsg /= dx; - dsb /= dx; -#endif -#ifdef INTERP_ALPHA - da /= dx; -#endif -#ifdef INTERP_INDEX - di /= dx; -#endif -#ifdef INTERP_TEX - { - const GLfloat invDx = 1.0F / (GLfloat) dx; - dtex[0] *= invDx; - dtex[1] *= invDx; - dtex[2] *= invDx; - dtex[3] *= invDx; - } -#endif -#ifdef INTERP_MULTITEX - { - const GLfloat invDx = 1.0F / (GLfloat) dx; - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - dtex[u][0] *= invDx; - dtex[u][1] *= invDx; - dtex[u][2] *= invDx; - dtex[u][3] *= invDx; - } - } - } -#endif - for (i=0;iStippleCounter/ctx->Line.StippleFactor) & 0xf); - if (ctx->Line.StipplePattern & m) { -#endif -#ifdef INTERP_Z - GLdepth Z = FixedToDepth(z0); + for (i = 0; i < dx; i++) { +#ifdef DEPTH_TYPE + GLuint Z = FixedToDepth(span.z); #endif -#ifdef INTERP_INDEX - GLint I = i0 >> 8; -#endif -#ifdef INTERP_TEX - { - const GLfloat invQ = 1.0F / tex[3]; - fragTexcoord[0] = tex[0] * invQ; - fragTexcoord[1] = tex[1] * invQ; - fragTexcoord[2] = tex[2] * invQ; - } -#endif -#ifdef INTERP_MULTITEX - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - const GLfloat invQ = 1.0F / tex[u][3]; - fragTexcoord[u][0] = tex[u][0] * invQ; - fragTexcoord[u][1] = tex[u][1] * invQ; - fragTexcoord[u][2] = tex[u][2] * invQ; - } - } - } -#endif -#ifdef WIDE - { - GLint yy; - GLint ymin = y0 + min; - GLint ymax = y0 + max; - for (yy=ymin;yy<=ymax;yy++) { - PLOT( x0, yy ); - } - } +#ifdef PLOT + PLOT( x0, y0 ); #else -# ifdef XMAJOR_PLOT - XMAJOR_PLOT( x0, y0 ); -# else - PLOT( x0, y0 ); -# endif -#endif /*WIDE*/ -#ifdef STIPPLE - } - ctx->StippleCounter++; + span.array->x[i] = x0; + span.array->y[i] = y0; #endif -#ifdef INTERP_XY x0 += xstep; -#endif -#ifdef INTERP_Z -# ifdef DEPTH_TYPE +#ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); -# endif - z0 += dz; - fog0 += dfog; -#endif -#ifdef INTERP_RGB - r0 += dr; - g0 += dg; - b0 += db; -#endif -#ifdef INTERP_SPEC - sr0 += dsr; - sg0 += dsg; - sb0 += dsb; -#endif -#ifdef INTERP_ALPHA - a0 += da; -#endif -#ifdef INTERP_INDEX - i0 += di; -#endif -#ifdef INTERP_TEX - tex[0] += dtex[0]; - tex[1] += dtex[1]; - tex[2] += dtex[2]; - tex[3] += dtex[3]; -#endif -#ifdef INTERP_MULTITEX - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - tex[u][0] += dtex[u][0]; - tex[u][1] += dtex[u][1]; - tex[u][2] += dtex[u][2]; - tex[u][3] += dtex[u][3]; - } - } - } + span.z += span.zStep; #endif - #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); #endif - if (error<0) { + if (error < 0) { error += errorInc; } else { error += errorDec; -#ifdef INTERP_XY y0 += ystep; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) +#ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); #endif #ifdef PIXEL_ADDRESS @@ -494,147 +344,21 @@ GLint errorInc = dx+dx; GLint error = errorInc-dy; GLint errorDec = error-dy; -#ifdef INTERP_Z - dz = (z1-z0) / dy; - dfog /= dy; -#endif -#ifdef INTERP_RGB - dr /= dy; /* convert from whole line delta to per-pixel delta */ - dg /= dy; - db /= dy; -#endif -#ifdef INTERP_SPEC - dsr /= dy; /* convert from whole line delta to per-pixel delta */ - dsg /= dy; - dsb /= dy; -#endif -#ifdef INTERP_ALPHA - da /= dy; -#endif -#ifdef INTERP_INDEX - di /= dy; -#endif -#ifdef INTERP_TEX - { - const GLfloat invDy = 1.0F / (GLfloat) dy; - dtex[0] *= invDy; - dtex[1] *= invDy; - dtex[2] *= invDy; - dtex[3] *= invDy; - } -#endif -#ifdef INTERP_MULTITEX - { - const GLfloat invDy = 1.0F / (GLfloat) dy; - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - dtex[u][0] *= invDy; - dtex[u][1] *= invDy; - dtex[u][2] *= invDy; - dtex[u][3] *= invDy; - } - } - } -#endif for (i=0;iStippleCounter/ctx->Line.StippleFactor) & 0xf); - if (ctx->Line.StipplePattern & m) { -#endif -#ifdef INTERP_Z - GLdepth Z = FixedToDepth(z0); +#ifdef DEPTH_TYPE + GLuint Z = FixedToDepth(span.z); #endif -#ifdef INTERP_INDEX - GLint I = i0 >> 8; -#endif -#ifdef INTERP_TEX - { - const GLfloat invQ = 1.0F / tex[3]; - fragTexcoord[0] = tex[0] * invQ; - fragTexcoord[1] = tex[1] * invQ; - fragTexcoord[2] = tex[2] * invQ; - } -#endif -#ifdef INTERP_MULTITEX - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - const GLfloat invQ = 1.0F / tex[u][3]; - fragTexcoord[u][0] = tex[u][0] * invQ; - fragTexcoord[u][1] = tex[u][1] * invQ; - fragTexcoord[u][2] = tex[u][2] * invQ; - } - } - } -#endif -#ifdef WIDE - { - GLint xx; - GLint xmin = x0 + min; - GLint xmax = x0 + max; - for (xx=xmin;xx<=xmax;xx++) { - PLOT( xx, y0 ); - } - } +#ifdef PLOT + PLOT( x0, y0 ); #else -# ifdef YMAJOR_PLOT - YMAJOR_PLOT( x0, y0 ); -# else - PLOT( x0, y0 ); -# endif -#endif /*WIDE*/ -#ifdef STIPPLE - } - ctx->StippleCounter++; + span.array->x[i] = x0; + span.array->y[i] = y0; #endif -#ifdef INTERP_XY y0 += ystep; -#endif -#ifdef INTERP_Z -# ifdef DEPTH_TYPE +#ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); -# endif - z0 += dz; - fog0 += dfog; -#endif -#ifdef INTERP_RGB - r0 += dr; - g0 += dg; - b0 += db; -#endif -#ifdef INTERP_SPEC - sr0 += dsr; - sg0 += dsg; - sb0 += dsb; -#endif -#ifdef INTERP_ALPHA - a0 += da; -#endif -#ifdef INTERP_INDEX - i0 += di; -#endif -#ifdef INTERP_TEX - tex[0] += dtex[0]; - tex[1] += dtex[1]; - tex[2] += dtex[2]; - tex[3] += dtex[3]; -#endif -#ifdef INTERP_MULTITEX - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - if (ctx->Texture.Unit[u].ReallyEnabled) { - tex[u][0] += dtex[u][0]; - tex[u][1] += dtex[u][1]; - tex[u][2] += dtex[u][2]; - tex[u][3] += dtex[u][3]; - } - } - } + span.z += span.zStep; #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); @@ -644,10 +368,8 @@ } else { error += errorDec; -#ifdef INTERP_XY x0 += xstep; -#endif -#if defined(INTERP_Z) && defined(DEPTH_TYPE) +#ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); #endif #ifdef PIXEL_ADDRESS @@ -657,26 +379,24 @@ } } +#ifdef RENDER_SPAN + RENDER_SPAN( span ); +#endif + + (void)span; + } -#undef INTERP_XY +#undef NAME #undef INTERP_Z -#undef INTERP_RGB -#undef INTERP_SPEC -#undef INTERP_ALPHA -#undef INTERP_TEX -#undef INTERP_MULTITEX -#undef INTERP_INDEX +#undef INTERP_ATTRIBS #undef PIXEL_ADDRESS #undef PIXEL_TYPE #undef DEPTH_TYPE #undef BYTES_PER_ROW #undef SETUP_CODE #undef PLOT -#undef XMAJOR_PLOT -#undef YMAJOR_PLOT #undef CLIP_HACK -#undef STIPPLE -#undef WIDE #undef FixedToDepth +#undef RENDER_SPAN