i965/gen8: Relax asserts prohibiting arrayed/mipmapped fast clears
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 10 Jun 2016 06:12:23 +0000 (09:12 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 25 Nov 2016 14:57:07 +0000 (16:57 +0200)
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_blorp.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index 57b6f8b4fb4dd3b0d86c88d2d8126ab23bb36c4c..4c1d8583ef2c1d92787c5318123e0172efca4522 100644 (file)
@@ -889,7 +889,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
        * INTEL_FAST_CLEAR_STATE_CLEAR so that we won't waste time doing
        * redundant clears.
        */
-      intel_miptree_set_fast_clear_state(irb->mt, irb->mt_level,
+      intel_miptree_set_fast_clear_state(brw, irb->mt, irb->mt_level,
                                          logical_layer, num_layers,
                                          INTEL_FAST_CLEAR_STATE_CLEAR);
    } else {
index d061cd43f5729e174ce0b4799c2aa42a91a4119a..20ca3657c926020ec48c948c40a335308f3b5cdf 100644 (file)
@@ -1577,7 +1577,7 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
 
    /* Multisampled miptrees are only supported for single level. */
    assert(mt->first_level == 0);
-   intel_miptree_set_fast_clear_state(mt, mt->first_level, 0,
+   intel_miptree_set_fast_clear_state(brw, mt, mt->first_level, 0,
                                       mt->logical_depth0,
                                       INTEL_FAST_CLEAR_STATE_CLEAR);
 
@@ -2164,28 +2164,31 @@ intel_miptree_get_fast_clear_state(const struct intel_mipmap_tree *mt,
 }
 
 static void
-intel_miptree_check_color_resolve(const struct intel_mipmap_tree *mt,
+intel_miptree_check_color_resolve(const struct brw_context *brw,
+                                  const struct intel_mipmap_tree *mt,
                                   unsigned level, unsigned layer)
 {
    if (mt->no_ccs || !mt->mcs_buf)
       return;
 
-   /* Fast color clear is not supported for mipmapped surfaces. */
-   assert(level == 0 && mt->first_level == 0 && mt->last_level == 0);
+   /* Fast color clear is supported for mipmapped surfaces only on Gen8+. */
+   assert(brw->gen >= 8 ||
+          (level == 0 && mt->first_level == 0 && mt->last_level == 0));
 
    /* Compression of arrayed msaa surfaces is supported. */
    if (mt->num_samples > 1)
       return;
 
-   /* Fast color clear is not supported for non-msaa arrays. */
-   assert(layer == 0 && mt->logical_depth0 == 1);
+   /* Fast color clear is supported for non-msaa arrays only on Gen8+. */
+   assert(brw->gen >= 8 || (layer == 0 && mt->logical_depth0 == 1));
 
    (void)level;
    (void)layer;
 }
 
 void
-intel_miptree_set_fast_clear_state(struct intel_mipmap_tree *mt,
+intel_miptree_set_fast_clear_state(const struct brw_context *brw,
+                                   struct intel_mipmap_tree *mt,
                                    unsigned level,
                                    unsigned first_layer,
                                    unsigned num_layers,
@@ -2196,7 +2199,7 @@ intel_miptree_set_fast_clear_state(struct intel_mipmap_tree *mt,
     */
    assert(new_state != INTEL_FAST_CLEAR_STATE_RESOLVED);
 
-   intel_miptree_check_color_resolve(mt, level, first_layer);
+   intel_miptree_check_color_resolve(brw, mt, level, first_layer);
 
    assert(first_layer + num_layers <= mt->physical_depth0);
 
@@ -2234,7 +2237,7 @@ intel_miptree_used_for_rendering(const struct brw_context *brw,
       if (is_lossless_compressed ||
           fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR) {
          intel_miptree_set_fast_clear_state(
-            mt, level, start_layer + i, 1,
+            brw, mt, level, start_layer + i, 1,
             INTEL_FAST_CLEAR_STATE_UNRESOLVED);
       }
    }
@@ -2271,13 +2274,13 @@ intel_miptree_resolve_color(struct brw_context *brw,
                             unsigned start_layer, unsigned num_layers,
                             int flags)
 {
-   intel_miptree_check_color_resolve(mt, level, start_layer);
+   intel_miptree_check_color_resolve(brw, mt, level, start_layer);
 
    if (!intel_miptree_needs_color_resolve(brw, mt, flags))
       return false;
 
-   /* For now arrayed fast clear is not supported. */
-   assert(num_layers == 1);
+   /* Arrayed fast clear is only supported for gen8+. */
+   assert(brw->gen >= 8 || num_layers == 1);
 
    bool resolved = false;
    for (unsigned i = 0; i < num_layers; ++i) {
index 297d45f751dbd6a266506b3c2b18975445ead718..c67b4de8fa9b62c01b8a952c490929044ef7d9f9 100644 (file)
@@ -907,7 +907,8 @@ intel_miptree_get_fast_clear_state(const struct intel_mipmap_tree *mt,
                                    unsigned level, unsigned layer);
 
 void
-intel_miptree_set_fast_clear_state(struct intel_mipmap_tree *mt,
+intel_miptree_set_fast_clear_state(const struct brw_context *brw,
+                                   struct intel_mipmap_tree *mt,
                                    unsigned level,
                                    unsigned first_layer,
                                    unsigned num_layers,