From 1a59875367b4e38710b37422143efb702b0b1420 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Mar 2001 04:54:58 +0000 Subject: [PATCH] added GL_ARB_texture_env_combine, GL_ARB_texture_env_dot3 --- docs/VERSIONS | 4 +++- src/mesa/main/extensions.c | 4 +++- src/mesa/main/texstate.c | 16 +++++++++++++++- src/mesa/swrast/s_texture.c | 24 +++++++++++++++++++++--- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/docs/VERSIONS b/docs/VERSIONS index b6ea9b11c0b..cde1cd3ee18 100644 --- a/docs/VERSIONS +++ b/docs/VERSIONS @@ -1,4 +1,4 @@ -$Id: VERSIONS,v 1.51 2001/03/17 00:47:19 brianp Exp $ +$Id: VERSIONS,v 1.52 2001/03/22 04:55:48 brianp Exp $ Mesa Version History @@ -821,6 +821,8 @@ Mesa Version History - GL_SGIX_depth_texture extension - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow + - GL_ARB_texture_env_combine extension + - GL_ARB_texture_env_dot3 extension - OSMesaCreateContextExt() function - libOSMesa.so library, contains the OSMesa driver interface - GL/glxext.h header file for GLX extensions diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 6a7d25fe201..e3b9592b89e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.53 2001/03/18 08:53:49 gareth Exp $ */ +/* $Id: extensions.c,v 1.54 2001/03/22 04:54:58 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -61,6 +61,8 @@ static struct { { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, + { OFF, "GL_ARB_texture_env_combine", F(EXT_texture_env_combine) }, + { OFF, "GL_ARB_texture_env_dot3", F(EXT_texture_env_dot3) }, { ON, "GL_ARB_tranpose_matrix", 0 }, { ON, "GL_EXT_abgr", 0 }, { ON, "GL_EXT_bgra", 0 }, diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1a6a42a85c9..438ba6f142f 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.37 2001/03/18 08:53:50 gareth Exp $ */ +/* $Id: texstate.c,v 1.38 2001/03/22 04:54:58 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -55,6 +55,14 @@ #endif +/* XXX this is temporary, until GL/glext.h is updated. */ +#ifndef GL_DOT3_RGB_ARB +#define GL_DOT3_RGB_ARB 0x86AE +#endif +#ifndef GL_DOT3_RGBA_ARB +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + /**********************************************************************/ @@ -127,6 +135,8 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: + case GL_DOT3_RGB_ARB: + case GL_DOT3_RGBA_ARB: if (!ctx->Extensions.EXT_texture_env_dot3) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); return; @@ -272,7 +282,10 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (ctx->Extensions.EXT_texture_env_combine) { GLenum operand = (GLenum) (GLint) *param; switch (operand) { + case GL_SRC_COLOR: /* ARB combine only */ + case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ if (texUnit->CombineOperandRGB[2] == operand) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -292,6 +305,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) GLenum operand = (GLenum) (GLint) *param; switch (operand) { case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ if (texUnit->CombineOperandA[2] == operand) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 6bbf4821197..c4512480d53 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.17 2001/03/21 16:04:49 brianp Exp $ */ +/* $Id: s_texture.c,v 1.18 2001/03/22 04:54:58 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -38,6 +38,14 @@ #include "s_texture.h" +/* XXX this is temporary, until GL/glext.h is updated. */ +#ifndef GL_DOT3_RGB_ARB +#define GL_DOT3_RGB_ARB 0x86AE +#endif +#ifndef GL_DOT3_RGBA_ARB +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + /* * These values are used in the fixed-point arithmetic used @@ -1689,6 +1697,9 @@ texture_combine(const GLcontext *ctx, ASSERT(ctx->Extensions.EXT_texture_env_combine); + /* + * Do operand setup for up to 3 operands. Loop over the terms. + */ for (j = 0; j < 3; j++) { switch (textureUnit->CombineSourceA[j]) { case GL_TEXTURE: @@ -1763,7 +1774,8 @@ texture_combine(const GLcontext *ctx, dst[i][BCOMP] = src[i][ACOMP]; } } - else { /* GL_ONE_MINUS_SRC_ALPHA */ + else { + ASSERT(textureUnit->CombineOperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); src = (const GLchan (*)[4]) argA[j]; for (i = 0; i < n; i++) { dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP]; @@ -1794,6 +1806,9 @@ texture_combine(const GLcontext *ctx, } } + /* + * Do the texture combine. + */ switch (textureUnit->CombineModeRGB) { case GL_REPLACE: { @@ -1887,6 +1902,8 @@ texture_combine(const GLcontext *ctx, break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: + case GL_DOT3_RGB_ARB: + case GL_DOT3_RGBA_ARB: { const GLubyte (*arg0)[4] = (const GLubyte (*)[4]) argRGB[0]; const GLubyte (*arg1)[4] = (const GLubyte (*)[4]) argRGB[1]; @@ -1980,7 +1997,8 @@ texture_combine(const GLcontext *ctx, /* Fix the alpha component for GL_DOT3_RGBA_EXT combining. */ - if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT) { + if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT || + textureUnit->CombineModeRGB == GL_DOT3_RGBA_ARB) { for (i = 0; i < n; i++) { rgba[i][ACOMP] = rgba[i][RCOMP]; } -- 2.30.2