st/mesa: ensure that images don't try to reference non-existent levels
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 27 Feb 2018 00:31:12 +0000 (19:31 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 28 Feb 2018 03:38:33 +0000 (22:38 -0500)
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
assertion makes sure that no such values are passed to the driver.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_image.c

index 1c4980173f4b260bba18f46f49eba0c567a5ded1..421c926cf04163628feb18a7d8574ff0be74aa4f 100644 (file)
@@ -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;