[Mesa-dev] [v2 09/17] i965: Refactor check if color resolve is needed
Topi Pohjolainen
topi.pohjolainen at gmail.com
Wed Nov 23 09:16:08 UTC 2016
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 43 +++++++++++++++++----------
1 file changed, 27 insertions(+), 16 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index e4bda40..3895b2e 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2280,23 +2280,40 @@ intel_miptree_used_for_rendering(const struct brw_context *brw,
}
}
-bool
-intel_miptree_resolve_color(struct brw_context *brw,
- struct intel_mipmap_tree *mt,
- unsigned level, unsigned layer,
- int flags)
+static bool
+intel_miptree_needs_color_resolve(const struct brw_context *brw,
+ const struct intel_mipmap_tree *mt,
+ int flags)
{
if (mt->no_ccs)
return false;
- intel_miptree_check_color_resolve(mt, level, layer);
+ const bool is_lossless_compressed =
+ intel_miptree_is_lossless_compressed(brw, mt);
/* From gen9 onwards there is new compression scheme for single sampled
* surfaces called "lossless compressed". These don't need to be always
* resolved.
*/
- if ((flags & INTEL_MIPTREE_IGNORE_CCS_E) &&
- intel_miptree_is_lossless_compressed(brw, mt))
+ if ((flags & INTEL_MIPTREE_IGNORE_CCS_E) && is_lossless_compressed)
+ return false;
+
+ /* Fast color clear resolves only make sense for non-MSAA buffers. */
+ if (mt->msaa_layout != INTEL_MSAA_LAYOUT_NONE && !is_lossless_compressed)
+ return false;
+
+ return true;
+}
+
+bool
+intel_miptree_resolve_color(struct brw_context *brw,
+ struct intel_mipmap_tree *mt,
+ unsigned level, unsigned layer,
+ int flags)
+{
+ intel_miptree_check_color_resolve(mt, level, layer);
+
+ if (!intel_miptree_needs_color_resolve(brw, mt, flags))
return false;
switch (mt->fast_clear_state) {
@@ -2305,14 +2322,8 @@ intel_miptree_resolve_color(struct brw_context *brw,
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, level, layer);
- return true;
- } else {
- return false;
- }
+ brw_blorp_resolve_color(brw, mt, level, layer);
+ return true;
default:
unreachable("Invalid fast clear state");
}
--
2.5.5
More information about the mesa-dev
mailing list