[Mesa-dev] [PATCH 1/2] meta: Actually initialize ImmutableLevels to 1.

Ian Romanick idr at freedesktop.org
Fri Jul 14 15:26:15 UTC 2017


With or without Chris's suggestion on patch 2 (which I like), this series is

Reviewed-by: Ian Romancik <ian.d.romanick at intel.com>

On 07/13/2017 09:38 PM, Kenneth Graunke wrote:
> Otherwise, ImmutableLevels is 0, which is an illegal value.  Later,
> _mesa_meta_setup_sampler will use _mesa_texture_parameteriv to set
> 
>    texObj->MaxLevel = CLAMP(params[0], texObj->BaseLevel,
>                             texObj->ImmutableLevels - 1);
> 
> which turns into a completely bogus CLAMP(value, 0, -1)...where the
> upper bound is smaller than the lower bound.  This ends up being -1
> today due to the way CLAMP is implemented, which is a bogus MaxLevel.
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> This prevents regressions in the next commit, where we change the
> implementation of CLAMP, and it starts returning a different value.
> Both implementations of CLAMP are valid, but when max < min, bogosity
> ensues...
> 
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
> index b8c422bfb72..e0284a3f07d 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -136,6 +136,7 @@ create_texture_for_pbo(struct gl_context *ctx,
>     _mesa_initialize_texture_object(ctx, tex_obj, *tmp_tex, GL_TEXTURE_2D);
>     /* This must be set after _mesa_initialize_texture_object, not before. */
>     tex_obj->Immutable = GL_TRUE;
> +   tex_obj->ImmutableLevels = 1;
>     /* This is required for interactions with ARB_texture_view. */
>     tex_obj->NumLayers = 1;
>  
> 



More information about the mesa-dev mailing list