intel: Only prefer separate stencil when we can do HiZ.
authorEric Anholt <eric@anholt.net>
Wed, 30 Nov 2011 16:52:54 +0000 (08:52 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 7 Dec 2011 21:36:57 +0000 (13:36 -0800)
This required is_hiz_depth_format to start returning true on S8_Z24 as
well, since that's the format we have here.  The two previous callers
are only calling it on non-depthstencil formats.

This avoids us needing to have HiZ working on a new Z format
immediately upon exposing the format (particularly painful for
Z32_FLOAT_X24S8, which means all the fake packed depth/stencil paths).

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/brw_vtbl.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index dd2e05a3669baa67cd2b9164384ca448e13eaa8e..c0a0b52434d9a0ebd72e66b1a2c9d9c138660d98 100644 (file)
@@ -214,8 +214,16 @@ static void brw_invalidate_state( struct intel_context *intel, GLuint new_state
 static bool brw_is_hiz_depth_format(struct intel_context *intel,
                                     gl_format format)
 {
-   /* In the future, this will support Z_FLOAT32. */
-   return intel->has_hiz && (format == MESA_FORMAT_X8_Z24);
+   if (!intel->has_hiz)
+      return false;
+
+   switch (format) {
+   case MESA_FORMAT_X8_Z24:
+   case MESA_FORMAT_S8_Z24:
+      return true;
+   default:
+      return false;
+   }
 }
 
 void brwInitVtbl( struct brw_context *brw )
index f8ef2625df3e1822b962b135f233a244c1c66a05..3e4baa1bfb57ae8ca6c3d971edc504f881766fdc 100644 (file)
@@ -119,8 +119,10 @@ intel_miptree_create_internal(struct intel_context *intel,
    brw_miptree_layout(intel, mt);
 #endif
 
-   if (intel->has_separate_stencil &&
-       _mesa_is_depthstencil_format(_mesa_get_format_base_format(format))) {
+   if (_mesa_is_depthstencil_format(_mesa_get_format_base_format(format)) &&
+       (intel->must_use_separate_stencil ||
+       (intel->has_separate_stencil &&
+        intel->vtbl.is_hiz_depth_format(intel, format)))) {
       mt->stencil_mt = intel_miptree_create(intel,
                                             mt->target,
                                             MESA_FORMAT_S8,