diff options
author | Brian Paul <[email protected]> | 2001-04-17 21:25:53 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-04-17 21:25:53 +0000 |
commit | bcfe3936a8722f43639ad853649c7f0ea8591cf3 (patch) | |
tree | 209385bdbc9277c6b72f5905e77b278ee3f0ab53 /src/mesa/swrast/s_texture.c | |
parent | 15eddf38fb2418f2e9703569e66e9f94a614e405 (diff) |
Fixed a number of minor GL_ARB_texture_env_combine/dot3 issues.
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r-- | src/mesa/swrast/s_texture.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 7f932f8b13e..78c38c07fd9 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.23 2001/04/12 15:18:07 brianp Exp $ */ +/* $Id: s_texture.c,v 1.24 2001/04/17 21:25:53 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -52,6 +52,10 @@ #define GL_CLAMP_TO_BORDER_ARB 0x812D #endif +#ifndef GL_SUBTRACT_ARB +#define GL_SUBTRACT_ARB 0x84E7 +#endif + /* * These values are used in the fixed-point arithmetic used @@ -1763,7 +1767,8 @@ texture_combine(const GLcontext *ctx, const GLuint RGBshift = textureUnit->CombineScaleShiftRGB; const GLuint Ashift = textureUnit->CombineScaleShiftA; - ASSERT(ctx->Extensions.EXT_texture_env_combine); + ASSERT(ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine); /* * Do operand setup for up to 3 operands. Loop over the terms. @@ -1968,6 +1973,20 @@ texture_combine(const GLcontext *ctx, } } break; + case GL_SUBTRACT_ARB: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { + GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift; + GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift; + GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); + } + } + break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: case GL_DOT3_RGB_ARB: @@ -2059,6 +2078,17 @@ texture_combine(const GLcontext *ctx, } } break; + case GL_SUBTRACT_ARB: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + for (i = 0; i < n; i++) { + GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << RGBshift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); + } + } + break; + default: _mesa_problem(NULL, "invalid combine mode"); } |