On 30.11.2017 19:53, Kenneth Graunke wrote:
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.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94739
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103966
---
src/mesa/drivers/common/meta.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 1cc736cff1c..41f4f5526ad 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3510,15 +3510,21 @@ 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);
+ stencilValue = depthStencilValue[1] & 0xff;
+
+ /* 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);
+ } else {
here stencilValue is not set so gcc complains:
drivers/common/meta.c:3534:7: warning: ‘stencilValue’ may be used
uninitialized in this function
that is harmless because for GL_DEPTH_STENCIL it is always intialized
but maybe initialize at declaration?
+ _mesa_unpack_float_z_row(texImage->TexFormat, 1 /* n */,
+ clearValue, &depthValue);
+ }
} else {
depthValue = 0.0f;
stencilValue = 0;
with warning cleaned up;
Reviewed-by: Tapani Pälli <[email protected]>
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev