[Mesa-dev] [PATCH v3] mesa/format_pack: Fix pack_uint_Z_FLOAT32()
Nanley Chery
nanleychery at gmail.com
Fri Oct 5 00:48:06 UTC 2018
Since we're modifying swrast now, we should change the commit title tag
from mesa/format_pack: to just mesa:
On Mon, Oct 01, 2018 at 07:18:41PM +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".
Please insert an empty line here.
> v2: by Nanley Chery
> -add coments
> -remove _mesa_problem call, which was added for debuging this issue
I didn't suggest these, so no need to attribute them to me.
>
> 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(-)
>
> diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py
> index 0b9e0d424d..9f97c09ccc 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 Z_FLOAT32 and Z_FLOAT32_X24S8 to float.
> + **/
> +
This comment and the one below aren't correct. The direction should be
swapped. In other words, we're packing a float into a Z_FLOAT32 and
Z_FLOAT32_X24S8.
-Nanley
> 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 Z_FLOAT32 and Z_FLOAT32_X24S8 to uint.
> + **/
>
> 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