[Mesa-dev] [PATCH v2 07/27] i965/blorp/blit: Move format work-arounds before surface_info_init

Pohjolainen, Topi topi.pohjolainen at intel.com
Thu Jul 28 14:55:35 UTC 2016


On Tue, Jul 26, 2016 at 03:11:11PM -0700, Jason Ekstrand wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 30 +++++++++++++---------------
>  1 file changed, 14 insertions(+), 16 deletions(-)

Looks cleaner:

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> 
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> index 007c061..ed68734 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
> @@ -1744,14 +1744,6 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
>     if (!encode_srgb && _mesa_get_format_color_encoding(dst_format) == GL_SRGB)
>        dst_format = _mesa_get_srgb_format_linear(dst_format);
>  
> -   struct brw_blorp_params params;
> -   brw_blorp_params_init(&params);
> -
> -   brw_blorp_surface_info_init(brw, &params.src, src_mt, src_level,
> -                               src_layer, src_format, false);
> -   brw_blorp_surface_info_init(brw, &params.dst, dst_mt, dst_level,
> -                               dst_layer, dst_format, true);
> -
>     /* Even though we do multisample resolves at the time of the blit, OpenGL
>      * specification defines them as if they happen at the time of rendering,
>      * which means that the type of averaging we do during the resolve should
> @@ -1767,15 +1759,12 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
>      * (aside from the color space), we choose to blit in sRGB space to get
>      * this higher quality image.
>      */
> -   if (params.src.surf.samples > 1 &&
> +   if (src_mt->num_samples > 1 &&
>         _mesa_get_format_color_encoding(dst_mt->format) == GL_SRGB &&
>         _mesa_get_srgb_format_linear(src_mt->format) ==
>         _mesa_get_srgb_format_linear(dst_mt->format)) {
>        assert(brw->format_supported_as_render_target[dst_mt->format]);
> -      params.dst.view.format =
> -         (enum isl_format)brw->render_target_format[dst_mt->format];
> -      params.src.view.format =
> -         (enum isl_format)brw_format_for_mesa_format(dst_mt->format);
> +      src_format = dst_format = dst_mt->format;
>     }
>  
>     /* When doing a multisample resolve of a GL_LUMINANCE32F or GL_INTENSITY32F
> @@ -1788,12 +1777,21 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
>      * R32_FLOAT, so only the contents of the red channel matters.
>      */
>     if (brw->gen == 6 &&
> -       params.src.surf.samples > 1 && params.dst.surf.samples <= 1 &&
> +       src_mt->num_samples > 1 && dst_mt->num_samples <= 1 &&
>         src_mt->format == dst_mt->format &&
> -       params.dst.view.format == ISL_FORMAT_R32_FLOAT) {
> -      params.src.view.format = params.dst.view.format;
> +       (dst_format == MESA_FORMAT_L_FLOAT32 ||
> +        dst_format == MESA_FORMAT_I_FLOAT32)) {
> +      src_format = dst_format = MESA_FORMAT_R_FLOAT32;
>     }
>  
> +   struct brw_blorp_params params;
> +   brw_blorp_params_init(&params);
> +
> +   brw_blorp_surface_info_init(brw, &params.src, src_mt, src_level,
> +                               src_layer, src_format, false);
> +   brw_blorp_surface_info_init(brw, &params.dst, dst_mt, 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));
>  
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list