[Mesa-dev] [PATCH v2 09/11] i965: Add and use a helper for depth miptree clear values

Nanley Chery nanleychery at gmail.com
Wed Apr 4 20:58:16 UTC 2018


Add and use a comparison function to remove the last external user of
intel_miptree::fast_color_clear.
---
 src/mesa/drivers/dri/i965/brw_clear.c         | 2 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 7 +++++++
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 4 ++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
index 8f7594baf59..653abae2d8f 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -175,7 +175,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
    /* If we're clearing to a new clear value, then we need to resolve any clear
     * flags out of the HiZ buffer into the real depth buffer.
     */
-   if (mt->fast_clear_color.f32[0] != clear_value) {
+   if (!intel_miptree_has_depth_clear_value(mt, clear_value)) {
       for (uint32_t level = mt->first_level; level <= mt->last_level; level++) {
          if (!intel_miptree_level_has_hiz(mt, level))
             continue;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index dec2e614938..c2363979564 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3775,6 +3775,13 @@ intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
    return mt->aux_usage;
 }
 
+bool
+intel_miptree_has_depth_clear_value(const struct intel_mipmap_tree *mt,
+                                    float clear_value)
+{
+   return mt->fast_clear_color.f32[0] == clear_value;
+}
+
 bool
 intel_miptree_set_clear_color(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index edf9a619218..1070921837f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -715,6 +715,10 @@ bool
 intel_miptree_sample_with_hiz(struct brw_context *brw,
                               struct intel_mipmap_tree *mt);
 
+bool
+intel_miptree_has_depth_clear_value(const struct intel_mipmap_tree *mt,
+                                    float clear_value);
+
 bool
 intel_miptree_set_clear_color(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
-- 
2.16.2



More information about the mesa-dev mailing list