Mesa (master): mesa: Fix pack_uint_Z_FLOAT32()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 11 18:17:48 UTC 2018


Module: Mesa
Branch: master
Commit: b18f8e63ef79b5098cb32de1670983ad1e6892fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b18f8e63ef79b5098cb32de1670983ad1e6892fe

Author: Illia Iorin <illia.iorin at gmail.com>
Date:   Thu Oct 11 18:06:18 2018 +0300

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 <illia.iorin at globallogic.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

---

 src/mesa/main/format_pack.py | 21 +++++++++------------
 src/mesa/swrast/s_depth.c    |  6 ------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py
index 0b9e0d424d..9fa4f412d4 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 4b9640d319..de7f14a4fc 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)




More information about the mesa-commit mailing list