mesa: Kill GL_ARB_shadow_ambient with fire
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 11 Aug 2012 02:16:37 +0000 (19:16 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 14 Aug 2012 17:40:04 +0000 (10:40 -0700)
No driver supports this extension, and it seems unlikely than any driver
ever will.  I think r300c may have supported it at one time, but that
driver has already been removed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/drivers/r300/compiler/radeon_compiler.h
src/gallium/drivers/r300/compiler/radeon_program_tex.c
src/mesa/main/attrib.c
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/main/samplerobj.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/program/prog_statevars.c
src/mesa/program/prog_statevars.h
src/mesa/swrast/s_texfilter.c

index d42cee9cce1f836bb13bca008e273e58343a02de..f78a51c19c3f544c9f926d0f995666eb8782815c 100644 (file)
@@ -114,7 +114,6 @@ struct r300_fragment_program_compiler {
        struct rX00_fragment_program_code *code;
        /* Optional transformations and features. */
        struct r300_fragment_program_external_state state;
-       unsigned enable_shadow_ambient;
        /* Register corresponding to the depthbuffer. */
        unsigned OutputDepth;
        /* Registers corresponding to the four colorbuffers. */
index 9d69ebd18fbe1b79b1e93dc3465b9a3dadb03d6f..8dfcd54d2387655916509c98b10e9c51244d3aec 100644 (file)
@@ -37,17 +37,8 @@ static struct rc_src_register shadow_fail_value(struct r300_fragment_program_com
 {
        struct rc_src_register reg = { 0, 0, 0, 0, 0, 0 };
 
-       if (compiler->enable_shadow_ambient) {
-               reg.File = RC_FILE_CONSTANT;
-               reg.Index = rc_constants_add_state(&compiler->Base.Program.Constants,
-                                                  RC_STATE_SHADOW_AMBIENT, tmu);
-               reg.Swizzle = RC_SWIZZLE_WWWW;
-       } else {
-               reg.File = RC_FILE_NONE;
-               reg.Swizzle = RC_SWIZZLE_0000;
-       }
-
-       reg.Swizzle = combine_swizzles(reg.Swizzle,
+       reg.File = RC_FILE_NONE;
+       reg.Swizzle = combine_swizzles(RC_SWIZZLE_0000,
                                compiler->state.unit[tmu].texture_swizzle);
        return reg;
 }
index 9cab35b0c375833e22706d19761d4218f44c04ba..1a04eebdd1963a952183073257331ec967052e43 100644 (file)
@@ -805,10 +805,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
             _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
                                 samp->MaxAnisotropy);
          }
-         if (ctx->Extensions.ARB_shadow_ambient) {
-            _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB,
-                                samp->CompareFailValue);
-         }
          if (ctx->Extensions.ARB_shadow) {
             _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE,
                                 samp->CompareMode);
index 521fe14dba53176732c4ec040e6cd3a86c0694da..7f3aa940a007d4126c8919ec32636614fb37239a 100644 (file)
@@ -120,7 +120,6 @@ static const struct extension extension_table[] = {
    { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
    { "GL_ARB_shader_texture_lod",                  o(ARB_shader_texture_lod),                  GL,             2009 },
    { "GL_ARB_shading_language_100",                o(ARB_shading_language_100),                GLL,            2003 },
-   { "GL_ARB_shadow_ambient",                      o(ARB_shadow_ambient),                      GL,             2001 },
    { "GL_ARB_shadow",                              o(ARB_shadow),                              GLL,            2001 },
    { "GL_ARB_sync",                                o(ARB_sync),                                GL,             2003 },
    { "GL_ARB_texture_border_clamp",                o(ARB_texture_border_clamp),                GLL,            2000 },
@@ -427,7 +426,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
 #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;
index 8fcb6b45694e31f00ce657d81b17eacca2715fca..552c1cf69dea49436005c2c4cbabf934b6f088fa 100644 (file)
@@ -1250,7 +1250,6 @@ struct gl_sampler_object
    GLfloat MaxAnisotropy;      /**< GL_EXT_texture_filter_anisotropic */
    GLenum CompareMode;         /**< GL_ARB_shadow */
    GLenum CompareFunc;         /**< GL_ARB_shadow */
-   GLfloat CompareFailValue;    /**< GL_ARB_shadow_ambient */
    GLenum sRGBDecode;           /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
    GLboolean CubeMapSeamless;   /**< GL_AMD_seamless_cubemap_per_texture */
 };
@@ -2972,7 +2971,6 @@ struct gl_extensions
    GLboolean ARB_shader_texture_lod;
    GLboolean ARB_shading_language_100;
    GLboolean ARB_shadow;
-   GLboolean ARB_shadow_ambient;
    GLboolean ARB_sync;
    GLboolean ARB_texture_border_clamp;
    GLboolean ARB_texture_buffer_object;
index dc8adfc3f728b7652dd15cc12954cb702c7a4450..8bf5f490a127600949c0a5f1fbeea90661fed013 100644 (file)
@@ -130,7 +130,6 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
    sampObj->MaxAnisotropy = 1.0F;
    sampObj->CompareMode = GL_NONE;
    sampObj->CompareFunc = GL_LEQUAL;
-   sampObj->CompareFailValue = 0.0;
    sampObj->sRGBDecode = GL_DECODE_EXT;
    sampObj->CubeMapSeamless = GL_FALSE;
 }
index f70da4fbc94162b59eada1bd75bccf97edfe83b1..02e37bebc5ec0569f6d7c010154ea45d9b88984d 100644 (file)
@@ -144,7 +144,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
    obj->Sampler.MaxAnisotropy = 1.0;
    obj->Sampler.CompareMode = GL_NONE;         /* ARB_shadow */
    obj->Sampler.CompareFunc = GL_LEQUAL;       /* ARB_shadow */
-   obj->Sampler.CompareFailValue = 0.0F;       /* ARB_shadow_ambient */
    obj->DepthMode = GL_LUMINANCE;
    obj->Sampler.CubeMapSeamless = GL_FALSE;
    obj->Swizzle[0] = GL_RED;
@@ -257,7 +256,6 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
    dest->Sampler.MaxAnisotropy = src->Sampler.MaxAnisotropy;
    dest->Sampler.CompareMode = src->Sampler.CompareMode;
    dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
-   dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
    dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
    dest->DepthMode = src->DepthMode;
    dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
index 9e7c3e4578287823f7fd08067cfc319178ca5ace..690fd6c25626e761eaa8a1a35f5ade4b1dc36af3 100644 (file)
@@ -541,20 +541,6 @@ set_tex_parameterf(struct gl_context *ctx,
       }
       return GL_FALSE;
 
-   case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
-      if (ctx->Extensions.ARB_shadow_ambient) {
-         if (texObj->Sampler.CompareFailValue != params[0]) {
-            flush(ctx);
-            texObj->Sampler.CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
-            return GL_TRUE;
-         }
-      }
-      else {
-         _mesa_error(ctx, GL_INVALID_ENUM,
-                    "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
-      }
-      return GL_FALSE;
-
    case GL_TEXTURE_LOD_BIAS:
       /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
       if (texObj->Sampler.LodBias != params[0]) {
@@ -1136,11 +1122,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
             goto invalid_pname;
          *params = obj->Sampler.MaxAnisotropy;
          break;
-      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
-         if (!ctx->Extensions.ARB_shadow_ambient)
-            goto invalid_pname;
-         *params = obj->Sampler.CompareFailValue;
-         break;
       case GL_GENERATE_MIPMAP_SGIS:
         *params = (GLfloat) obj->GenerateMipmap;
          break;
@@ -1282,11 +1263,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
             goto invalid_pname;
          *params = (GLint) obj->Sampler.MaxAnisotropy;
          break;
-      case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
-         if (!ctx->Extensions.ARB_shadow_ambient)
-            goto invalid_pname;
-         *params = (GLint) FLOAT_TO_INT(obj->Sampler.CompareFailValue);
-         break;
       case GL_GENERATE_MIPMAP_SGIS:
         *params = (GLint) obj->GenerateMipmap;
          break;
index 91212218e7a7bfb8e82448c2b5355ede37e604fb..f9c6677b19bbc6a6882117ccf3c585e48d979861 100644 (file)
@@ -551,22 +551,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
          value[3] = ctx->Pixel.AlphaBias;
          return;
 
-      case STATE_SHADOW_AMBIENT:
-         {
-            const int unit = (int) state[2];
-            const struct gl_texture_object *texObj
-               = ctx->Texture.Unit[unit]._Current;
-            const struct gl_sampler_object *samp =
-               _mesa_get_samplerobj(ctx, unit);
-            if (texObj) {
-               value[0] =
-               value[1] =
-               value[2] =
-               value[3] = samp->CompareFailValue;
-            }
-         }
-         return;
-
       case STATE_FB_SIZE:
          value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1);
          value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
@@ -702,7 +686,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
          return _NEW_MODELVIEW;
 
       case STATE_TEXRECT_SCALE:
-      case STATE_SHADOW_AMBIENT:
       case STATE_ROT_MATRIX_0:
       case STATE_ROT_MATRIX_1:
         return _NEW_TEXTURE;
@@ -918,9 +901,6 @@ append_token(char *dst, gl_state_index k)
    case STATE_PT_BIAS:
       append(dst, "PTbias");
       break;
-   case STATE_SHADOW_AMBIENT:
-      append(dst, "CompareFailValue");
-      break;
    case STATE_FB_SIZE:
       append(dst, "FbSize");
       break;
index 65baa7833cb9200ee45abdb3f57bca2ec1c248e4..efd0e030cb34b315a1238d2889ab1c86cb85e747 100644 (file)
@@ -124,7 +124,6 @@ typedef enum gl_state_index_ {
    STATE_LIGHT_HALF_VECTOR,           /* object vs eye space */
    STATE_PT_SCALE,              /**< Pixel transfer RGBA scale */
    STATE_PT_BIAS,               /**< Pixel transfer RGBA bias */
-   STATE_SHADOW_AMBIENT,        /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
    STATE_FB_SIZE,               /**< (width-1, height-1, 0, 0) */
    STATE_FB_WPOS_Y_TRANSFORM,   /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
    STATE_ROT_MATRIX_0,          /**< ATI_envmap_bumpmap, rot matrix row 0 */
index 51c8992087a1dd0f2335cae0626aae3536671e3a..3c2aae913561cbbead8faf605775ffddc49d2e16 100644 (file)
@@ -3345,34 +3345,33 @@ sample_lambda_1d_array(struct gl_context *ctx,
 
 
 /**
- * Compare texcoord against depth sample.  Return 1.0 or the ambient value.
+ * Compare texcoord against depth sample.  Return 1.0 or 0.0 value.
  */
 static inline GLfloat
-shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample,
-               GLfloat ambient)
+shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample)
 {
    switch (function) {
    case GL_LEQUAL:
-      return (coord <= depthSample) ? 1.0F : ambient;
+      return (coord <= depthSample) ? 1.0F : 0.0F;
    case GL_GEQUAL:
-      return (coord >= depthSample) ? 1.0F : ambient;
+      return (coord >= depthSample) ? 1.0F : 0.0F;
    case GL_LESS:
-      return (coord < depthSample) ? 1.0F : ambient;
+      return (coord < depthSample) ? 1.0F : 0.0F;
    case GL_GREATER:
-      return (coord > depthSample) ? 1.0F : ambient;
+      return (coord > depthSample) ? 1.0F : 0.0F;
    case GL_EQUAL:
-      return (coord == depthSample) ? 1.0F : ambient;
+      return (coord == depthSample) ? 1.0F : 0.0F;
    case GL_NOTEQUAL:
-      return (coord != depthSample) ? 1.0F : ambient;
+      return (coord != depthSample) ? 1.0F : 0.0F;
    case GL_ALWAYS:
       return 1.0F;
    case GL_NEVER:
-      return ambient;
+      return 0.0F;
    case GL_NONE:
       return depthSample;
    default:
       _mesa_problem(NULL, "Bad compare func in shadow_compare");
-      return ambient;
+      return 0.0F;
    }
 }
 
@@ -3384,9 +3383,9 @@ static inline GLfloat
 shadow_compare4(GLenum function, GLfloat coord,
                 GLfloat depth00, GLfloat depth01,
                 GLfloat depth10, GLfloat depth11,
-                GLfloat ambient, GLfloat wi, GLfloat wj)
+                GLfloat wi, GLfloat wj)
 {
-   const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F;
+   const GLfloat d = 0.25F;
    GLfloat luminance = 1.0F;
 
    switch (function) {
@@ -3429,13 +3428,13 @@ shadow_compare4(GLenum function, GLfloat coord,
    case GL_ALWAYS:
       return 1.0F;
    case GL_NEVER:
-      return ambient;
+      return 0.0F;
    case GL_NONE:
       /* ordinary bilinear filtering */
       return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
    default:
       _mesa_problem(NULL, "Bad compare func in sample_compare4");
-      return ambient;
+      return 0.0F;
    }
 }
 
@@ -3483,7 +3482,6 @@ sample_depth_texture( struct gl_context *ctx,
    const GLint depth = img->Depth;
    const GLuint compare_coord = (tObj->Target == GL_TEXTURE_2D_ARRAY_EXT)
        ? 3 : 2;
-   GLfloat ambient;
    GLenum function;
    GLfloat result;
 
@@ -3497,8 +3495,6 @@ sample_depth_texture( struct gl_context *ctx,
           tObj->Target == GL_TEXTURE_2D_ARRAY_EXT ||
           tObj->Target == GL_TEXTURE_CUBE_MAP);
 
-   ambient = samp->CompareFailValue;
-
    /* XXXX if samp->MinFilter != samp->MagFilter, we're ignoring lambda */
 
    function = (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ?
@@ -3522,7 +3518,7 @@ sample_depth_texture( struct gl_context *ctx,
 
          depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
 
-         result = shadow_compare(function, depthRef, depthSample, ambient);
+         result = shadow_compare(function, depthRef, depthSample);
 
          switch (tObj->DepthMode) {
          case GL_LUMINANCE:
@@ -3617,7 +3613,7 @@ sample_depth_texture( struct gl_context *ctx,
 
          result = shadow_compare4(function, depthRef,
                                   depth00, depth01, depth10, depth11,
-                                  ambient, wi, wj);
+                                  wi, wj);
 
          switch (tObj->DepthMode) {
          case GL_LUMINANCE: