panfrost: Allocate space for multisampling
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 30 Jun 2020 20:29:16 +0000 (16:29 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 01:13:39 +0000 (01:13 +0000)
As an effective depth. Ugly but matches the blob.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5782>

src/gallium/drivers/panfrost/pan_resource.c

index 303c4a8da553aeb7339d65291ef417e4c24eca74..d0879ba00c955654d5fe67a8bc823665c2e6c0e0 100644 (file)
@@ -272,6 +272,16 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
         unsigned depth = res->depth0;
         unsigned bytes_per_pixel = util_format_get_blocksize(pres->internal_format);
 
+        /* MSAA is implemented as a 3D texture with z corresponding to the
+         * sample #, horrifyingly enough */
+
+        bool msaa = res->nr_samples > 1;
+
+        if (msaa) {
+                assert(depth == 1);
+                depth = res->nr_samples;
+        }
+
         assert(depth > 0);
 
         /* Tiled operates blockwise; linear is packed. Also, anything
@@ -361,7 +371,10 @@ panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size)
 
                 width = u_minify(width, 1);
                 height = u_minify(height, 1);
-                depth = u_minify(depth, 1);
+
+                /* Don't mipmap the sample count */
+                if (!msaa)
+                        depth = u_minify(depth, 1);
         }
 
         assert(res->array_size);