From 33fa12c50f2e5e4fd4cfde1234ed6fdcc612fe92 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 21 Apr 2016 18:10:53 -0700 Subject: [PATCH] i965/blorp: Turn coord_transform into a C-style struct Reviewed-by: Topi Pohjolainen Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_blorp.h | 10 +++------ src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 23 +++++++++++--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h index f4f7f7aeb4f..b901de31c87 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.h +++ b/src/mesa/drivers/dri/i965/brw_blorp.h @@ -175,16 +175,12 @@ brw_blorp_compute_tile_offsets(const struct brw_blorp_surface_info *info, -struct brw_blorp_coord_transform_params +struct brw_blorp_coord_transform { - void setup(GLfloat src0, GLfloat src1, GLfloat dst0, GLfloat dst1, - bool mirror); - float multiplier; float offset; }; - struct brw_blorp_wm_push_constants { uint32_t dst_x0; @@ -194,8 +190,8 @@ struct brw_blorp_wm_push_constants /* Top right coordinates of the rectangular grid used for scaled blitting */ float rect_grid_x1; float rect_grid_y1; - brw_blorp_coord_transform_params x_transform; - brw_blorp_coord_transform_params y_transform; + struct brw_blorp_coord_transform x_transform; + struct brw_blorp_coord_transform y_transform; /* Minimum layer setting works for all the textures types but texture_3d * for which the setting has no effect. Use the z-coordinate instead. diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 2aa91ada525..177739065e3 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1783,10 +1783,11 @@ brw_blorp_blit_program::render_target_write() } -void -brw_blorp_coord_transform_params::setup(GLfloat src0, GLfloat src1, - GLfloat dst0, GLfloat dst1, - bool mirror) +static void +brw_blorp_setup_coord_transform(struct brw_blorp_coord_transform *xform, + GLfloat src0, GLfloat src1, + GLfloat dst0, GLfloat dst1, + bool mirror) { float scale = (src1 - src0) / (dst1 - dst0); if (!mirror) { @@ -1800,16 +1801,16 @@ brw_blorp_coord_transform_params::setup(GLfloat src0, GLfloat src1, * whereas the behaviour we actually want is "round to nearest", * so 0.5 provides the necessary correction. */ - multiplier = scale; - offset = src0 + (-dst0 + 0.5f) * scale; + xform->multiplier = scale; + xform->offset = src0 + (-dst0 + 0.5f) * scale; } else { /* When mirroring X we need: * src_x - src_x0 = dst_x1 - dst_x - 0.5 * Therefore: * src_x = src_x0 + (dst_x1 -dst_x - 0.5) * scale */ - multiplier = -scale; - offset = src0 + (dst1 - 0.5f) * scale; + xform->multiplier = -scale; + xform->offset = src0 + (dst1 - 0.5f) * scale; } } @@ -2062,8 +2063,10 @@ brw_blorp_blit_miptrees(struct brw_context *brw, params.wm_push_consts.rect_grid_y1 = minify(src_mt->logical_height0, src_level) * wm_prog_key.y_scale - 1.0f; - params.wm_push_consts.x_transform.setup(src_x0, src_x1, dst_x0, dst_x1, mirror_x); - params.wm_push_consts.y_transform.setup(src_y0, src_y1, dst_y0, dst_y1, mirror_y); + brw_blorp_setup_coord_transform(¶ms.wm_push_consts.x_transform, + src_x0, src_x1, dst_x0, dst_x1, mirror_x); + brw_blorp_setup_coord_transform(¶ms.wm_push_consts.y_transform, + src_y0, src_y1, dst_y0, dst_y1, mirror_y); params.wm_push_consts.src_z = params.src.mt->target == GL_TEXTURE_3D ? params.src.layer : 0; -- 2.30.2