i965/Gen7: Move decision to allocate MCS surface into intel_mipmap_create
authorChris Forbes <chrisf@ijw.co.nz>
Sat, 30 Nov 2013 22:44:39 +0000 (11:44 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 7 Dec 2013 03:08:55 +0000 (16:08 +1300)
This gives us correct behavior for both renderbuffers (which previously
worked) and multisample textures (which would never get an MCS surface
allocated, even if CMS layout was selected)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index c3e75e5d8a38342eef29c8e4c7f5c36c23e1ef5b..c0f067370f4eae2c58da5c560230294777caa020 100644 (file)
@@ -611,6 +611,14 @@ intel_miptree_create(struct brw_context *brw,
        return NULL;
    }
 
+
+   if (mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
+      if (!intel_miptree_alloc_mcs(brw, mt, num_samples)) {
+         intel_miptree_release(&mt);
+         return NULL;
+      }
+   }
+
    /* If this miptree is capable of supporting fast color clears, set
     * mcs_state appropriately to ensure that fast clears will occur.
     * Allocation of the MCS miptree will be deferred until the first fast
@@ -829,12 +837,6 @@ intel_miptree_create_for_renderbuffer(struct brw_context *brw,
          goto fail;
    }
 
-   if (mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
-      ok = intel_miptree_alloc_mcs(brw, mt, num_samples);
-      if (!ok)
-         goto fail;
-   }
-
    return mt;
 
 fail: