According to the documentation for 3DSTATE_DEPTH_BUFFER (G45 and
beyond), the 3 LSBs of "Depth Coordinate Offset X" (and Y) must be 0.

Detect this and apply the Gen4 miptree hack for working around
unsupported offsets.

Fixes piglit test fbo-clear-formats for GL_ARB_depth_texture and
GL_EXT_packed_depth_stencil on Ivybridge.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/mesa/drivers/dri/intel/intel_fbo.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index f00943e..7ea81e0 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -649,7 +649,8 @@ intel_renderbuffer_tile_offsets(struct intel_renderbuffer 
*irb,
 #ifndef I915
 static bool
 need_tile_offset_workaround(struct brw_context *brw,
-                           struct intel_renderbuffer *irb)
+                           struct intel_renderbuffer *irb,
+                           bool is_depthbuffer)
 {
    uint32_t tile_x, tile_y;
 
@@ -658,6 +659,12 @@ need_tile_offset_workaround(struct brw_context *brw,
    if (!brw->has_surface_tile_offset)
       return tile_x != 0 || tile_y != 0;
 
+   /* In 3DSTATE_DEPTH_BUFFER, the 3 LSBs of Depth Coordinate Offset X/Y
+    * must be zero.  We need the workaround in those cases.
+    */
+   if (is_depthbuffer)
+      return (tile_x & 0x3) != 0 || (tile_y & 0x3) != 0;
+
    return false;
 }
 #endif
@@ -724,7 +731,7 @@ intel_render_texture(struct gl_context * ctx,
       irb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
 
 #ifndef I915
-   if (need_tile_offset_workaround(brw_context(ctx), irb)) {
+   if (need_tile_offset_workaround(brw_context(ctx), irb, is_depthbuffer)) {
       /* Original gen4 hardware couldn't draw to a non-tile-aligned
        * destination in a miptree unless you actually setup your
        * renderbuffer as a miptree and used the fragile
-- 
1.7.4.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to