From e5ed4c45c675ebdd595ad0d31f2835f8b2b8dc57 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 24 Feb 2010 15:39:08 -0800 Subject: [PATCH] swrast: Remove support for rendering antialiased lines into a color-index buffer Signed-off-by: Ian Romanick --- src/mesa/swrast/s_aaline.c | 50 ++++++---------------------------- src/mesa/swrast/s_aalinetemp.h | 32 ---------------------- 2 files changed, 9 insertions(+), 73 deletions(-) diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index 9bfa8f2e619..6ba4604e690 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -59,10 +59,8 @@ struct LineInfo /* DO_Z */ GLfloat zPlane[4]; - /* DO_RGBA */ + /* DO_RGBA - always enabled */ GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; - /* DO_INDEX */ - GLfloat iPlane[4]; /* DO_ATTRIBS */ GLfloat wPlane[4]; GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; @@ -325,20 +323,6 @@ compute_coveragef(const struct LineInfo *info, } -/** - * Compute coverage value for color index mode. - * XXX this may not be quite correct. - * \return coverage in [0,15]. - */ -static GLfloat -compute_coveragei(const struct LineInfo *info, - GLint winx, GLint winy) -{ - return compute_coveragef(info, winx, winy) * 15.0F; -} - - - typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, int ix, int iy); @@ -475,22 +459,13 @@ segment(GLcontext *ctx, } -#define NAME(x) aa_ci_##x -#define DO_Z -#define DO_ATTRIBS /* for fog */ -#define DO_INDEX -#include "s_aalinetemp.h" - - #define NAME(x) aa_rgba_##x #define DO_Z -#define DO_RGBA #include "s_aalinetemp.h" #define NAME(x) aa_general_rgba_##x #define DO_Z -#define DO_RGBA #define DO_ATTRIBS #include "s_aalinetemp.h" @@ -503,22 +478,15 @@ _swrast_choose_aa_line_function(GLcontext *ctx) ASSERT(ctx->Line.SmoothFlag); - if (ctx->Visual.rgbMode) { - /* RGBA */ - if (ctx->Texture._EnabledCoordUnits != 0 - || ctx->FragmentProgram._Current - || (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - || ctx->Fog.ColorSumEnabled - || swrast->_FogEnabled) { - swrast->Line = aa_general_rgba_line; - } - else { - swrast->Line = aa_rgba_line; - } + if (ctx->Texture._EnabledCoordUnits != 0 + || ctx->FragmentProgram._Current + || (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) + || ctx->Fog.ColorSumEnabled + || swrast->_FogEnabled) { + swrast->Line = aa_general_rgba_line; } else { - /* Color Index */ - swrast->Line = aa_ci_line; + swrast->Line = aa_rgba_line; } } diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 42ffe9f20c1..c28d47a671d 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -39,11 +39,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat fx = (GLfloat) ix; const GLfloat fy = (GLfloat) iy; -#ifdef DO_INDEX - const GLfloat coverage = compute_coveragei(line, ix, iy); -#else const GLfloat coverage = compute_coveragef(line, ix, iy); -#endif const GLuint i = line->span.end; (void) swrast; @@ -63,15 +59,10 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) #ifdef DO_Z line->span.array->z[i] = (GLuint) solve_plane(fx, fy, line->zPlane); #endif -#ifdef DO_RGBA line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane); line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane); line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane); -#endif -#ifdef DO_INDEX - line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane); -#endif #if defined(DO_ATTRIBS) ATTRIB_LOOP_BEGIN GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; @@ -101,11 +92,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) #endif if (line->span.end == MAX_WIDTH) { -#if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &(line->span)); -#else - _swrast_write_index_span(ctx, &(line->span)); -#endif line->span.end = 0; /* reset counter */ } } @@ -150,7 +137,6 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) compute_plane(line.x0, line.y0, line.x1, line.y1, v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane); #endif -#ifdef DO_RGBA line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, @@ -168,18 +154,6 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) constant_plane(v1->color[BCOMP], line.bPlane); constant_plane(v1->color[ACOMP], line.aPlane); } -#endif -#ifdef DO_INDEX - line.span.arrayMask |= SPAN_INDEX; - if (ctx->Light.ShadeModel == GL_SMOOTH) { - compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->attrib[FRAG_ATTRIB_CI][0], - v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane); - } - else { - constant_plane(v1->attrib[FRAG_ATTRIB_CI][0], line.iPlane); - } -#endif #if defined(DO_ATTRIBS) { const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; @@ -257,18 +231,12 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) segment(ctx, &line, NAME(plot), 0.0, 1.0); } -#if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &(line.span)); -#else - _swrast_write_index_span(ctx, &(line.span)); -#endif } #undef DO_Z -#undef DO_RGBA -#undef DO_INDEX #undef DO_ATTRIBS #undef NAME -- 2.30.2