i965: Adjust map/unmap code for MinLevel/MinLayer
authorChris Forbes <chrisf@ijw.co.nz>
Mon, 20 Jan 2014 08:30:35 +0000 (21:30 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Thu, 10 Apr 2014 06:27:41 +0000 (18:27 +1200)
This allows core mesa's TexSubImage paths etc to work correctly
with views which have nonzero MinLevel or MinLayer.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/intel_tex.c

index b69018e4be79b2c4797affcff9348016dcf18a11..f18ca45647172c697425c82cdfd9b1f31a0498f1 100644 (file)
@@ -220,8 +220,11 @@ intel_map_texture_image(struct gl_context *ctx,
    if (tex_image->TexObject->Target == GL_TEXTURE_CUBE_MAP)
       slice = tex_image->Face;
 
-   intel_miptree_map(brw, mt, tex_image->Level, slice, x, y, w, h, mode,
-                    (void **)map, stride);
+   intel_miptree_map(brw, mt,
+                     tex_image->Level + tex_image->TexObject->MinLevel,
+                     slice + tex_image->TexObject->MinLayer,
+                     x, y, w, h, mode,
+                     (void **)map, stride);
 }
 
 static void
@@ -235,7 +238,9 @@ intel_unmap_texture_image(struct gl_context *ctx,
    if (tex_image->TexObject->Target == GL_TEXTURE_CUBE_MAP)
       slice = tex_image->Face;
 
-   intel_miptree_unmap(brw, mt, tex_image->Level, slice);
+   intel_miptree_unmap(brw, mt,
+         tex_image->Level + tex_image->TexObject->MinLevel,
+         slice + tex_image->TexObject->MinLayer);
 }
 
 static GLboolean