intel: Add a safety check for mapping 1D texture arrays.
authorEric Anholt <eric@anholt.net>
Thu, 29 Sep 2011 21:54:23 +0000 (14:54 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 3 Oct 2011 20:29:38 +0000 (13:29 -0700)
So easy to screw up with the crazy way GL manages them.

src/mesa/drivers/dri/intel/intel_tex.c

index 4ab618ad7365189ab4eee0e5a89f4a2252c1b44c..83ba50e39edfdf8d79029b9bd0383e9535a76ed3 100644 (file)
@@ -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