diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/extensions.c | 8 | ||||
-rw-r--r-- | src/mesa/main/get.c | 6 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 18 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 11 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 166 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 128 |
6 files changed, 266 insertions, 71 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 75b1f3967d..75bbb05281 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.66 2001/11/19 00:41:32 brianp Exp $ */ +/* $Id: extensions.c,v 1.67 2001/12/04 23:44:55 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -56,9 +56,12 @@ static struct { const char *name; int flag_offset; } default_extensions[] = { + { OFF, "GL_ARB_depth_texture", F(SGIX_depth_texture) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, + { OFF, "GL_ARB_shadow", F(ARB_shadow) }, + { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, @@ -133,8 +136,11 @@ void _mesa_enable_sw_extensions(GLcontext *ctx) { const char *extensions[] = { + "GL_ARB_depth_texture", "GL_ARB_imaging", "GL_ARB_multitexture", + "GL_ARB_shadow", + "GL_ARB_shadow_ambient", "GL_ARB_texture_border_clamp", "GL_ARB_texture_cube_map", "GL_ARB_texture_env_add", diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index b7f5d09b79..2e51305601 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.72 2001/11/06 15:53:00 brianp Exp $ */ +/* $Id: get.c,v 1.73 2001/12/04 23:44:56 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -5366,8 +5366,8 @@ _mesa_GetString( GLenum name ) GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; - static const char *version_1_2 = "1.2 Mesa 4.1"; - static const char *version_1_3 = "1.3 Mesa 4.1"; + static const char *version_1_2 = "1.2 Mesa 4.1 beta"; + static const char *version_1_3 = "1.3 Mesa 4.1 beta"; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f8d330b75c..865978214d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.53 2001/11/18 23:52:37 brianp Exp $ */ +/* $Id: mtypes.h,v 1.54 2001/12/04 23:44:56 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -269,7 +269,7 @@ struct gl_colorbuffer_attrib { GLenum DrawBuffer; /* Which buffer to draw into */ GLenum DriverDrawBuffer; /* Current device driver dest buffer */ - GLboolean MultiDrawBuffer; /* Drawing to mutliple buffers? */ + GLboolean MultiDrawBuffer; /* Drawing to multiple buffers? */ GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ /* alpha testing */ @@ -556,6 +556,7 @@ struct gl_pixel_attrib { GLboolean MapColorFlag; GLboolean MapStencilFlag; GLfloat ZoomX, ZoomY; + /* XXX move these out of gl_pixel_attrib */ GLint MapStoSsize; /* Size of each pixel map */ GLint MapItoIsize; GLint MapItoRsize; @@ -827,7 +828,8 @@ struct gl_texture_object { GLuint Name; /* an unsigned integer */ GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */ GLfloat Priority; /* in [0,1] */ - GLchan BorderColor[4]; + GLfloat BorderValues[4]; /* unclamped */ + GLchan BorderColor[4]; /* clamped, as GLchan */ GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */ GLenum WrapT; /* GL_CLAMP_TO_EDGE, and */ GLenum WrapR; /* GL_CLAMP_TO_BORDER_ARB */ @@ -840,7 +842,10 @@ struct gl_texture_object { GLfloat MaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ GLboolean CompareFlag; /* GL_SGIX_shadow */ GLenum CompareOperator; /* GL_SGIX_shadow */ - GLchan ShadowAmbient; /* GL_SGIX_shadow_ambient */ + GLchan ShadowAmbient; /* GL_SGIX/ARB_shadow_ambient */ + GLenum CompareMode; /* GL_ARB_shadow */ + GLenum CompareFunc; /* GL_ARB_shadow */ + GLenum CompareResult; /* GL_ARB_shadow */ GLint _MaxLevel; /* actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */ GLboolean GenerateMipmap; /* GL_SGIS_generate_mipmap */ @@ -1198,6 +1203,7 @@ struct gl_extensions { GLboolean ARB_imaging; GLboolean ARB_multisample; GLboolean ARB_multitexture; + GLboolean ARB_shadow; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; @@ -1245,10 +1251,10 @@ struct gl_extensions { GLboolean SGIS_generate_mipmap; GLboolean SGIS_pixel_texture; GLboolean SGIS_texture_edge_clamp; - GLboolean SGIX_depth_texture; + GLboolean SGIX_depth_texture; /* or GL_ARB_depth_texture */ GLboolean SGIX_pixel_texture; GLboolean SGIX_shadow; - GLboolean SGIX_shadow_ambient; + GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean _3DFX_texture_compression_FXT1; }; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index a0af0f25ab..a8a27ef3ed 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.50 2001/07/27 14:30:50 brianp Exp $ */ +/* $Id: texobj.c,v 1.51 2001/12/04 23:44:56 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -80,9 +80,12 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MaxAnisotropy = 1.0; - obj->CompareFlag = GL_FALSE; - obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; - obj->ShadowAmbient = 0; + obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ + obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ + obj->CompareMode = GL_LUMINANCE; /* ARB_shadow */ + obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->CompareResult = GL_LUMINANCE; /* ARB_shadow */ + obj->ShadowAmbient = 0; /* ARB/SGIX_shadow_ambient */ _mesa_init_colortable(&obj->Palette); /* insert into linked list */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 06c3f81871..6621ea417b 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.59 2001/11/06 15:53:00 brianp Exp $ */ +/* $Id: texstate.c,v 1.60 2001/12/04 23:44:56 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -42,6 +42,13 @@ #include "math/m_matrix.h" #endif +/* TEMPORARY! */ +#ifndef GL_TEXTURE_COMPARE_MODE_ARB +#define GL_TEXTURE_COMPARE_MODE_ARB 0x9990 +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x9991 +#define GL_TEXTURE_COMPARE_RESULT_ARB 0x9992 +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x9993 +#endif #ifdef SPECIALCAST @@ -967,12 +974,27 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); } break; - case GL_TEXTURE_BORDER_COLOR: +#if 0 /* someday */ + case GL_TEXTUER_BORDER_VALUES_NV: + /* don't clamp */ + COPY_4V(texObj->BorderValues, params); UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], params[0]); UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], params[1]); UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], params[2]); UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], params[3]); break; +#endif + case GL_TEXTURE_BORDER_COLOR: + /* clamp */ + texObj->BorderValues[0] = CLAMP(params[0], 0.0F, 1.0F); + texObj->BorderValues[1] = CLAMP(params[1], 0.0F, 1.0F); + texObj->BorderValues[2] = CLAMP(params[2], 0.0F, 1.0F); + texObj->BorderValues[3] = CLAMP(params[3], 0.0F, 1.0F); + UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], texObj->BorderValues[0]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], texObj->BorderValues[1]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], texObj->BorderValues[2]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], texObj->BorderValues[3]); + break; case GL_TEXTURE_MIN_LOD: texObj->MinLod = params[0]; break; @@ -1038,7 +1060,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { UNCLAMPED_FLOAT_TO_CHAN(texObj->ShadowAmbient, params[0]); } @@ -1058,6 +1080,62 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum mode = (GLenum) params[0]; + if (mode == GL_LUMINANCE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { + texObj->CompareMode = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum func = (GLenum) params[0]; + if (func == GL_LEQUAL || func == GL_GEQUAL) { + texObj->CompareFunc = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + break; + case GL_TEXTURE_COMPARE_RESULT_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum result = (GLenum) params[0]; + if (result == GL_LUMINANCE || result == GL_INTENSITY + || result == GL_ALPHA) { + texObj->CompareResult = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_RESULT_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_RESULT_ARB)"); + return; + } + break; + default: { char s[100]; @@ -1321,7 +1399,17 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) case GL_TEXTURE_WRAP_R_EXT: *params = ENUM_TO_FLOAT(obj->WrapR); return; +#if 0 /* someday */ + case GL_TEXTURE_BORDER_VALUES_NV: + /* unclamped */ + params[0] = obj->BorderValues[0]; + params[1] = obj->BorderValues[1]; + params[2] = obj->BorderValues[2]; + params[3] = obj->BorderValues[3]; + return; +#endif case GL_TEXTURE_BORDER_COLOR: + /* clamped */ params[0] = obj->BorderColor[0] / CHAN_MAXF; params[1] = obj->BorderColor[1] / CHAN_MAXF; params[2] = obj->BorderColor[2] / CHAN_MAXF; @@ -1364,7 +1452,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { *params = CHAN_TO_FLOAT(obj->ShadowAmbient); return; @@ -1376,6 +1464,24 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) return; } break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareFunc; + return; + } + break; + case GL_TEXTURE_COMPARE_RESULT_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareResult; + return; + } + break; default: ; /* silence warnings */ } @@ -1414,17 +1520,27 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) case GL_TEXTURE_WRAP_R_EXT: *params = (GLint) obj->WrapR; return; +#if 0 /* someday */ + case GL_TEXTURE_BORDER_VALUES_NV: + /* unclamped */ + params[0] = FLOAT_TO_INT(obj->BorderValues[0]); + params[1] = FLOAT_TO_INT(obj->BorderValues[1]); + params[2] = FLOAT_TO_INT(obj->BorderValues[2]); + params[3] = FLOAT_TO_INT(obj->BorderValues[3]); + return; +#endif case GL_TEXTURE_BORDER_COLOR: + /* clamped */ { - GLfloat color[4]; - color[0] = obj->BorderColor[0] / CHAN_MAXF; - color[1] = obj->BorderColor[1] / CHAN_MAXF; - color[2] = obj->BorderColor[2] / CHAN_MAXF; - color[3] = obj->BorderColor[3] / CHAN_MAXF; - params[0] = FLOAT_TO_INT( color[0] ); - params[1] = FLOAT_TO_INT( color[1] ); - params[2] = FLOAT_TO_INT( color[2] ); - params[3] = FLOAT_TO_INT( color[3] ); + GLfloat b[4]; + b[0] = CLAMP(obj->BorderValues[0], 0.0F, 1.0F); + b[1] = CLAMP(obj->BorderValues[1], 0.0F, 1.0F); + b[2] = CLAMP(obj->BorderValues[2], 0.0F, 1.0F); + b[3] = CLAMP(obj->BorderValues[3], 0.0F, 1.0F); + params[0] = FLOAT_TO_INT(b[0]); + params[1] = FLOAT_TO_INT(b[1]); + params[2] = FLOAT_TO_INT(b[2]); + params[3] = FLOAT_TO_INT(b[3]); } return; case GL_TEXTURE_RESIDENT: @@ -1464,10 +1580,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { - /* XXX range? */ - *params = (GLint) CHAN_TO_FLOAT(obj->ShadowAmbient); + GLfloat a = CHAN_TO_FLOAT(obj->ShadowAmbient); + *params = (GLint) FLOAT_TO_INT(a); return; } break; @@ -1477,6 +1593,24 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareFunc; + return; + } + break; + case GL_TEXTURE_COMPARE_RESULT_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareResult; + return; + } + break; default: ; /* silence warnings */ } diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index e1e1d0f0ce..b849e19177 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.42 2001/11/19 01:18:28 brianp Exp $ */ +/* $Id: s_texture.c,v 1.43 2001/12/04 23:44:56 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2722,6 +2722,9 @@ sample_depth_texture(const GLcontext *ctx, const GLuint height = texImage->Height; const GLchan ambient = texObj->ShadowAmbient; GLboolean lequal, gequal; + GLchan result; + + ASSERT(texObj->Image[texObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); if (texObj->Dimensions != 2) { _mesa_problem(ctx, "only 2-D depth textures supported at this time"); @@ -2733,22 +2736,36 @@ sample_depth_texture(const GLcontext *ctx, return; } - /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if - * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object - * isn't a depth texture. - */ - if (texImage->Format != GL_DEPTH_COMPONENT) { - _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); - return; + /* XXX this could be precomputed */ + if (texObj->CompareFlag) { + /* GL_SGIX_shadow */ + if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { + lequal = GL_TRUE; + gequal = GL_FALSE; + } + else { + ASSERT(texObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); + lequal = GL_FALSE; + gequal = GL_TRUE; + } } - - if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - lequal = GL_TRUE; - gequal = GL_FALSE; + else if (texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + /* GL_ARB_shadow */ + if (texObj->CompareFunc == GL_LEQUAL) { + lequal = GL_TRUE; + gequal = GL_FALSE; + } + else { + ASSERT(texObj->CompareFunc == GL_GEQUAL); + lequal = GL_FALSE; + gequal = GL_TRUE; + } } else { - lequal = GL_FALSE; - gequal = GL_TRUE; + /* Treat this depth texture as a luminance texture */ + _mesa_warning(ctx, + "Treating GL_DEPTH_COMPONENT as GL_LUMINANCE not implemented yet"); + return; } if (texObj->MagFilter == GL_NEAREST) { @@ -2761,16 +2778,33 @@ sample_depth_texture(const GLcontext *ctx, depthSample = *((const GLfloat *) texImage->Data + row * width + col); if ((r[i] <= depthSample && lequal) || (r[i] >= depthSample && gequal)) { - texel[i][RCOMP] = CHAN_MAX; - texel[i][GCOMP] = CHAN_MAX; - texel[i][BCOMP] = CHAN_MAX; - texel[i][ACOMP] = CHAN_MAX; + result = CHAN_MAX; } else { - texel[i][RCOMP] = ambient; - texel[i][GCOMP] = ambient; - texel[i][BCOMP] = ambient; + result = ambient; + } + + switch (texObj->CompareResult) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad texture compare result value"); } } } @@ -2838,16 +2872,10 @@ sample_depth_texture(const GLcontext *ctx, + w01 * depth01 + w11 * depth11; if ((depthSample <= r[i] && lequal) || (depthSample >= r[i] && gequal)) { - texel[i][RCOMP] = ambient; - texel[i][GCOMP] = ambient; - texel[i][BCOMP] = ambient; - texel[i][ACOMP] = CHAN_MAX; + result = ambient; } else { - texel[i][RCOMP] = CHAN_MAX; - texel[i][GCOMP] = CHAN_MAX; - texel[i][BCOMP] = CHAN_MAX; - texel[i][ACOMP] = CHAN_MAX; + result = CHAN_MAX; } } else { @@ -2857,7 +2885,6 @@ sample_depth_texture(const GLcontext *ctx, */ const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; GLfloat luminance = CHAN_MAXF; - GLchan lum; if (lequal) { if (depth00 <= r[i]) luminance -= d; if (depth01 <= r[i]) luminance -= d; @@ -2870,14 +2897,33 @@ sample_depth_texture(const GLcontext *ctx, if (depth10 >= r[i]) luminance -= d; if (depth11 >= r[i]) luminance -= d; } - lum = (GLchan) luminance; - texel[i][RCOMP] = lum; - texel[i][GCOMP] = lum; - texel[i][BCOMP] = lum; + result = (GLchan) luminance; + } + + switch (texObj->CompareResult) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad texture compare result value"); } - } - } + } /* for */ + } /* if filter */ } @@ -2990,6 +3036,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; if (textureUnit->_Current) { /* XXX need this? */ + const struct gl_texture_object *curObj = textureUnit->_Current; GLchan texel[PB_SIZE][4]; if (textureUnit->LodBias != 0.0F) { @@ -3000,12 +3047,11 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, } } - if ((textureUnit->_Current->MinLod != -1000.0 - || textureUnit->_Current->MaxLod != 1000.0) + if ((curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) && lambda) { /* apply LOD clamping to lambda */ - const GLfloat min = textureUnit->_Current->MinLod; - const GLfloat max = textureUnit->_Current->MaxLod; + const GLfloat min = curObj->MinLod; + const GLfloat max = curObj->MaxLod; GLuint i; for (i=0;i<n;i++) { GLfloat l = lambda[i]; @@ -3014,7 +3060,7 @@ _swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, } /* Sample the texture. */ - if (textureUnit->_Current->CompareFlag) { + if (curObj->Image[curObj->BaseLevel]->Format == GL_DEPTH_COMPONENT) { /* depth texture */ sample_depth_texture(ctx, textureUnit, n, s, t, r, texel); } |