From: Ian Romanick Date: Thu, 7 Oct 2004 16:39:20 +0000 (+0000) Subject: Prevent Y-offset from exceeding valid range in texture upload code. This X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=554e5a2eaf4b681b5c43b6aeb66f100a66da4a42;p=mesa.git Prevent Y-offset from exceeding valid range in texture upload code. This fixes bugzilla #960. --- diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c index b219995c3e2..bc937ce6cb2 100644 --- a/src/mesa/drivers/dri/r200/r200_texmem.c +++ b/src/mesa/drivers/dri/r200/r200_texmem.c @@ -382,6 +382,14 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, /* copy (x,y,width,height,data) */ memcpy( &tmp, &t->image[face][hwlevel], sizeof(tmp) ); + /* Adjust the base offset to account for the Y-offset. This is done, + * instead of just letting the Y-offset automatically take care of it, + * because it is possible, for very large textures, for the Y-offset + * to exceede the [-8192,+8191] range. + */ + tex.offset += tmp.y * 1024; + tmp.y = 0; + LOCK_HARDWARE( rmesa ); do { ret = drmCommandWriteRead( rmesa->dri.fd, DRM_RADEON_TEXTURE,