[Mesa-dev] [PATCH] mesa: Kill GL_ARB_shadow_ambient with fire

Marek Olšák maraeo at gmail.com
Mon Aug 13 18:57:53 PDT 2012


Reviewed-by: Marek Olšák <maraeo at gmail.com>

Marek

On Tue, Aug 14, 2012 at 3:18 AM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> 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 at intel.com>
> ---
>  .../drivers/r300/compiler/radeon_compiler.h        |    1 -
>  .../drivers/r300/compiler/radeon_program_tex.c     |   13 +------
>  src/mesa/main/attrib.c                             |    4 --
>  src/mesa/main/extensions.c                         |    2 -
>  src/mesa/main/mtypes.h                             |    2 -
>  src/mesa/main/samplerobj.c                         |    1 -
>  src/mesa/main/texobj.c                             |    2 -
>  src/mesa/main/texparam.c                           |   24 -------------
>  src/mesa/program/prog_statevars.c                  |   20 -----------
>  src/mesa/program/prog_statevars.h                  |    1 -
>  src/mesa/swrast/s_texfilter.c                      |   36 +++++++++-----------
>  11 files changed, 18 insertions(+), 88 deletions(-)
>
> diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h
> index d42cee9..f78a51c 100644
> --- a/src/gallium/drivers/r300/compiler/radeon_compiler.h
> +++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h
> @@ -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. */
> diff --git a/src/gallium/drivers/r300/compiler/radeon_program_tex.c b/src/gallium/drivers/r300/compiler/radeon_program_tex.c
> index 9d69ebd..8dfcd54 100644
> --- a/src/gallium/drivers/r300/compiler/radeon_program_tex.c
> +++ b/src/gallium/drivers/r300/compiler/radeon_program_tex.c
> @@ -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;
>  }
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index 9cab35b..1a04eeb 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -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);
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 521fe14..7f3aa94 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -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;
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 8fcb6b4..552c1cf 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -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;
> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
> index dc8adfc..8bf5f49 100644
> --- a/src/mesa/main/samplerobj.c
> +++ b/src/mesa/main/samplerobj.c
> @@ -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;
>  }
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index f70da4f..02e37be 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -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;
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index 9e7c3e4..690fd6c 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -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;
> diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
> index 9121221..f9c6677 100644
> --- a/src/mesa/program/prog_statevars.c
> +++ b/src/mesa/program/prog_statevars.c
> @@ -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;
> diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
> index 65baa78..efd0e03 100644
> --- a/src/mesa/program/prog_statevars.h
> +++ b/src/mesa/program/prog_statevars.h
> @@ -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 */
> diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
> index 51c8992..3c2aae9 100644
> --- a/src/mesa/swrast/s_texfilter.c
> +++ b/src/mesa/swrast/s_texfilter.c
> @@ -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:
> --
> 1.7.6.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list