From: Zou Nan hai Date: Fri, 1 Feb 2008 09:36:56 +0000 (+0800) Subject: [intel] use _mesa_copy_rect for upload compressed texture, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a9a483b43ec090408148d069bc184c0a21323654;p=mesa.git [intel] use _mesa_copy_rect for upload compressed texture, this fix bad texture issue in some games(UT and quake). --- 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,