aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2017-10-11 20:33:25 -0700
committerKenneth Graunke <[email protected]>2017-10-12 19:58:40 -0700
commitacd3e073e4f6d611ab14c5b4d2a8e8d5704f5809 (patch)
tree0db24929b1a1b80150f22024a1ba5d4f9c8eaa81 /src
parent52f39d69108b3c3cb5406d361d78ccafdd7b9c86 (diff)
i965: Refactor y-flipping coordinate transform.
I want to reuse it for the BLORP download path. Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index 835dbd2af36..2bfeb80668b 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -601,6 +601,14 @@ try_blorp_blit(struct brw_context *brw,
return true;
}
+static void
+apply_y_flip(int *y0, int *y1, int height)
+{
+ int tmp = height - *y0;
+ *y0 = height - *y1;
+ *y1 = tmp;
+}
+
bool
brw_blorp_copytexsubimage(struct brw_context *brw,
struct gl_renderbuffer *src_rb,
@@ -672,13 +680,9 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
/* Account for the fact that in the system framebuffer, the origin is at
* the lower left.
*/
- bool mirror_y = false;
- if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) {
- GLint tmp = src_rb->Height - srcY0;
- srcY0 = src_rb->Height - srcY1;
- srcY1 = tmp;
- mirror_y = true;
- }
+ bool mirror_y = _mesa_is_winsys_fbo(ctx->ReadBuffer);
+ if (mirror_y)
+ apply_y_flip(&srcY0, &srcY1, src_rb->Height);
/* Account for face selection and texture view MinLayer */
int dst_slice = slice + dst_image->TexObject->MinLayer + dst_image->Face;