panfrost: Fix stride calculation for Z32_S8X24/X32_S8X24 formats
authorBoris Brezillon <boris.brezillon@collabora.com>
Sat, 21 Nov 2020 15:03:32 +0000 (16:03 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 25 Nov 2020 16:04:26 +0000 (17:04 +0100)
Z32_S8X24 variants are actually stored in 2 planes (one per component),
we have to adjust the bytes_per_pixel value accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>

src/gallium/drivers/panfrost/pan_resource.c

index c7c8976dd7d31e1b4c976c9dd281d2feaf024805..c96546398f19c0e7ea6aafcf27c3a8c467ab88b9 100644 (file)
@@ -302,6 +302,13 @@ panfrost_setup_slices(struct panfrost_device *dev,
         unsigned depth = res->depth0;
         unsigned bytes_per_pixel = util_format_get_blocksize(pres->internal_format);
 
+        /* Z32_S8X24 variants are actually stored in 2 planes (one per
+         * component), we have to adjust the bytes_per_pixel value accordingly.
+         */
+        if (pres->internal_format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT ||
+            pres->internal_format == PIPE_FORMAT_X32_S8X24_UINT)
+                bytes_per_pixel = 4;
+
         /* MSAA is implemented as a 3D texture with z corresponding to the
          * sample #, horrifyingly enough */