X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_texcombine.c;h=b7724f7b20a6267c10c47a765e62391cf2fb1262;hb=101d1a658a614d1e2ec02b1e697f6161291af653;hp=db77ad8bc3e1486999a7ba0de06883f6e6cf3aea;hpb=c4fe46f0b8b45407ea40500b869ae1beca71063c;p=mesa.git diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index db77ad8bc3e..b7724f7b20a 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 6.5.1 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * 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"), @@ -23,12 +23,12 @@ */ -#include "glheader.h" -#include "context.h" -#include "colormac.h" -#include "imports.h" -#include "macros.h" -#include "pixel.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/imports.h" +#include "main/macros.h" +#include "image.h" #include "s_context.h" #include "s_texcombine.h" @@ -72,13 +72,11 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, #if CHAN_TYPE == GL_FLOAT const GLchan RGBmult = (GLfloat) (1 << RGBshift); const GLchan Amult = (GLfloat) (1 << Ashift); - static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 }; - static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 }; #else const GLint half = (CHAN_MAX + 1) / 2; +#endif static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX }; static const GLchan zero[4] = { 0, 0, 0, 0 }; -#endif const GLuint numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB; const GLuint numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA; GLchan ccolor[3][MAX_WIDTH][4]; @@ -104,7 +102,6 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, for (j = 0; j < numColorArgs; j++) { const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j]; - switch (srcRGB) { case GL_TEXTURE: argRGB[j] = (const GLchan (*)[4]) @@ -738,7 +735,7 @@ texture_apply( const GLcontext *ctx, { GLint baseLevel; GLuint i; - GLint Rc, Gc, Bc, Ac; + GLchan Rc, Gc, Bc, Ac; GLenum format; (void) primary_rgba; @@ -904,7 +901,7 @@ texture_apply( const GLcontext *ctx, case GL_RGBA: for (i=0;iEnvColor[0] * CHAN_MAXF); - Gc = (GLint) (texUnit->EnvColor[1] * CHAN_MAXF); - Bc = (GLint) (texUnit->EnvColor[2] * CHAN_MAXF); - Ac = (GLint) (texUnit->EnvColor[3] * CHAN_MAXF); + UNCLAMPED_FLOAT_TO_CHAN(Rc, texUnit->EnvColor[0]); + UNCLAMPED_FLOAT_TO_CHAN(Gc, texUnit->EnvColor[1]); + UNCLAMPED_FLOAT_TO_CHAN(Bc, texUnit->EnvColor[2]); + UNCLAMPED_FLOAT_TO_CHAN(Ac, texUnit->EnvColor[3]); switch (format) { case GL_ALPHA: for (i=0;iend < MAX_WIDTH); - ASSERT(span->arrayMask & SPAN_TEXTURE); /* * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) @@ -1097,6 +1093,9 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span ) */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { + const GLfloat (*texcoords)[4] + = (const GLfloat (*)[4]) + span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; @@ -1130,12 +1129,17 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span ) /* Sample the texture (span->end = number of fragments) */ swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end, - (const GLfloat (*)[4]) span->array->texcoords[unit], - lambda, texels ); + texcoords, lambda, texels ); /* GL_SGI_texture_color_table */ if (texUnit->ColorTableEnabled) { - _mesa_lookup_rgba_chan(&texUnit->ColorTable, span->end, texels); +#if CHAN_TYPE == GL_UNSIGNED_BYTE + _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels); +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels); +#else + _mesa_lookup_rgba_float(&texUnit->ColorTable, span->end, texels); +#endif } } }