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

Brian Paul brian.e.paul at gmail.com
Mon Jul 18 07:34:13 PDT 2011


On Mon, Jul 18, 2011 at 8:11 AM, Vadim Girlin <vadimgirlin at gmail.com> wrote:
> 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;

Clipping for glCopyTexSubImage() should be done by
_mesa_clip_copytexsubimage() (in image.c, called from teximage.c).
Maybe you could do a bit of debugging to see why that's not doing the
job.

-Brian


More information about the mesa-dev mailing list