blob: f01bee0316640ce40d901980e29fc7730bcb4584 [file] [log] [blame]
From 6c880a1732450089693027331439740d455d838d Mon Sep 17 00:00:00 2001
From: Haixia Shi <hshi@chromium.org>
Date: Mon, 12 Dec 2016 11:51:55 -0800
Subject: [PATCH] CHROMIUM: i965: Fix corner cases of brw depth stencil
workaround
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since we can't repro this bug, it's hard to track it down, but it
looks like there are multiple issues with the workaround, which this
patch tries to fix.
This fixes two corner cases with the workaround:
- Fix the case where there is a depth but no stencil
- Fix the case there the depth mt hasn't been created
BUG=chromium:423546
TEST=builds and runs on link
Change-Id: Ib2813252dc825443470f67b6214c16d38981cda5
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: James Ausmus <james.ausmus@intel.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
src/mesa/drivers/dri/i965/brw_misc_state.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index d242aa4991..04c12389ac 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -225,11 +225,11 @@ brw_workaround_depthstencil_alignment(struct brw_context *brw,
/* Check if depth buffer is in depth/stencil format. If so, then it's only
* safe to invalidate it if we're also clearing stencil.
*/
- if (depth_irb && invalidate_depth &&
+ if (depth_irb && depth_mt && invalidate_depth &&
_mesa_get_format_base_format(depth_mt->format) == GL_DEPTH_STENCIL)
invalidate_depth = invalidate_stencil && stencil_irb;
- if (depth_irb) {
+ if (depth_irb && depth_mt) {
if (rebase_depth_stencil(brw, depth_irb, invalidate_depth)) {
/* In the case of stencil_irb being the same packed depth/stencil
* texture but not the same rb, make it point at our rebased mt, too.
@@ -250,7 +250,7 @@ brw_workaround_depthstencil_alignment(struct brw_context *brw,
}
/* If there is no depth attachment, consider if stencil needs rebase. */
- if (!depth_irb && stencil_irb)
+ if (!depth_irb && stencil_irb && stencil_irb->mt)
rebase_depth_stencil(brw, stencil_irb, invalidate_stencil);
}
--
2.12.2