[Mesa-dev] [Mesa-stable] [PATCH] st/mesa: use first image's dimensions when finalizing texture

Brian Paul brianp at vmware.com
Mon Jun 6 15:37:25 UTC 2016


On 06/05/2016 12:24 AM, Ilia Mirkin wrote:
> In the case where we can't guess the base level size, just use the first
> image's dims. The width0/height0/depth0 on stObj may not have been set
> at this point. Observed in a trace that set up levels 2..9 of a 2d texture,
> and set the base level to 2, with height 1. This made the guess logic
> always bail.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Cc: "12.0" <mesa-stable at lists.freedesktop.org>
> ---
>   src/mesa/state_tracker/st_cb_texture.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index d38f24c..1dd1ef6 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -2463,9 +2463,9 @@ st_finalize_texture(struct gl_context *ctx,
>                                    firstImage->base.Depth2,
>                                    firstImage->base.Level,
>                                    &width, &height, &depth)) {
> -         width = stObj->width0;
> -         height = stObj->height0;
> -         depth = stObj->depth0;
> +         width = stObj->width0 = firstImage->base.Width2;
> +         height = stObj->height0 = firstImage->base.Height2;
> +         depth = stObj->depth0 = firstImage->base.Depth2;
>         } else {
>            /* The width/height/depth may have been previously reset in
>             * guess_and_alloc_texture. */
>

Does this fix a crash or glitch or something else?

The state tracker's texture code is pretty delicate so I'd like to fully 
understand the change.

Maybe we should have a piglit test for this?

-Brian



More information about the mesa-dev mailing list