[Mesa-dev] [PATCH 2/2] intel/pixel_read: Properly flip the results for window system buffers

Chad Versace chad.versace at intel.com
Fri Jan 30 14:51:38 PST 2015


On 01/28/2015 03:36 AM, Jason Ekstrand wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=88841
> ---
>  src/mesa/drivers/dri/i965/intel_pixel_read.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> index babf8ca..198d616 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> @@ -155,6 +155,17 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
>  
>     dst_pitch = _mesa_image_row_stride(pack, width, format, type);
>  
> +   /* For a window-system renderbuffer, the buffer is actually flipped
> +    * vertically, so we need to handle that.  Because we don't want to
> +    * mess up the detiling, we mangle the height and pixels pointer and
> +    * give the detiling function a negative pitch.
> +    */
> +   if (rb->Name == 0) {
> +      yoffset = rb->Height - yoffset - height;
> +      pixels += (ptrdiff_t) (height - 1) * dst_pitch;
> +      dst_pitch = -dst_pitch;
> +   }
> +
>     /* We postponed printing this message until having committed to executing
>      * the function.
>      */
> 

Reviewed-by: Chad Versace <chad.versace at intel.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150130/b52df5b4/attachment.sig>


More information about the mesa-dev mailing list