[Mesa-dev] [PATCH 15/16] i965: Refactor check for separate stencil

Jason Ekstrand jason at jlekstrand.net
Mon Jul 17 16:19:01 UTC 2017


On Mon, Jul 17, 2017 at 6:35 AM, Topi Pohjolainen <
topi.pohjolainen at gmail.com> wrote:

> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 24
> ++++++++++++++++++++----
>  1 file changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index b692d55abb..ca36936cb9 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -340,6 +340,25 @@ unwind:
>     return false;
>  }
>
> +static bool
> +needs_stencil(const struct brw_context *brw,
> +              struct intel_mipmap_tree *mt,
> +              mesa_format format, uint32_t layout_flags)
>

Maybe call this "needs_separate_stencil" just to be a bit more clear?


> +{
> +
> +   if (layout_flags & MIPTREE_LAYOUT_FOR_BO)
> +      return false;
> +
> +   if (_mesa_get_format_base_format(format) != GL_DEPTH_STENCIL)
> +      return false;
> +
> +   if (brw->must_use_separate_stencil)
> +      return true;
> +
> +   return brw->has_separate_stencil &&
> +          intel_miptree_supports_hiz(brw, mt);
> +}
> +
>  /**
>   * @param for_bo Indicates that the caller is
>   *        intel_miptree_create_for_bo(). If true, then do not create
> @@ -519,10 +538,7 @@ intel_miptree_create_layout(struct brw_context *brw,
>     mt->physical_height0 = height0;
>     mt->physical_depth0 = depth0;
>
> -   if (!(layout_flags & MIPTREE_LAYOUT_FOR_BO) &&
> -       _mesa_get_format_base_format(format) == GL_DEPTH_STENCIL &&
> -       (brw->must_use_separate_stencil ||
> -       (brw->has_separate_stencil && intel_miptree_supports_hiz(brw,
> mt)))) {
> +   if (needs_stencil(brw, mt, format, layout_flags)) {
>        uint32_t stencil_flags = MIPTREE_LAYOUT_ACCELERATED_UPLOAD;
>        if (brw->gen == 6) {
>           stencil_flags |= MIPTREE_LAYOUT_TILING_ANY;
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170717/58902d70/attachment.html>


More information about the mesa-dev mailing list