mesa: remove GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture
authorBrian Paul <brianp@vmware.com>
Wed, 28 Jan 2009 23:49:28 +0000 (16:49 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 28 Jan 2009 23:49:28 +0000 (16:49 -0700)
Everyone should be using the newer/better ARB versions of these extensions.

docs/relnotes-7.5.html
src/mesa/main/attrib.c
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/main/texstate.c
src/mesa/shader/prog_statevars.c
src/mesa/swrast/s_texfilter.c

index ef8759ba6a70c76bf93b230383debe371031ffd4..621bd4afacf03254bbe265d3e8960751b218c131 100644 (file)
@@ -48,6 +48,8 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
 
 <h2>Changes</h2>
 <ul>
+<li>Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and
+GL_SGIX_depth_texture extensions.  Superseded by the ARB versions.
 </ul>
 
 </body>
index 825c841ee21801bfcb4ddecbf9094457edb35843..3be7fd5a2d6be8888f119dbed01de711893b95e8 100644 (file)
@@ -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);
          }
       }
 
index 86144c42ad8d1d032e3a5d8833e62248fb4da8f3..4ebdb5d9aeacbc8f6ccc3fd485252b9ce66f5bd7 100644 (file)
@@ -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
index 8ab0d26f45df10b228716d53c1442316f2f1e978..da243eceacf16f6868b35efb05b001ba2f20be66 100644 (file)
@@ -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;
    /*@}*/
index fad39a063476b7494e377bc8750de8f94c683b90..4e6cf439fc14b009094098fe79f75e8eea1b1f06 100644 (file)
@@ -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;
index 41c914e5b32c9d7149ee2a04b70a05dec9ee90a2..f610fa8dda4d8b45595bf1920dd56374e5d05728 100644 (file)
@@ -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;
index 7cddec0bcec719c49dd5dc497ea3197611bb80d8..f7a4d8b323b7326a7b87baefced8e05d41f95125 100644 (file)
@@ -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;
index 615826b21067901894b77227a67eae0f44cdf422..3ce60427bf47c3237877a8ab15cb69dfa0999401 100644 (file)
@@ -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) */
index a095b255ab51cae95d3a8052e2953eec4733a486..8d72018cf4f7a9cae5556c7599955469bc73f9f6 100644 (file)
@@ -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