diff options
author | Gareth Hughes <gareth@valinux.com> | 2001-01-06 22:46:13 +0000 |
---|---|---|
committer | Gareth Hughes <gareth@valinux.com> | 2001-01-06 22:46:13 +0000 |
commit | ba8f6172bdfb44594537a304225b54152584d701 (patch) | |
tree | fc9ad8032c50f030e7ca6a6f9388d7928b019c4d | |
parent | c85164605031cd64afbc57ca5ab1331377af887b (diff) |
Implementation of GL_EXT_texture_env_dot3.
-rw-r--r-- | include/GL/gl.h | 15 | ||||
-rw-r--r-- | include/GL/glext.h | 13 | ||||
-rw-r--r-- | src/mesa/main/enums.c | 44 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 55 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 21 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 47 |
7 files changed, 131 insertions, 68 deletions
diff --git a/include/GL/gl.h b/include/GL/gl.h index 11a16dfc92..f261a672b4 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -1,4 +1,4 @@ -/* $Id: gl.h,v 1.49 2000/12/09 20:36:18 brianp Exp $ */ +/* $Id: gl.h,v 1.50 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -2228,6 +2228,19 @@ GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); #endif /* GL_MESA_resize_bufffers */ + +/* + * 220. GL_EXT_texture_env_dot3 + */ +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 + +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 + +#endif /* GL_EXT_texture_env_dot3 */ + + #else /* GL_GLEXT_LEGACY */ #include <GL/glext.h> diff --git a/include/GL/glext.h b/include/GL/glext.h index f721a9fd70..aa69c184c2 100644 --- a/include/GL/glext.h +++ b/include/GL/glext.h @@ -13,21 +13,21 @@ extern "C" { ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) @@ -1419,6 +1419,11 @@ extern "C" { #define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF #endif +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + /*************************************************************/ diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index bdf247fecf..67087536d4 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1,21 +1,21 @@ -/* $Id: enums.c,v 1.9 2000/06/27 21:42:13 brianp Exp $ */ +/* $Id: enums.c,v 1.10 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.3 - * + * * Copyright (C) 1999-2000 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 @@ -34,12 +34,12 @@ #endif -typedef struct { - const char *c; - int n; +typedef struct { + const char *c; + int n; } enum_elt; -enum_elt all_enums[] = +enum_elt all_enums[] = { /* Boolean values */ { "GL_FALSE", 0 }, @@ -828,7 +828,11 @@ enum_elt all_enums[] = { "GL_INTERPOLATE_EXT", 0x8575 }, { "GL_CONSTANT_EXT", 0x8576 }, { "GL_PRIMARY_COLOR_EXT", 0x8577 }, - { "GL_PREVIOUS_EXT", 0x8578 } + { "GL_PREVIOUS_EXT", 0x8578 }, + + /* GL_EXT_texture_env_dot3 */ + { "GL_DOT3_RGB_EXT", 0x8740 }, + { "GL_DOT3_RGBA_EXT", 0x8741 }, }; @@ -839,7 +843,7 @@ typedef int (GLWINAPIV *cfunc)(const void *, const void *); static enum_elt **index1 = 0; static int sorted = 0; -static int compar_name( const enum_elt *a, const enum_elt *b ) +static int compar_name( const enum_elt *a, const enum_elt *b ) { return strcmp(a->c, b->c); } @@ -847,7 +851,7 @@ static int compar_name( const enum_elt *a, const enum_elt *b ) /* note the extra level of indirection */ -static int compar_nr( const enum_elt **a, const enum_elt **b ) +static int compar_nr( const enum_elt **a, const enum_elt **b ) { return (*a)->n - (*b)->n; } @@ -859,10 +863,10 @@ static void sort_enums( void ) index1 = (enum_elt **)MALLOC( Elements(all_enums) * sizeof(enum_elt *) ); sorted = 1; - qsort( all_enums, Elements(all_enums), sizeof(*all_enums), + qsort( all_enums, Elements(all_enums), sizeof(*all_enums), (cfunc) compar_name ); - for (i = 0 ; i < Elements(all_enums) ; i++) + for (i = 0 ; i < Elements(all_enums) ; i++) index1[i] = &all_enums[i]; qsort( index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr ); @@ -875,14 +879,14 @@ int gl_lookup_enum_by_name( const char *symbol ) enum_elt tmp; enum_elt *e; - if (!sorted) + if (!sorted) sort_enums(); - if (!symbol) + if (!symbol) return 0; tmp.c = symbol; - e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums), + e = (enum_elt *)bsearch( &tmp, all_enums, Elements(all_enums), sizeof(*all_enums), (cfunc) compar_name ); return e ? e->n : -1; @@ -893,13 +897,13 @@ const char *gl_lookup_enum_by_nr( int nr ) { enum_elt tmp, *e, **f; - if (!sorted) + if (!sorted) sort_enums(); tmp.n = nr; e = &tmp; - f = (enum_elt **)bsearch( &e, index1, Elements(all_enums), + f = (enum_elt **)bsearch( &e, index1, Elements(all_enums), sizeof(*index1), (cfunc) compar_nr ); return f ? (*f)->c : "(unknown)"; @@ -920,6 +924,6 @@ int main() for (i = 0 ; i < Elements(test) ; i++) { int d = gl_lookup_enum_by_name( test[i] ); printf("%s --> %d --> %s\n", test[i], d, gl_lookup_enum_by_nr( d )); - } + } } #endif diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 6c0645b84b..d414c0f31f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.43 2000/12/08 00:20:15 brianp Exp $ */ +/* $Id: extensions.c,v 1.44 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -87,6 +87,7 @@ static struct { { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, { ON, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, + { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { ON, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, { ON, "GL_EXT_vertex_array", 0 }, @@ -120,6 +121,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) gl_extensions_enable(ctx, "GL_ARB_texture_cube_map"); gl_extensions_enable(ctx, "GL_EXT_bgra"); gl_extensions_enable(ctx, "GL_EXT_texture_env_combine"); + gl_extensions_enable(ctx, "GL_EXT_texture_env_dot3"); gl_extensions_enable(ctx, "GL_HP_occlusion_test"); gl_extensions_enable(ctx, "GL_NV_blend_square"); gl_extensions_enable(ctx, "GL_MESA_sprite_point"); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 913c2f2fb5..ee46c6d888 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,21 +1,21 @@ -/* $Id: mtypes.h,v 1.10 2001/01/05 02:26:48 keithw Exp $ */ +/* $Id: mtypes.h,v 1.11 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * + * * Copyright (C) 1999-2000 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 @@ -27,7 +27,7 @@ #ifndef TYPES_H #define TYPES_H - + #include "glheader.h" #include "config.h" /* Hardwired parameters */ @@ -211,7 +211,7 @@ struct gl_light { GLfloat _VP_inf_norm[3]; /* Norm direction to infinite light */ GLfloat _h_inf_norm[3]; /* Norm( _VP_inf_norm + <0,0,1> ) */ GLfloat _NormDirection[4]; /* normalized spotlight direction */ - GLfloat _VP_inf_spot_attenuation; + GLfloat _VP_inf_spot_attenuation; GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */ @@ -231,7 +231,7 @@ struct gl_lightmodel { }; -struct gl_material +struct gl_material { GLfloat Ambient[4]; GLfloat Diffuse[4]; @@ -308,7 +308,7 @@ struct gl_current_attrib { GLuint Index; /* Current color index */ GLboolean EdgeFlag; /* Current edge flag */ GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ - + /* These values are always valid. */ GLfloat RasterPos[4]; /* Current raster position */ @@ -744,7 +744,7 @@ struct gl_stencil_attrib { #define ENABLE_TEXMAT1 0x200 #define ENABLE_TEXMAT2 0x400 #define ENABLE_TEXMAT3 0x800 -#define ENABLE_TEXMAT4 0x1000 +#define ENABLE_TEXMAT4 0x1000 #define ENABLE_TEXMAT5 0x2000 #define ENABLE_TEXMAT6 0x4000 #define ENABLE_TEXMAT7 0x8000 @@ -910,7 +910,7 @@ struct gl_texture_attrib { GLuint _GenFlags; /* for texgen */ struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; - + struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy3D; @@ -1033,7 +1033,7 @@ struct gl_1d_map { GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ GLfloat *Points; /* Points to contiguous control points */ }; - + /* * 2-D Evaluator control points @@ -1231,6 +1231,7 @@ struct gl_extensions { GLboolean EXT_texture_compression_s3tc; GLboolean EXT_texture_env_add; GLboolean EXT_texture_env_combine; + GLboolean EXT_texture_env_dot3; GLboolean EXT_texture_object; GLboolean EXT_texture_lod_bias; GLboolean EXT_vertex_array_set; @@ -1321,18 +1322,18 @@ struct gl_extensions { /* Bits to track array state changes (also used to summarize array enabled) */ -#define _NEW_ARRAY_VERTEX 0x1 -#define _NEW_ARRAY_COLOR 0x2 -#define _NEW_ARRAY_NORMAL 0x4 -#define _NEW_ARRAY_INDEX 0x8 +#define _NEW_ARRAY_VERTEX 0x1 +#define _NEW_ARRAY_COLOR 0x2 +#define _NEW_ARRAY_NORMAL 0x4 +#define _NEW_ARRAY_INDEX 0x8 #define _NEW_ARRAY_EDGEFLAG 0x10 #define _NEW_ARRAY_SECONDARYCOLOR 0x20 #define _NEW_ARRAY_FOGCOORD 0x40 -#define _NEW_ARRAY_TEXCOORD_0 0x80 +#define _NEW_ARRAY_TEXCOORD_0 0x80 #define _NEW_ARRAY_TEXCOORD_1 0x100 #define _NEW_ARRAY_TEXCOORD_2 0x200 #define _NEW_ARRAY_TEXCOORD_3 0x400 -#define _NEW_ARRAY_TEXCOORD_4 0x800 +#define _NEW_ARRAY_TEXCOORD_4 0x800 #define _NEW_ARRAY_TEXCOORD_5 0x1000 #define _NEW_ARRAY_TEXCOORD_6 0x2000 #define _NEW_ARRAY_TEXCOORD_7 0x4000 @@ -1359,7 +1360,7 @@ struct gl_extensions { #define DD_POINT_ATTEN 0x10000 #define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */ #define DD_Z_NEVER 0x800000 /* special case on some hw */ -#define DD_STENCIL 0x1000000 +#define DD_STENCIL 0x1000000 /* Define the state changes under which each of these bits might change */ @@ -1380,7 +1381,7 @@ struct gl_extensions { #define _DD_NEW_POINT_SIZE _NEW_POINT #define _DD_NEW_POINT_ATTEN _NEW_POINT #define _DD_NEW_LIGHTING_CULL _NEW_LIGHT -#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON +#define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON #define _DD_NEW_Z_NEVER _NEW_DEPTH #define _DD_NEW_STENCIL _NEW_STENCIL @@ -1388,7 +1389,7 @@ struct gl_extensions { #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \ _NEW_TEXTURE| \ _NEW_POINT| \ - _NEW_MODELVIEW) + _NEW_MODELVIEW) #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \ _NEW_TEXTURE) @@ -1420,7 +1421,7 @@ typedef union node Node; /* - * The library context: + * The library context: */ struct __GLcontextRec { /* @@ -1438,7 +1439,7 @@ struct __GLcontextRec { struct _glapi_table *Save; /* Display list save funcs */ struct _glapi_table *Exec; /* Execute funcs */ struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ - + GLboolean ExecPrefersFloat; /* What preference for color conversion? */ GLboolean SavePrefersFloat; @@ -1566,7 +1567,7 @@ struct __GLcontextRec { /* Should 3Dfx Glide driver catch signals? */ GLboolean CatchSignals; - + /* For debugging/development only */ GLboolean NoRaster; GLboolean FirstTimeCurrent; @@ -1601,7 +1602,7 @@ extern GLenum gl_reduce_prim[]; #ifdef MESA_DEBUG -extern int MESA_VERBOSE; +extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; #else # define MESA_VERBOSE 0 @@ -1622,12 +1623,12 @@ enum _verbose { VERBOSE_API = 0x40, VERBOSE_DISPLAY_LIST = 0x200, VERBOSE_LIGHTING = 0x400 -}; +}; enum _debug { DEBUG_ALWAYS_FLUSH = 0x1 -}; +}; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index a34d60653d..9bf4bbb3c8 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */ +/* $Id: texstate.c,v 1.27 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -100,7 +100,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) } if (texUnit->EnvMode == mode) - return; + return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->EnvMode = mode; break; @@ -117,7 +117,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) COPY_4FV(texUnit->EnvColor, tmp); break; } - case GL_COMBINE_RGB_EXT: + case GL_COMBINE_RGB_EXT: if (ctx->Extensions.EXT_texture_env_combine) { GLenum mode = (GLenum) (GLint) *param; switch (mode) { @@ -127,12 +127,19 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_ADD_SIGNED_EXT: case GL_INTERPOLATE_EXT: break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + if (!ctx->Extensions.EXT_texture_env_dot3) { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); + return; + } + break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); return; } if (texUnit->CombineModeRGB == mode) - return; + return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->CombineModeRGB = mode; } @@ -140,7 +147,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); return; } - case GL_COMBINE_ALPHA_EXT: + case GL_COMBINE_ALPHA_EXT: if (ctx->Extensions.EXT_texture_env_combine) { GLenum mode = (GLenum) (GLint) *param; switch (mode) { @@ -150,7 +157,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_ADD_SIGNED_EXT: case GL_INTERPOLATE_EXT: if (texUnit->CombineModeA == mode) - return; + return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->CombineModeA = mode; break; @@ -1326,7 +1333,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); return; } - + if (ctx->Driver.TexGen) ctx->Driver.TexGen( ctx, coord, pname, params ); } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index b4c81fad02..1123cdcdaf 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,21 +1,21 @@ -/* $Id: s_texture.c,v 1.7 2001/01/05 21:28:31 brianp Exp $ */ +/* $Id: s_texture.c,v 1.8 2001/01/06 22:46:13 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * + * * Copyright (C) 1999-2000 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 @@ -197,7 +197,7 @@ palette_sample(const struct gl_texture_object *tObj, } - + /* * Bitflags for texture border color sampling. @@ -1830,6 +1830,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, #define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) +#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) static INLINE void _mesa_texture_combine(const GLcontext *ctx, @@ -2044,6 +2045,28 @@ _mesa_texture_combine(const GLcontext *ctx, } } break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + { + const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0]; + const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1]; + /* ATI's EXT extension has a constant scale by 4. The ARB + * one will likely remove this restriction, and we should + * drop the EXT extension in favour of the ARB one. + */ + for (i = 0; i < n; i++) { + GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - 128, + (GLint)arg1[i][RCOMP] - 128) + + S_PROD((GLint)arg0[i][GCOMP] - 128, + (GLint)arg1[i][GCOMP] - 128) + + S_PROD((GLint)arg0[i][BCOMP] - 128, + (GLint)arg1[i][BCOMP] - 128)) >> 6; + rgba[i][RCOMP] = (GLubyte) CLAMP(dot, 0, 255); + rgba[i][GCOMP] = (GLubyte) CLAMP(dot, 0, 255); + rgba[i][BCOMP] = (GLubyte) CLAMP(dot, 0, 255); + } + } + break; default: gl_problem(NULL, "invalid combine mode"); } @@ -2114,6 +2137,14 @@ _mesa_texture_combine(const GLcontext *ctx, default: gl_problem(NULL, "invalid combine mode"); } + + /* Fix the alpha component for GL_DOT3_RGBA_EXT combining. + */ + if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT) { + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = rgba[i][RCOMP]; + } + } } #undef PROD @@ -2563,8 +2594,8 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, /* Sample the texture. */ SWRAST_CONTEXT(ctx)->TextureSample[texUnit]( ctx, texUnit, - textureUnit->_Current, - n, s, t, r, + textureUnit->_Current, + n, s, t, r, lambda, texel ); apply_texture( ctx, textureUnit, n, primary_rgba, texel, rgba ); |