[Mesa-stable] [Mesa-dev] [PATCH] mesa: enable GL_TEXTURE_LOD_BIAS set/get

Kenneth Graunke kenneth at whitecape.org
Tue Nov 19 11:07:11 PST 2013


On 11/19/2013 01:05 AM, Tapani Pälli wrote:
> Earlier comments suggest this was removed from GL core spec but it is
> still there. Enabling makes 'texture_lod_bias_getter' Khronos
> conformance tests pass, also removes some errors from Metro Last Light
> game which is using this API.
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>

I can see the confusion.  TEXTURE_LOD_BIAS appears in the section of
deprecated and actually -removed- features...but for TexEnv.  The GL 4.4
core spec still lists it as valid for TexParameter.

This appears to be a regression since
b3dd524a1082efd12d4a796122c300a61ba016d9.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: "9.0 9.1 9.2 10.0" <mesa-stable at lists.freedesktop.org>

Thanks for fixing this, Tapani!

> ---
>  src/mesa/main/texparam.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index d56b7d9..e1bfeb0 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -684,11 +684,7 @@ set_tex_parameterf(struct gl_context *ctx,
>        return GL_FALSE;
>  
>     case GL_TEXTURE_LOD_BIAS:
> -      /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias.
> -       * It was removed in core-profile, and it has never existed in OpenGL
> -       * ES.
> -       */
> -      if (ctx->API != API_OPENGL_COMPAT)
> +      if (_mesa_is_gles(ctx))
>           goto invalid_pname;
>  
>        if (!target_allows_setting_sampler_parameters(texObj->Target))
> @@ -1513,7 +1509,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
>           *params = (GLfloat) obj->DepthMode;
>           break;
>        case GL_TEXTURE_LOD_BIAS:
> -         if (ctx->API != API_OPENGL_COMPAT)
> +         if (_mesa_is_gles(ctx))
>              goto invalid_pname;
>  
>           *params = obj->Sampler.LodBias;
> @@ -1701,10 +1697,13 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
>           *params = (GLint) obj->DepthMode;
>           break;
>        case GL_TEXTURE_LOD_BIAS:
> -         if (ctx->API != API_OPENGL_COMPAT)
> +         if (_mesa_is_gles(ctx))
>              goto invalid_pname;
>  
> -         *params = (GLint) obj->Sampler.LodBias;
> +         /* GL spec 'Data Conversions' section specifies that floating-point
> +          * value in integer Get function is rounded to nearest integer
> +          */
> +         *params = (GLint) roundf(obj->Sampler.LodBias);
>           break;
>        case GL_TEXTURE_CROP_RECT_OES:
>           if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
> 



More information about the mesa-stable mailing list