diff options
author | Ian Romanick <[email protected]> | 2004-10-07 16:39:20 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2004-10-07 16:39:20 +0000 |
commit | 554e5a2eaf4b681b5c43b6aeb66f100a66da4a42 (patch) | |
tree | 73be93cae881ed44be497526309d050e30223a1b | |
parent | 1695cfe991984356ffd4c8971c2ae3212ad227ed (diff) |
Prevent Y-offset from exceeding valid range in texture upload code. This
fixes bugzilla #960.
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_texmem.c | 8 |
1 files changed, 8 insertions, 0 deletions
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, |