summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-12-14 17:16:07 -0800
committerEric Anholt <[email protected]>2011-12-19 13:20:11 -0800
commitfdf18b323156098ba5fb2881aa1a7888d2e0667f (patch)
treed8a653a0bda12564a25c32e93741cf495f863249 /src
parent7978fb4d9fd9c3e07aa1c09eba5571ec8a437d9c (diff)
i965: Properly demote the depth mt format for fake packed depth/stencil.
gen7 only supports the non-packed formats, even if you associate a real separate stencil buffer -- otherwise it's as if the depth test always fails. This requires a little bit of care in the match_texture_image case, since the miptree format no longer matches the texture image format. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/gen7_misc_state.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c16
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.h2
4 files changed, 19 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 3946cb3d1d5..89a4e719ae0 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -53,6 +53,7 @@ static void emit_depthbuffer(struct brw_context *brw)
/* Gen7 doesn't support packed depth/stencil */
assert(stencil_mt == NULL || depth_mt != stencil_mt);
+ assert(!depth_mt || !_mesa_is_format_packed_depth_stencil(depth_mt->format));
intel_emit_depth_stall_flushes(intel);
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 6f518ee23b9..17118036128 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -279,7 +279,8 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
return false;
}
- assert(irb->mt->format == MESA_FORMAT_S8_Z24);
+ assert(irb->mt->format == MESA_FORMAT_S8_Z24 ||
+ irb->mt->format == MESA_FORMAT_X8_Z24);
ok = intel_renderbuffer_update_wrapper(intel, depth_irb, irb->mt,
0, 0, /* level, layer */
MESA_FORMAT_X8_Z24,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 989038e1610..ee2d1e03ad2 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -136,6 +136,16 @@ intel_miptree_create_internal(struct intel_context *intel,
intel_miptree_release(&mt);
return NULL;
}
+
+ /* Fix up the Z miptree format for how we're splitting out separate
+ * stencil. Gen7 expects there to be no stencil bits in its depth buffer.
+ */
+ if (mt->format == MESA_FORMAT_S8_Z24) {
+ mt->format = MESA_FORMAT_X8_Z24;
+ } else {
+ _mesa_problem("Unknown format %s in separate stencil\n",
+ _mesa_get_format_name(mt->format));
+ }
}
return mt;
@@ -320,8 +330,12 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
GLuint level = intelImage->base.Base.Level;
int width, height, depth;
- if (image->TexFormat != mt->format)
+ if (image->TexFormat != mt->format &&
+ !(image->TexFormat == MESA_FORMAT_S8_Z24 &&
+ mt->format == MESA_FORMAT_X8_Z24 &&
+ mt->stencil_mt)) {
return false;
+ }
intel_miptree_get_dimensions_for_image(image, &width, &height, &depth);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index fef1dcf8ce6..90828642019 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -149,7 +149,7 @@ struct intel_mipmap_tree
* two miptrees for storing the data. If the depthstencil texture or rb is
* MESA_FORMAT_Z32_FLOAT_X24S8, then mt->format will be
* MESA_FORMAT_Z32_FLOAT, otherwise for MESA_FORMAT_S8_Z24 objects it will be
- * MESA_FORMAT_S8_Z24.
+ * MESA_FORMAT_X8_Z24.
*/
gl_format format;