Mesa (master): panfrost: Z24 variants should be sampled as R32UI

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 5 16:06:28 UTC 2020


Module: Mesa
Branch: master
Commit: 0406ea4856498c25479b1e1b191471f7222747d6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0406ea4856498c25479b1e1b191471f7222747d6

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Fri Jan 31 10:59:23 2020 +0100

panfrost: Z24 variants should be sampled as R32UI

Midgard has no dedicated samplers for Z24S8 and Z24X8 formats, and the
GPU expects the depth to be encoded in an IEEE 32-bit float. Turn all
Z24_UNORM variants into R32UI and let the shader do the conversion
using bfe+fmul instructions.

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

---

 src/gallium/drivers/panfrost/pan_format.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_format.c b/src/gallium/drivers/panfrost/pan_format.c
index b4fb38fefed..4f138ca4027 100644
--- a/src/gallium/drivers/panfrost/pan_format.c
+++ b/src/gallium/drivers/panfrost/pan_format.c
@@ -186,9 +186,17 @@ panfrost_find_format(const struct util_format_description *desc) {
                 return MALI_RGB10_A2I;
 
         case PIPE_FORMAT_Z32_UNORM:
+                return MALI_Z32_UNORM;
+
         case PIPE_FORMAT_Z24X8_UNORM:
         case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-                return MALI_Z32_UNORM;
+                /* Midgard has no dedicated samplers for Z24S8 and Z24X8
+                 * formats, and the GPU expects the depth to be encoded in an
+                 * IEEE 32-bit float. Turn all Z24_UNORM variants into R32UI
+                 * and let the shader do the conversion using bfe+fmul
+                 * instructions.
+                 */
+                return MALI_R32UI;
 
         case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
                 /* Z32F = R32F to the hardware */



More information about the mesa-commit mailing list