From 9d79235e4ec68c72876f8afd5d472571d2e7f0e3 Mon Sep 17 00:00:00 2001 From: Topi Pohjolainen Date: Mon, 4 Apr 2016 11:28:03 +0300 Subject: [PATCH] i965/meta: Expose resolve clear rectangle calculation Signed-off-by: Topi Pohjolainen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 16 +++++++++------- src/mesa/drivers/dri/i965/brw_meta_util.h | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c index 885c09c611d..be6d5845c02 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c +++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c @@ -808,9 +808,11 @@ brw_meta_fast_clear(struct brw_context *brw, struct gl_framebuffer *fb, return true; } -static void -get_resolve_rect(struct brw_context *brw, - struct intel_mipmap_tree *mt, struct rect *rect) +void +brw_get_resolve_rect(const struct brw_context *brw, + const struct intel_mipmap_tree *mt, + unsigned *x0, unsigned *y0, + unsigned *x1, unsigned *y1) { unsigned x_align, y_align; unsigned x_scaledown, y_scaledown; @@ -838,9 +840,9 @@ get_resolve_rect(struct brw_context *brw, x_scaledown = x_align / 2; y_scaledown = y_align / 2; } - rect->x0 = rect->y0 = 0; - rect->x1 = ALIGN(mt->logical_width0, x_scaledown) / x_scaledown; - rect->y1 = ALIGN(mt->logical_height0, y_scaledown) / y_scaledown; + *x0 = *y0 = 0; + *x1 = ALIGN(mt->logical_width0, x_scaledown) / x_scaledown; + *y1 = ALIGN(mt->logical_height0, y_scaledown) / y_scaledown; } void @@ -885,7 +887,7 @@ brw_meta_resolve_color(struct brw_context *brw, set_fast_clear_op(brw, GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE); mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED; - get_resolve_rect(brw, mt, &rect); + brw_get_resolve_rect(brw, mt, &rect.x0, &rect.y0, &rect.x1, &rect.y1); brw_draw_rectlist(brw, &rect, 1); diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h index 756cc594108..35222d239fc 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_util.h +++ b/src/mesa/drivers/dri/i965/brw_meta_util.h @@ -49,6 +49,12 @@ brw_get_fast_clear_rect(const struct brw_context *brw, unsigned *x0, unsigned *y0, unsigned *x1, unsigned *y1); +void +brw_get_resolve_rect(const struct brw_context *brw, + const struct intel_mipmap_tree *mt, + unsigned *x0, unsigned *y0, + unsigned *x1, unsigned *y1); + #ifdef __cplusplus } #endif -- 2.30.2