[Mesa-dev] [PATCH] mesa: Fix pack_uint_Z_FLOAT32()
Nanley Chery
nanleychery at gmail.com
Thu Oct 11 17:13:55 UTC 2018
On Thu, Oct 11, 2018 at 06:06:18PM +0300, Illia Iorin wrote:
> 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>
> ---
> src/mesa/main/format_pack.py | 21 +++++++++------------
> src/mesa/swrast/s_depth.c | 6 ------
> 2 files changed, 9 insertions(+), 18 deletions(-)
>
Thank you for the changes. This patch is
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
I'll push it later today.
> 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)
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list