Prevent Y-offset from exceeding valid range in texture upload code. This

fixes bugzilla #960.
This commit is contained in:
Ian Romanick 2004-10-07 16:39:20 +00:00
parent 1695cfe991
commit 554e5a2eaf
1 changed files with 8 additions and 0 deletions

View File

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