summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZou Nan hai <[email protected]>2008-02-01 17:36:56 +0800
committerZou Nan hai <[email protected]>2008-02-01 17:36:56 +0800
commita9a483b43ec090408148d069bc184c0a21323654 (patch)
treebab621e6b1bf802e818c5275b5881b2a1ca3fac8
parent71f53a22d048b4d972c88a2ed49aa3bc4ff76a21 (diff)
[intel] use _mesa_copy_rect for upload compressed texture,
this fix bad texture issue in some games(UT and quake).
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.h10
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c12
3 files changed, 22 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 6e127dc31e7..fdd99edda7b 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -130,7 +130,7 @@ intel_region_release(struct intel_region **region)
/*
* XXX Move this into core Mesa?
*/
-static void
+void
_mesa_copy_rect(GLubyte * dst,
GLuint cpp,
GLuint dst_pitch,
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index b6a3b5a7397..0d1dabe9ca7 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -122,4 +122,14 @@ dri_bo *intel_region_buffer(struct intel_context *intel,
struct intel_region *region,
GLuint flag);
+void _mesa_copy_rect(GLubyte * dst,
+ GLuint cpp,
+ GLuint dst_pitch,
+ GLuint dst_x,
+ GLuint dst_y,
+ GLuint width,
+ GLuint height,
+ const GLubyte * src,
+ GLuint src_pitch, GLuint src_x, GLuint src_y);
+
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 4f5f75d0492..8f9f9897e87 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -493,7 +493,17 @@ intelTexImage(GLcontext * ctx,
* conversion and copy:
*/
if (compressed) {
- memcpy(texImage->Data, pixels, imageSize);
+ if (intelImage->mt) {
+ struct intel_region *dst = intelImage->mt->region;
+ _mesa_copy_rect(texImage->Data, dst->cpp, dst->pitch,
+ 0, 0,
+ intelImage->mt->level[intelImage->level].width,
+ intelImage->mt->level[intelImage->level].height/4,
+ pixels,
+ intelImage->base.RowStride,
+ 0, 0);
+ } else
+ memcpy(texImage->Data, pixels, imageSize);
} else if (!texImage->TexFormat->StoreImage(ctx, dims,
texImage->_BaseFormat,
texImage->TexFormat,