OSDN Git Service

i965/gen7: Fix depth buffer rendering to tile offsets.
authorEric Anholt <eric@anholt.net>
Wed, 11 Jan 2012 23:31:30 +0000 (15:31 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 13 Jan 2012 18:22:54 +0000 (10:22 -0800)
commit504eaa12120c319aa990c12773f9cfe28ace0d07
tree74e0dc3ca59bce2b09ad2eb3e1ebe9ad174ab27b
parent399b9799de9980b8ebc0ba46304be207b28b7825
i965/gen7: Fix depth buffer rendering to tile offsets.

Previously, we were saying that everything from the starting tile to
region width+height was part of the limits of our depthbuffer, even if
the tile was near the bottom of the depthbuffer.  This mean that our
range was not clipping to buffer buonds if the start tile was anything
but the start of the buffer.

In bebc91f0f3a1f2d19d36a7f1a4f7c992ace064e9, this was changed to
saying that we're just rendering to a region of the size of the
renderbuffer.  This is great -- we get a range that should actually
match what we want.  However, the hardware's range checking occurs
after the X/Y offset addition, so we were clipping out rendering to
small depth mip levels when an X/Y offset was present.  Just add
tile_x/y to the width in that case -- the WM won't produce negative
x/y values pre-offset, so we just need to get the left/bottom sides of
the region to cover our buffer.

Fixes the following Piglit regressions on gen7:
    spec/ARB_depth_buffer_float/fbo-clear-formats
    spec/ARB_depth_texture/fbo-clear-formats
    spec/EXT_packed_depth_stencil/fbo-clear-formats

NOTE: This is a candidate for the 8.0 branch.
(cherry picked from commit e6d6a10c5a2962f93d4adcd251b9a47a4e438121)
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/gen7_misc_state.c