[intel] use _mesa_copy_rect for upload compressed texture,

this fix bad texture issue in some games(UT and quake).
This commit is contained in:
Zou Nan hai 2008-02-01 17:36:56 +08:00
parent 71f53a22d0
commit a9a483b43e
3 changed files with 22 additions and 2 deletions

View file

@ -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,

View file

@ -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

View file

@ -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,