util: fix incorrect Z bit masking in util_clear_depth_stencil()
authorBrian Paul <brianp@vmware.com>
Mon, 11 Feb 2013 23:39:42 +0000 (16:39 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 12 Feb 2013 15:11:05 +0000 (08:11 -0700)
For PIPE_FORMAT_Z24_UNORM_S8_UINT, the Z bits are in the 24
least significant bits.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=60527
and http://bugs.freedesktop.org/show_bug.cgi?id=60524
and http://bugs.freedesktop.org/show_bug.cgi?id=60047

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_surface.c

index 37f48154f1885046d73dc9c1e90e4cc3b837e1b2..b948b46d25f96a6a4a1f582ce4c0274088808aef 100644 (file)
@@ -421,10 +421,10 @@ util_clear_depth_stencil(struct pipe_context *pipe,
          else {
             uint32_t dst_mask;
             if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT)
-               dst_mask = 0xffffff00;
+               dst_mask = 0x00ffffff;
             else {
                assert(format == PIPE_FORMAT_S8_UINT_Z24_UNORM);
-               dst_mask = 0xffffff;
+               dst_mask = 0xffffff00;
             }
             if (clear_flags & PIPE_CLEAR_DEPTH)
                dst_mask = ~dst_mask;