[Mesa-dev] [PATCH] i965: Return BRW_DEPTHBUFFER_D32_FLOAT as the null-depthbuffer format.

Kenneth Graunke kenneth at whitecape.org
Wed Dec 7 02:21:37 PST 2011


Fixes many crashes on Ivybridge due to upload_sf_state calling
brw_depthbuffer_format without an actual depth buffer.  This was a
recent regression on master.

+3992 piglits on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_misc_state.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Replaces patch "i965: Fix crash from calling brw_depthbuffer_format with
no Z buffer."

I agree, it's way nicer to just check for !drb in brw_depthbuffer_format.

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 8a6ee70..3e8cb3f 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -212,6 +212,9 @@ brw_depthbuffer_format(struct brw_context *brw)
       drb = srb;
    }
 
+   if (!drb)
+      return BRW_DEPTHFORMAT_D32_FLOAT;
+
    switch (drb->Base.Format) {
    case MESA_FORMAT_Z16:
       return BRW_DEPTHFORMAT_D16_UNORM;
-- 
1.7.7.1



More information about the mesa-dev mailing list