From: Brian Paul Date: Wed, 28 Jan 2009 23:49:28 +0000 (-0700) Subject: mesa: remove GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26da28c995557c8b913e5ccfe31b31dc32e6c735;p=mesa.git mesa: remove GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture Everyone should be using the newer/better ARB versions of these extensions. --- diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index ef8759ba6a7..621bd4afacf 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -48,6 +48,8 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0

Changes

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 825c841ee21..3be7fd5a2d6 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -820,15 +820,9 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate) _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, obj->MaxAnisotropy); } - if (ctx->Extensions.SGIX_shadow) { - _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, - obj->CompareFlag); - _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, - obj->CompareOperator); - } - if (ctx->Extensions.SGIX_shadow_ambient) { - _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, - obj->ShadowAmbient); + if (ctx->Extensions.ARB_shadow_ambient) { + _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, + obj->CompareFailValue); } } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 86144c42ad8..4ebdb5d9aea 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -62,7 +62,7 @@ static const struct { { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, - { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, + { OFF, "GL_ARB_shadow_ambient", F(ARB_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) }, @@ -170,8 +170,6 @@ static const struct { { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { OFF, "GL_SGIX_depth_texture", F(ARB_depth_texture) }, - { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, - { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, }; @@ -214,6 +212,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ #endif ctx->Extensions.ARB_shadow = GL_TRUE; + ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; @@ -302,8 +301,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; - ctx->Extensions.SGIX_shadow = GL_TRUE; - ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; #endif diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8ab0d26f45d..da243eceacf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1433,11 +1433,9 @@ struct gl_texture_object GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ - GLboolean CompareFlag; /**< GL_SGIX_shadow */ - GLenum CompareOperator; /**< GL_SGIX_shadow */ - GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ + GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */ GLenum _Function; /**< Comparison function derived from * \c CompareOperator, \c CompareMode, and * \c CompareFunc. @@ -2563,6 +2561,7 @@ struct gl_extensions GLboolean ARB_shading_language_100; GLboolean ARB_shading_language_120; GLboolean ARB_shadow; + GLboolean ARB_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; @@ -2660,8 +2659,6 @@ struct gl_extensions GLboolean SGIS_generate_mipmap; GLboolean SGIS_texture_edge_clamp; GLboolean SGIS_texture_lod; - GLboolean SGIX_shadow; - GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; /*@}*/ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index fad39a06347..4e6cf439fc1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -134,12 +134,10 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MaxAnisotropy = 1.0; - obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ - obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ obj->CompareMode = GL_NONE; /* ARB_shadow */ obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->CompareFailValue = 0.0F; /* ARB_shadow_ambient */ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ - obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ obj->Swizzle[0] = GL_RED; obj->Swizzle[1] = GL_GREEN; obj->Swizzle[2] = GL_BLUE; @@ -248,11 +246,9 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->BaseLevel = src->BaseLevel; dest->MaxLevel = src->MaxLevel; dest->MaxAnisotropy = src->MaxAnisotropy; - dest->CompareFlag = src->CompareFlag; - dest->CompareOperator = src->CompareOperator; - dest->ShadowAmbient = src->ShadowAmbient; dest->CompareMode = src->CompareMode; dest->CompareFunc = src->CompareFunc; + dest->CompareFailValue = src->CompareFailValue; dest->DepthMode = src->DepthMode; dest->_MaxLevel = src->_MaxLevel; dest->_MaxLambda = src->_MaxLambda; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 41c914e5b32..f610fa8dda4 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -260,30 +260,6 @@ set_tex_parameteri(GLcontext *ctx, texObj->MaxLevel = params[0]; return; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); - } - return; - - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow && - (params[0] == GL_TEXTURE_LEQUAL_R_SGIX || - params[0] == GL_TEXTURE_GEQUAL_R_SGIX)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareOperator = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); - } - return; - case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -454,14 +430,14 @@ set_tex_parameterf(GLcontext *ctx, } return; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); + texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); } else { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); + "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)"); } return; @@ -512,8 +488,6 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_TEXTURE_WRAP_R: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_GENERATE_MIPMAP_SGIS: case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: @@ -556,8 +530,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_TEXTURE_WRAP_R: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_GENERATE_MIPMAP_SGIS: case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: @@ -613,7 +585,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { GLfloat fparam = (GLfloat) param; /* convert int param to float */ @@ -662,7 +634,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { /* convert int param to float */ GLfloat fparam = (GLfloat) params[0]; @@ -1060,23 +1032,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) else error = GL_TRUE; break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareFlag; - } - else - error = GL_TRUE; - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareOperator; - } - else - error = GL_TRUE; - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = obj->ShadowAmbient; + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { + *params = obj->CompareFailValue; } else error = GL_TRUE; @@ -1248,25 +1206,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) error = GL_TRUE; } break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareFlag; - } - else { - error = GL_TRUE; - } - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareOperator; - } - else { - error = GL_TRUE; - } - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { + *params = (GLint) FLOAT_TO_INT(obj->CompareFailValue); } else { error = GL_TRUE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 7cddec0bcec..f7a4d8b323b 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -404,16 +404,6 @@ update_texture_compare_function(GLcontext *ctx, */ tObj->_Function = GL_NONE; } - else if (tObj->CompareFlag) { - /* GL_SGIX_shadow */ - if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - tObj->_Function = GL_LEQUAL; - } - else { - ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); - tObj->_Function = GL_GEQUAL; - } - } else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { /* GL_ARB_shadow */ tObj->_Function = tObj->CompareFunc; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 615826b2106..3ce60427bf4 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -493,10 +493,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; if (texObj) { - value[0] = texObj->ShadowAmbient; - value[1] = texObj->ShadowAmbient; - value[2] = texObj->ShadowAmbient; - value[3] = texObj->ShadowAmbient; + value[0] = + value[1] = + value[2] = + value[3] = texObj->CompareFailValue; } } return; @@ -777,7 +777,7 @@ append_token(char *dst, gl_state_index k) append(dst, "PCMbias"); break; case STATE_SHADOW_AMBIENT: - append(dst, "ShadowAmbient"); + append(dst, "CompareFailValue"); break; default: /* probably STATE_INTERNAL_DRIVER+i (driver private state) */ diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index a095b255ab5..8d72018cf4f 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -2826,7 +2826,7 @@ sample_depth_texture( GLcontext *ctx, tObj->Target == GL_TEXTURE_1D_ARRAY_EXT || tObj->Target == GL_TEXTURE_2D_ARRAY_EXT); - UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->CompareFailValue); /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ @@ -3156,103 +3156,6 @@ sample_depth_texture( GLcontext *ctx, } -#if 0 -/* - * Experimental depth texture sampling function. - */ -static void -sample_depth_texture2(const GLcontext *ctx, - const struct gl_texture_unit *texUnit, - GLuint n, const GLfloat texcoords[][4], - GLchan texel[][4]) -{ - const struct gl_texture_object *texObj = texUnit->_Current; - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; - const GLuint width = texImage->Width; - const GLuint height = texImage->Height; - GLchan ambient; - GLboolean lequal, gequal; - - if (texObj->Target != GL_TEXTURE_2D) { - _mesa_problem(ctx, "only 2-D depth textures supported at this time"); - return; - } - - if (texObj->MinFilter != texObj->MagFilter) { - _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); - 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->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { - _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); - return; - } - - UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); - - if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - lequal = GL_TRUE; - gequal = GL_FALSE; - } - else { - lequal = GL_FALSE; - gequal = GL_TRUE; - } - - { - GLuint i; - for (i = 0; i < n; i++) { - const GLint K = 3; - GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; - GLfloat w; - GLchan lum; - col = nearest_texel_location(texObj->WrapS, img, width, - texcoords[i][0]); - row = nearest_texel_location(texObj->WrapT, img, height, - texcoords[i][1]); - - imin = col - K; - imax = col + K; - jmin = row - K; - jmax = row + K; - - if (imin < 0) imin = 0; - if (imax >= width) imax = width - 1; - if (jmin < 0) jmin = 0; - if (jmax >= height) jmax = height - 1; - - samples = (imax - imin + 1) * (jmax - jmin + 1); - count = 0; - for (jj = jmin; jj <= jmax; jj++) { - for (ii = imin; ii <= imax; ii++) { - GLfloat depthSample; - texImage->FetchTexelf(texImage, ii, jj, 0, &depthSample); - if ((depthSample <= r[i] && lequal) || - (depthSample >= r[i] && gequal)) { - count++; - } - } - } - - w = (GLfloat) count / (GLfloat) samples; - w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); - lum = (GLint) w; - - texel[i][RCOMP] = lum; - texel[i][GCOMP] = lum; - texel[i][BCOMP] = lum; - texel[i][ACOMP] = CHAN_MAX; - } - } -} -#endif - - /** * We use this function when a texture object is in an "incomplete" state. * When a fragment program attempts to sample an incomplete texture we