i965/blorp: Turn coord_transform into a C-style struct
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Apr 2016 01:10:53 +0000 (18:10 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 26 Apr 2016 21:55:22 +0000 (14:55 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_blorp.h
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp

index f4f7f7a..b901de3 100644 (file)
@@ -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.
index 2aa91ad..1777390 100644 (file)
@@ -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(&params.wm_push_consts.x_transform,
+                                   src_x0, src_x1, dst_x0, dst_x1, mirror_x);
+   brw_blorp_setup_coord_transform(&params.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;