[Mesa-dev] [PATCH 2/2] intel/pixel_read: Properly flip the results for window system buffers
Jason Ekstrand
jason at jlekstrand.net
Wed Jan 28 03:36:26 PST 2015
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.
*/
--
2.2.2
More information about the mesa-dev
mailing list