i965: Return whether the miptree was resolved from intel_miptree_resolve_color().
authorFrancisco Jerez <currojerez@riseup.net>
Sat, 23 Jul 2016 01:16:45 +0000 (18:16 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 26 Aug 2016 01:36:07 +0000 (18:36 -0700)
This will allow optimizing out the cache flush in some cases when
resolving wasn't necessary.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index 0836b92f983a61a179e5fe9e6f51b2bf2b7f58e5..24355c5e4f9c88d99e5109947e415c321aaccf0c 100644 (file)
@@ -2133,7 +2133,7 @@ intel_miptree_all_slices_resolve_depth(struct brw_context *brw,
 }
 
 
-void
+bool
 intel_miptree_resolve_color(struct brw_context *brw,
                             struct intel_mipmap_tree *mt,
                             int flags)
@@ -2144,21 +2144,25 @@ intel_miptree_resolve_color(struct brw_context *brw,
     */
    if ((flags & INTEL_MIPTREE_IGNORE_CCS_E) &&
        intel_miptree_is_lossless_compressed(brw, mt))
-      return;
+      return false;
 
    switch (mt->fast_clear_state) {
    case INTEL_FAST_CLEAR_STATE_NO_MCS:
    case INTEL_FAST_CLEAR_STATE_RESOLVED:
       /* No resolve needed */
-      break;
+      return false;
    case INTEL_FAST_CLEAR_STATE_UNRESOLVED:
    case INTEL_FAST_CLEAR_STATE_CLEAR:
       /* Fast color clear resolves only make sense for non-MSAA buffers. */
       if (mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE ||
           intel_miptree_is_lossless_compressed(brw, mt)) {
          brw_blorp_resolve_color(brw, mt);
+         return true;
+      } else {
+         return false;
       }
-      break;
+   default:
+      unreachable("Invalid fast clear state");
    }
 }
 
index c28fb3364f6dce3ae511b1e8950b698d8bbde6f8..94bf6648d3623217c999475463043238c1809707 100644 (file)
@@ -941,7 +941,7 @@ intel_miptree_used_for_rendering(struct intel_mipmap_tree *mt)
  */
 #define INTEL_MIPTREE_IGNORE_CCS_E (1 << 0)
 
-void
+bool
 intel_miptree_resolve_color(struct brw_context *brw,
                             struct intel_mipmap_tree *mt,
                             int flags);