i965/blorp: Make the guts of brw_blorp_blit_miptrees miptree-unaware
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 20 Jul 2016 02:19:12 +0000 (19:19 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 17 Aug 2016 21:46:22 +0000 (14:46 -0700)
Now that we have the brw_blorp_surf struct, we can start to make bits of
blorp completely miptree-unaware.  To start things off, we split the guts
of brw_blorp_blit_miptrees into a brw_blorp_blit function which knows
nothing about miptrees.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_blorp.h
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp

index ed6af838b4e117246c50195447afe3d06d5e1e20..72174a05156bd004bd1cef7e3d042fc5ea784cb4 100644 (file)
@@ -61,6 +61,20 @@ enum isl_format
 brw_blorp_to_isl_format(struct brw_context *brw, mesa_format format,
                         bool is_render_target);
 
+void
+brw_blorp_blit(struct brw_context *brw,
+               const struct brw_blorp_surf *src_surf,
+               unsigned src_level, unsigned src_layer,
+               enum isl_format src_format, int src_swizzle,
+               const struct brw_blorp_surf *dst_surf,
+               unsigned dst_level, unsigned dst_layer,
+               enum isl_format dst_format,
+               float src_x0, float src_y0,
+               float src_x1, float src_y1,
+               float dst_x0, float dst_y0,
+               float dst_x1, float dst_y1,
+               GLenum filter, bool mirror_x, bool mirror_y);
+
 void
 brw_blorp_blit_miptrees(struct brw_context *brw,
                         struct intel_mipmap_tree *src_mt,
index 4849c5701017a963c13985b8c5580dcfea87deea..87f064130f7b5f979f84b31becaf0fe70f24a20a 100644 (file)
@@ -1750,23 +1750,48 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
    intel_miptree_check_level_layer(dst_mt, dst_level, dst_layer);
    intel_miptree_used_for_rendering(dst_mt);
 
-   struct brw_blorp_params params;
-   brw_blorp_params_init(&params);
-
-   struct isl_surf isl_tmp[4];
+   struct isl_surf tmp_surfs[4];
    struct brw_blorp_surf src_surf, dst_surf;
    brw_blorp_surf_for_miptree(brw, &src_surf, src_mt, false,
-                              &src_level, &isl_tmp[0]);
-   brw_blorp_surface_info_init(brw, &params.src,
-                               &src_surf, src_level, src_layer,
-                               brw_blorp_to_isl_format(brw, src_format, false),
-                               false);
+                              &src_level, &tmp_surfs[0]);
    brw_blorp_surf_for_miptree(brw, &dst_surf, dst_mt, true,
-                              &dst_level, &isl_tmp[2]);
-   brw_blorp_surface_info_init(brw, &params.dst,
-                               &dst_surf, dst_level, dst_layer,
-                               brw_blorp_to_isl_format(brw, dst_format, true),
-                               true);
+                              &dst_level, &tmp_surfs[2]);
+
+   brw_blorp_blit(brw, &src_surf, src_level, src_layer,
+                  brw_blorp_to_isl_format(brw, src_format, false), src_swizzle,
+                  &dst_surf, dst_level, dst_layer,
+                  brw_blorp_to_isl_format(brw, dst_format, true),
+                  src_x0, src_y0, src_x1, src_y1,
+                  dst_x0, dst_y0, dst_x1, dst_y1,
+                  filter, mirror_x, mirror_y);
+
+   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_layer);
+
+   if (intel_miptree_is_lossless_compressed(brw, dst_mt))
+      dst_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_UNRESOLVED;
+}
+
+void
+brw_blorp_blit(struct brw_context *brw,
+               const struct brw_blorp_surf *src_surf,
+               unsigned src_level, unsigned src_layer,
+               enum isl_format src_format, int src_swizzle,
+               const struct brw_blorp_surf *dst_surf,
+               unsigned dst_level, unsigned dst_layer,
+               enum isl_format dst_format,
+               float src_x0, float src_y0,
+               float src_x1, float src_y1,
+               float dst_x0, float dst_y0,
+               float dst_x1, float dst_y1,
+               GLenum filter, bool mirror_x, bool mirror_y)
+{
+   struct brw_blorp_params params;
+   brw_blorp_params_init(&params);
+
+   brw_blorp_surface_info_init(brw, &params.src, src_surf, src_level,
+                               src_layer, src_format, false);
+   brw_blorp_surface_info_init(brw, &params.dst, dst_surf, dst_level,
+                               dst_layer, dst_format, true);
 
    struct brw_blorp_blit_prog_key wm_prog_key;
    memset(&wm_prog_key, 0, sizeof(wm_prog_key));
@@ -2011,9 +2036,4 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
    }
 
    brw_blorp_exec(brw, &params);
-
-   intel_miptree_slice_set_needs_hiz_resolve(dst_mt, dst_level, dst_layer);
-
-   if (intel_miptree_is_lossless_compressed(brw, dst_mt))
-      dst_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_UNRESOLVED;
 }