summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2007-08-10 16:23:14 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2007-08-10 16:23:14 +0800
commit8ea66fa2ec9eeb6a7e869ff08d713f5e77d795e0 (patch)
tree482afc0367d88d6036448a3279b7230d44912ed9 /src/mesa/drivers/dri/i965/intel_mipmap_tree.c
parent2cafd749b8e4fa44863c176389f7201c7f74eca9 (diff)
i965/i915tex: applying right alignment to compressed texture,
which make small textures(4x4,2x2,1x1) work well.
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_mipmap_tree.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index d7b1946ce3..f24f234682 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -211,7 +211,7 @@ GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt,
-
+extern GLuint intel_compressed_alignment(GLenum);
/* Upload data for a particular image.
*/
GLboolean intel_miptree_image_data(struct intel_context *intel,
@@ -226,6 +226,16 @@ GLboolean intel_miptree_image_data(struct intel_context *intel,
GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level);
GLuint i;
+ GLuint width, height, alignment;
+
+ width = dst->level[level].width;
+ height = dst->level[level].height;
+
+ if (dst->compressed) {
+ alignment = intel_compressed_alignment(dst->internal_format);
+ width = ((width + alignment - 1) & ~(alignment - 1));
+ height = (height + 3) / 4;
+ }
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
@@ -237,8 +247,8 @@ GLboolean intel_miptree_image_data(struct intel_context *intel,
src,
src_row_pitch,
0, 0, /* source x,y */
- dst->level[level].width,
- dst->level[level].height))
+ width,
+ height))
return GL_FALSE;
src += src_image_pitch;
}