i965: Add separate stencil/HiZ setup for MESA_FORMAT_Z32_FLOAT_X24S8.

This is a little more unusual than the separate MESA_FORMAT_S8_Z24
support, because in addition to storing the real stencil data in a
MESA_FORMAT_S8 miptree, we also make the Z miptree be
MESA_FORMAT_Z32_FLOAT instead of the requested format.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt 2011-12-07 14:49:45 -08:00
parent e71fc6a820
commit 4790c4ae24
3 changed files with 20 additions and 15 deletions

View File

@ -216,7 +216,7 @@ brw_depthbuffer_format(struct brw_context *brw)
if (!drb)
return BRW_DEPTHFORMAT_D32_FLOAT;
switch (drb->Base.Format) {
switch (drb->mt->format) {
case MESA_FORMAT_Z16:
return BRW_DEPTHFORMAT_D16_UNORM;
case MESA_FORMAT_Z32_FLOAT:

View File

@ -202,6 +202,8 @@ static bool brw_is_hiz_depth_format(struct intel_context *intel,
return false;
switch (format) {
case MESA_FORMAT_Z32_FLOAT:
case MESA_FORMAT_Z32_FLOAT_X24S8:
case MESA_FORMAT_X8_Z24:
case MESA_FORMAT_S8_Z24:
return true;

View File

@ -89,9 +89,6 @@ intel_miptree_create_internal(struct intel_context *intel,
mt->compressed = compress_byte ? 1 : 0;
mt->refcount = 1;
intel_get_texture_alignment_unit(intel, format,
&mt->align_w, &mt->align_h);
if (target == GL_TEXTURE_CUBE_MAP) {
assert(depth0 == 1);
mt->depth0 = 6;
@ -109,16 +106,6 @@ intel_miptree_create_internal(struct intel_context *intel,
mt->cpp = 2;
}
#ifdef I915
(void) intel;
if (intel->is_945)
i945_miptree_layout(mt);
else
i915_miptree_layout(mt);
#else
brw_miptree_layout(intel, mt);
#endif
if (_mesa_is_depthstencil_format(_mesa_get_format_base_format(format)) &&
(intel->must_use_separate_stencil ||
(intel->has_separate_stencil &&
@ -142,12 +129,28 @@ intel_miptree_create_internal(struct intel_context *intel,
*/
if (mt->format == MESA_FORMAT_S8_Z24) {
mt->format = MESA_FORMAT_X8_Z24;
} else if (mt->format == MESA_FORMAT_Z32_FLOAT_X24S8) {
mt->format = MESA_FORMAT_Z32_FLOAT;
mt->cpp = 4;
} else {
_mesa_problem("Unknown format %s in separate stencil\n",
_mesa_problem(NULL, "Unknown format %s in separate stencil mt\n",
_mesa_get_format_name(mt->format));
}
}
intel_get_texture_alignment_unit(intel, mt->format,
&mt->align_w, &mt->align_h);
#ifdef I915
(void) intel;
if (intel->is_945)
i945_miptree_layout(mt);
else
i915_miptree_layout(mt);
#else
brw_miptree_layout(intel, mt);
#endif
return mt;
}