summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIllia Iorin <[email protected]>2018-10-11 18:06:18 +0300
committerNanley Chery <[email protected]>2018-10-11 10:15:09 -0700
commitb18f8e63ef79b5098cb32de1670983ad1e6892fe (patch)
tree6317a16cc171e469e6efd1cea040ead783a8f474
parent24db1c7fcc43fb433af6bfe80af934c3775387f1 (diff)
mesa: Fix pack_uint_Z_FLOAT32()
Fixed pack_uint_Z_FLOAT32 by casting row data to float instead uint. Remove code duplicate function pack_uint_Z_FLOAT32_X24S8. Edited case in "_mesa_get_pack_uint_z_func". Now it looks like "_mesa_get_pack_float_z_func". Remove _mesa_problem call, which was added for debuging this issue. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91433 Signed-off-by: Illia Iorin <[email protected]> Reviewed-by: Nanley Chery <[email protected]>
-rw-r--r--src/mesa/main/format_pack.py21
-rw-r--r--src/mesa/swrast/s_depth.c6
2 files changed, 9 insertions, 18 deletions
diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py
index 0b9e0d424d9..9fa4f412d4c 100644
--- a/src/mesa/main/format_pack.py
+++ b/src/mesa/main/format_pack.py
@@ -510,6 +510,10 @@ pack_float_Z_UNORM32(const GLfloat *src, void *dst)
*d = (GLuint) (*src * scale);
}
+/**
+ ** Pack float to Z_FLOAT32 or Z_FLOAT32_X24S8.
+ **/
+
static void
pack_float_Z_FLOAT32(const GLfloat *src, void *dst)
{
@@ -582,18 +586,12 @@ pack_uint_Z_UNORM32(const GLuint *src, void *dst)
*d = *src;
}
-static void
-pack_uint_Z_FLOAT32(const GLuint *src, void *dst)
-{
- GLuint *d = ((GLuint *) dst);
- const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
- *d = (GLuint) (*src * scale);
- assert(*d >= 0.0f);
- assert(*d <= 1.0f);
-}
+/**
+ ** Pack uint to Z_FLOAT32 or Z_FLOAT32_X24S8.
+ **/
static void
-pack_uint_Z_FLOAT32_X24S8(const GLuint *src, void *dst)
+pack_uint_Z_FLOAT32(const GLuint *src, void *dst)
{
GLfloat *d = ((GLfloat *) dst);
const GLdouble scale = 1.0 / (GLdouble) 0xffffffff;
@@ -617,9 +615,8 @@ _mesa_get_pack_uint_z_func(mesa_format format)
case MESA_FORMAT_Z_UNORM32:
return pack_uint_Z_UNORM32;
case MESA_FORMAT_Z_FLOAT32:
- return pack_uint_Z_FLOAT32;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
- return pack_uint_Z_FLOAT32_X24S8;
+ return pack_uint_Z_FLOAT32;
default:
_mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()");
return NULL;
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 4b9640d3190..de7f14a4fc8 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -310,12 +310,6 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
zBufferVals = zStart;
}
else {
- if (_mesa_get_format_datatype(rb->Format) != GL_UNSIGNED_NORMALIZED) {
- _mesa_problem(ctx, "Incorrectly writing swrast's integer depth "
- "values to %s depth buffer",
- _mesa_get_format_name(rb->Format));
- }
-
/* copy Z buffer values into temp buffer (32-bit Z values) */
zBufferTemp = malloc(count * sizeof(GLuint));
if (!zBufferTemp)