summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2017-03-21 00:30:06 -0700
committerEmil Velikov <emil.l.velikov@gmail.com>2017-12-14 22:56:45 +0000
commit7254a74ff22e19767fe7d7cf295447cf1d5d89d7 (patch)
tree587f0b548edd3f2fb66b853941fd9ea58ad4b196
parent73b7caef62bc7691dfb1b34fa8598e822a5ce858 (diff)
downloadmesa-7254a74ff22e19767fe7d7cf295447cf1d5d89d7.tar.gz
meta: Fix ClearTexture with GL_DEPTH_COMPONENT.
We only handled unpacking for GL_DEPTH_STENCIL formats. Cemu was hitting _mesa_problem() for an unsupported format in _mesa_unpack_float_32_uint_24_8_depth_stencil_row(), because the format was depth-only, rather than depth-stencil. Cc: "13.0 12.0" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94739 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103966 Reviewed-by: Tapani Pälli <tapani.palli@intel.com> (cherry picked from commit 8705ed13e3114ad994dbd46387576749f54fc7eb)
-rw-r--r--src/mesa/drivers/common/meta.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8e33a1c5fdf..82e252d888a 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3510,15 +3510,20 @@ cleartexsubimage_depth_stencil(struct gl_context *ctx,
/* Convert the clearValue from whatever format it's in to a floating
* point value for the depth and an integer value for the stencil index
*/
- _mesa_unpack_float_32_uint_24_8_depth_stencil_row(texImage->TexFormat,
- 1, /* n */
- clearValue,
- depthStencilValue);
- /* We need a memcpy here instead of a cast because we need to
- * reinterpret the bytes as a float rather than converting it
- */
- memcpy(&depthValue, depthStencilValue, sizeof depthValue);
- stencilValue = depthStencilValue[1] & 0xff;
+ if (texImage->_BaseFormat == GL_DEPTH_STENCIL) {
+ _mesa_unpack_float_32_uint_24_8_depth_stencil_row(texImage->TexFormat,
+ 1, /* n */
+ clearValue,
+ depthStencilValue);
+ /* We need a memcpy here instead of a cast because we need to
+ * reinterpret the bytes as a float rather than converting it
+ */
+ memcpy(&depthValue, depthStencilValue, sizeof depthValue);
+ stencilValue = depthStencilValue[1] & 0xff;
+ } else {
+ _mesa_unpack_float_z_row(texImage->TexFormat, 1 /* n */,
+ clearValue, &depthValue);
+ }
}
if (texImage->_BaseFormat == GL_DEPTH_STENCIL)