Mesa (master): intel: Add a safety check for mapping 1D texture arrays.

Eric Anholt anholt at kemper.freedesktop.org
Mon Oct 3 21:17:00 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Sep 29 14:54:23 2011 -0700

intel: Add a safety check for mapping 1D texture arrays.

So easy to screw up with the crazy way GL manages them.

---

 src/mesa/drivers/dri/intel/intel_tex.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 4ab618a..83ba50e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -142,6 +142,10 @@ intel_map_texture_image(struct gl_context *ctx,
    struct intel_mipmap_tree *mt = intel_image->mt;
    unsigned int bw, bh;
 
+   /* Check that our caller wasn't confused about how to map a 1D texture. */
+   assert(tex_image->TexObject->Target != GL_TEXTURE_1D_ARRAY ||
+	  h == 1);
+
    if (intel_image->stencil_rb) {
       /*
        * The texture has packed depth/stencil format, but uses separate




More information about the mesa-commit mailing list