Mesa (master): st/mesa: ensure that images don't try to reference non-existent levels

Ilia Mirkin imirkin at kemper.freedesktop.org
Wed Feb 28 03:39:22 UTC 2018


Module: Mesa
Branch: master
Commit: 086c88551d286cf29a2414227fc3a6f4b0c9c455
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=086c88551d286cf29a2414227fc3a6f4b0c9c455

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Mon Feb 26 19:31:12 2018 -0500

st/mesa: ensure that images don't try to reference non-existent levels

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 at alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 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 1c4980173f..421c926cf0 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;




More information about the mesa-commit mailing list