[Mesa-dev] [PATCH] st/mesa: st_copy_texsubimage: clip source size to rb size

Vadim Girlin vadimgirlin at gmail.com
Mon Jul 18 07:11:21 PDT 2011


Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39286
---
 src/mesa/state_tracker/st_cb_texture.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 6907cfc..63cd142 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1490,6 +1490,14 @@ st_copy_texsubimage(struct gl_context *ctx,
       destY = 0;
    }
 
+   if (srcX + width > strb->Base.Width) {
+      width = strb->Base.Width - srcX;
+   }
+
+   if (srcY + height > strb->Base.Height) {
+      height = strb->Base.Height - srcY;
+   }
+
    if (width < 0 || height < 0)
       return;
 
-- 
1.7.6



More information about the mesa-dev mailing list