[Mesa-dev] [PATCH] llvmpipe: fix PIPE_FORMAT_Z24_UNORM_S8_UINT depth on big endian

Dave Airlie airlied at gmail.com
Mon Sep 15 00:51:30 PDT 2014


From: Dave Airlie <airlied at redhat.com>

We had a bug report from some screensavers in xscreensaver package
not working on ppc64be, I took a day out to cause myself undue pain.

I tracked it down to the depth buffer not being read correctly,
I've no idea if this is the proper fix for it, I need to run
some more piglit on it. (my ppc64 f20 box is in a state of bad flux,
and needs more RAM.)

This does fix glean stencil2, glsl1 frag writing tests at least.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/drivers/llvmpipe/lp_bld_depth.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
index 5c13ee5..8e8b394 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -365,6 +365,10 @@ get_z_shift_and_mask(const struct util_format_description *format_desc,
    *width = format_desc->channel[z_swizzle].size;
    *shift = format_desc->channel[z_swizzle].shift;
 
+#ifdef PIPE_ARCH_BIG_ENDIAN
+   *shift = total_bits - *width - *shift;
+#endif
+
    if (*width == total_bits) {
       *mask = 0xffffffff;
    } else {
@@ -403,6 +407,9 @@ get_s_shift_and_mask(const struct util_format_description *format_desc,
 
    *shift = format_desc->channel[s_swizzle].shift;
    sz = format_desc->channel[s_swizzle].size;
+#ifdef PIPE_ARCH_BIG_ENDIAN
+   *shift = format_desc->block.bits - sz - *shift;
+#endif
    *mask = (1U << sz) - 1U;
 
    return TRUE;
-- 
1.9.3



More information about the mesa-dev mailing list