Mesa (master): i965: Refactor check for separate stencil

Topi Pohjolainen tpohjola at kemper.freedesktop.org
Tue Jul 18 19:27:32 UTC 2017


Module: Mesa
Branch: master
Commit: 75075632913171ce515b3c0c5debd4ddac4ddd84
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=75075632913171ce515b3c0c5debd4ddac4ddd84

Author: Topi Pohjolainen <topi.pohjolainen at intel.com>
Date:   Mon May 29 15:17:48 2017 +0300

i965: Refactor check for separate stencil

v2 (Jason): s/needs_stencil/needs_separate_stencil/

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
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 d68e371646..f292d71d38 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -342,6 +342,25 @@ unwind:
    return false;
 }
 
+static bool
+needs_separate_stencil(const struct brw_context *brw,
+                       struct intel_mipmap_tree *mt,
+                       mesa_format format, uint32_t layout_flags)
+{
+
+   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
@@ -520,10 +539,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_separate_stencil(brw, mt, format, layout_flags)) {
       uint32_t stencil_flags = MIPTREE_LAYOUT_ACCELERATED_UPLOAD;
       if (brw->gen == 6) {
          stencil_flags |= MIPTREE_LAYOUT_TILING_ANY;




More information about the mesa-commit mailing list