From 9ede048127ea71282fd97e01516dedcfb03e2a23 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 24 Apr 2007 16:40:54 -0600 Subject: trim down the number of line drawing functions, special cases --- src/mesa/swrast/s_lines.c | 41 +++++------------------------------------ src/mesa/swrast/s_linetemp.h | 34 +++------------------------------- 2 files changed, 8 insertions(+), 67 deletions(-) diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index 7b2a52b4ff..80702e41a3 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.3 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * 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"), @@ -171,34 +171,13 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor ) #include "s_linetemp.h" -/* Single-texture line, w/ fog, Z, specular, etc. */ +/* General-purpose textured line (any/all features). */ #define NAME textured_line #define INTERP_RGBA -#define INTERP_Z -#define INTERP_FOG -#define INTERP_TEX -#define RENDER_SPAN(span) \ - if (ctx->Line.StippleFlag) { \ - span.arrayMask |= SPAN_MASK; \ - compute_stipple_mask(ctx, span.end, span.array->mask); \ - } \ - if (ctx->Line._Width > 1.0) { \ - draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ - } \ - else { \ - _swrast_write_rgba_span(ctx, &span); \ - } -#include "s_linetemp.h" - - -/* Multi-texture or separate specular line, w/ fog, Z, specular, etc. */ -#define NAME multitextured_line -#define INTERP_RGBA #define INTERP_SPEC #define INTERP_Z #define INTERP_FOG -#define INTERP_MULTITEX -#define INTERP_VARYING +#define INTERP_ATTRIBS #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ @@ -251,8 +230,6 @@ _mesa_print_line_function(GLcontext *ctx) _mesa_printf("general_rgba_line\n"); else if (swrast->Line == textured_line) _mesa_printf("textured_line\n"); - else if (swrast->Line == multitextured_line) - _mesa_printf("multitextured_line\n"); else _mesa_printf("Driver func %p\n", (void *(*)()) swrast->Line); } @@ -302,15 +279,7 @@ _swrast_choose_line( GLcontext *ctx ) else if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Current) { /* textured lines */ - if (ctx->Texture._EnabledCoordUnits > 0x1 - || NEED_SECONDARY_COLOR(ctx) - || ctx->FragmentProgram._Current) { - /* multi-texture and/or separate specular color */ - USE(multitextured_line); - } - else { - USE(textured_line); - } + USE(textured_line); } else if (ctx->Depth.Test || swrast->_FogEnabled || ctx->Line._Width != 1.0 || ctx->Line.StippleFlag) { diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index 76da446710..b6e8f287f4 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -35,9 +35,7 @@ * INTERP_RGBA - if defined, interpolate RGBA values * INTERP_SPEC - if defined, interpolate specular RGB 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_VARYING - if defined, interpolate GLSL varyings + * 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 @@ -284,32 +282,7 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->attrib[FRAG_ATTRIB_FOGC][0] - vert0->attrib[FRAG_ATTRIB_FOGC][0]) / numPixels; #endif -#ifdef INTERP_TEX - interpFlags |= SPAN_TEXTURE; - { - const GLfloat invw0 = vert0->win[3]; - const GLfloat invw1 = vert1->win[3]; - const GLfloat invLen = 1.0F / numPixels; - GLfloat ds, dt, dr, dq; - span.attrStart[FRAG_ATTRIB_TEX0][0] = invw0 * vert0->attrib[FRAG_ATTRIB_TEX0][0]; - span.attrStart[FRAG_ATTRIB_TEX0][1] = invw0 * vert0->attrib[FRAG_ATTRIB_TEX0][1]; - span.attrStart[FRAG_ATTRIB_TEX0][2] = invw0 * vert0->attrib[FRAG_ATTRIB_TEX0][2]; - span.attrStart[FRAG_ATTRIB_TEX0][3] = invw0 * vert0->attrib[FRAG_ATTRIB_TEX0][3]; - ds = (invw1 * vert1->attrib[FRAG_ATTRIB_TEX0][0]) - span.attrStart[FRAG_ATTRIB_TEX0][0]; - dt = (invw1 * vert1->attrib[FRAG_ATTRIB_TEX0][1]) - span.attrStart[FRAG_ATTRIB_TEX0][1]; - dr = (invw1 * vert1->attrib[FRAG_ATTRIB_TEX0][2]) - span.attrStart[FRAG_ATTRIB_TEX0][2]; - dq = (invw1 * vert1->attrib[FRAG_ATTRIB_TEX0][3]) - span.attrStart[FRAG_ATTRIB_TEX0][3]; - span.attrStepX[FRAG_ATTRIB_TEX0][0] = ds * invLen; - span.attrStepX[FRAG_ATTRIB_TEX0][1] = dt * invLen; - span.attrStepX[FRAG_ATTRIB_TEX0][2] = dr * invLen; - span.attrStepX[FRAG_ATTRIB_TEX0][3] = dq * invLen; - span.attrStepY[FRAG_ATTRIB_TEX0][0] = 0.0F; - span.attrStepY[FRAG_ATTRIB_TEX0][1] = 0.0F; - span.attrStepY[FRAG_ATTRIB_TEX0][2] = 0.0F; - span.attrStepY[FRAG_ATTRIB_TEX0][3] = 0.0F; - } -#endif -#if defined(INTERP_MULTITEX) || defined(INTERP_VARYING) +#if defined(INTERP_ATTRIBS) interpFlags |= (SPAN_TEXTURE | SPAN_VARYING); { const GLfloat invLen = 1.0F / numPixels; @@ -443,8 +416,7 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) #undef INTERP_FOG #undef INTERP_RGBA #undef INTERP_SPEC -#undef INTERP_TEX -#undef INTERP_MULTITEX +#undef INTERP_ATTRIBS #undef INTERP_INDEX #undef PIXEL_ADDRESS #undef PIXEL_TYPE -- cgit v1.2.3