Re: [Mesa-dev] [PATCH 1/4] mesa/image: Make _mesa_clip_readpixels() work with renderbuffers
Thanks Nanley, I confirm that this patch-set fix the Bugzilla:92193 /Marta > -Original Message- > From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On > Behalf Of Nanley Chery > Sent: Monday, February 8, 2016 11:38 PM > To: mesa-dev@lists.freedesktop.org > Cc: 11.0 11.1 <mesa-sta...@lists.freedesktop.org>; Chery, Nanley G > <nanley.g.ch...@intel.com> > Subject: [Mesa-dev] [PATCH 1/4] mesa/image: Make > _mesa_clip_readpixels() work with renderbuffers > > From: Nanley Chery <nanley.g.ch...@intel.com> > > v2: Use gl_renderbuffer::{Width,Height} (Jason) > > Cc: "11.0 11.1" <mesa-sta...@lists.freedesktop.org> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com> > --- > src/mesa/main/image.c | 22 +- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index > e79e3e6..99f253c 100644 > --- a/src/mesa/main/image.c > +++ b/src/mesa/main/image.c > @@ -670,7 +670,7 @@ _mesa_clip_drawpixels(const struct gl_context *ctx, > * so that the image region is entirely within the window bounds. > * Note: this is different from _mesa_clip_drawpixels() in that the > * scissor box is ignored, and we use the bounds of the current readbuffer > - * surface. > + * surface or the attached image. > * > * \return GL_TRUE if region to read is in bounds > * GL_FALSE if region is completely out of bounds (nothing to read) > @@ -682,6 +682,18 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >struct gl_pixelstore_attrib *pack) { > const struct gl_framebuffer *buffer = ctx->ReadBuffer; > + struct gl_renderbuffer *rb = buffer->_ColorReadBuffer; > + GLsizei clip_width; > + GLsizei clip_height; > + > + if (rb) { > + clip_width = rb->Width; > + clip_height = rb->Height; > + } else { > + clip_width = buffer->Width; > + clip_height = buffer->Height; > + } > + > > if (pack->RowLength == 0) { >pack->RowLength = *width; > @@ -694,8 +706,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >*srcX = 0; > } > /* right clipping */ > - if (*srcX + *width > (GLsizei) buffer->Width) > - *width -= (*srcX + *width - buffer->Width); > + if (*srcX + *width > clip_width) > + *width -= (*srcX + *width - clip_width); > > if (*width <= 0) >return GL_FALSE; > @@ -707,8 +719,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >*srcY = 0; > } > /* top clipping */ > - if (*srcY + *height > (GLsizei) buffer->Height) > - *height -= (*srcY + *height - buffer->Height); > + if (*srcY + *height > clip_height) > + *height -= (*srcY + *height - clip_height); > > if (*height <= 0) >return GL_FALSE; > -- > 2.7.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] mesa/image: Make _mesa_clip_readpixels() work with renderbuffers
From: Nanley Cheryv2: Use gl_renderbuffer::{Width,Height} (Jason) Cc: "11.0 11.1" Signed-off-by: Nanley Chery --- src/mesa/main/image.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index e79e3e6..99f253c 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -670,7 +670,7 @@ _mesa_clip_drawpixels(const struct gl_context *ctx, * so that the image region is entirely within the window bounds. * Note: this is different from _mesa_clip_drawpixels() in that the * scissor box is ignored, and we use the bounds of the current readbuffer - * surface. + * surface or the attached image. * * \return GL_TRUE if region to read is in bounds * GL_FALSE if region is completely out of bounds (nothing to read) @@ -682,6 +682,18 @@ _mesa_clip_readpixels(const struct gl_context *ctx, struct gl_pixelstore_attrib *pack) { const struct gl_framebuffer *buffer = ctx->ReadBuffer; + struct gl_renderbuffer *rb = buffer->_ColorReadBuffer; + GLsizei clip_width; + GLsizei clip_height; + + if (rb) { + clip_width = rb->Width; + clip_height = rb->Height; + } else { + clip_width = buffer->Width; + clip_height = buffer->Height; + } + if (pack->RowLength == 0) { pack->RowLength = *width; @@ -694,8 +706,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, *srcX = 0; } /* right clipping */ - if (*srcX + *width > (GLsizei) buffer->Width) - *width -= (*srcX + *width - buffer->Width); + if (*srcX + *width > clip_width) + *width -= (*srcX + *width - clip_width); if (*width <= 0) return GL_FALSE; @@ -707,8 +719,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, *srcY = 0; } /* top clipping */ - if (*srcY + *height > (GLsizei) buffer->Height) - *height -= (*srcY + *height - buffer->Height); + if (*srcY + *height > clip_height) + *height -= (*srcY + *height - clip_height); if (*height <= 0) return GL_FALSE; -- 2.7.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] mesa/image: Make _mesa_clip_readpixels() work with renderbuffers
Series is Reviewed-by: Ian RomanickMight wait 24 hours or so to see if anyone responsible for a non-Intel driver has commentary... since this is shared code. On 02/08/2016 02:38 PM, Nanley Chery wrote: > From: Nanley Chery > > v2: Use gl_renderbuffer::{Width,Height} (Jason) > > Cc: "11.0 11.1" > Signed-off-by: Nanley Chery > --- > src/mesa/main/image.c | 22 +- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c > index e79e3e6..99f253c 100644 > --- a/src/mesa/main/image.c > +++ b/src/mesa/main/image.c > @@ -670,7 +670,7 @@ _mesa_clip_drawpixels(const struct gl_context *ctx, > * so that the image region is entirely within the window bounds. > * Note: this is different from _mesa_clip_drawpixels() in that the > * scissor box is ignored, and we use the bounds of the current readbuffer > - * surface. > + * surface or the attached image. > * > * \return GL_TRUE if region to read is in bounds > * GL_FALSE if region is completely out of bounds (nothing to read) > @@ -682,6 +682,18 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >struct gl_pixelstore_attrib *pack) > { > const struct gl_framebuffer *buffer = ctx->ReadBuffer; > + struct gl_renderbuffer *rb = buffer->_ColorReadBuffer; > + GLsizei clip_width; > + GLsizei clip_height; > + > + if (rb) { > + clip_width = rb->Width; > + clip_height = rb->Height; > + } else { > + clip_width = buffer->Width; > + clip_height = buffer->Height; > + } > + > > if (pack->RowLength == 0) { >pack->RowLength = *width; > @@ -694,8 +706,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >*srcX = 0; > } > /* right clipping */ > - if (*srcX + *width > (GLsizei) buffer->Width) > - *width -= (*srcX + *width - buffer->Width); > + if (*srcX + *width > clip_width) > + *width -= (*srcX + *width - clip_width); > > if (*width <= 0) >return GL_FALSE; > @@ -707,8 +719,8 @@ _mesa_clip_readpixels(const struct gl_context *ctx, >*srcY = 0; > } > /* top clipping */ > - if (*srcY + *height > (GLsizei) buffer->Height) > - *height -= (*srcY + *height - buffer->Height); > + if (*srcY + *height > clip_height) > + *height -= (*srcY + *height - clip_height); > > if (*height <= 0) >return GL_FALSE; > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev