[Mesa-dev] [PATCH] st/mesa: ensure that images don't try to reference non-existent levels

Marek Olšák maraeo at gmail.com
Tue Feb 27 16:26:40 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Feb 27, 2018 at 6:19 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Ideally the st_finalize_texture call would take care of that, but it
> doesn't seem to with KHR-GL45.shader_image_size.advanced-nonMS-*. This
> assertions makes sure that no such values are passed to the driver.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> This will trigger asserts in CTS, but I think that's better than feeding
> broken values to driver backends.
>
>  src/mesa/state_tracker/st_atom_image.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c
> index 1c4980173f4..421c926cf04 100644
> --- a/src/mesa/state_tracker/st_atom_image.c
> +++ b/src/mesa/state_tracker/st_atom_image.c
> @@ -97,6 +97,7 @@ st_convert_image(const struct st_context *st, const struct gl_image_unit *u,
>
>        img->resource = stObj->pt;
>        img->u.tex.level = u->Level + stObj->base.MinLevel;
> +      assert(img->u.tex.level <= img->resource->last_level);
>        if (stObj->pt->target == PIPE_TEXTURE_3D) {
>           if (u->Layered) {
>              img->u.tex.first_layer = 0;
> --
> 2.16.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list