[Mesa-dev] [PATCH] mesa/uniform_query: use IROUND for doubles as well as floats
Ilia Mirkin
imirkin at alum.mit.edu
Tue Nov 17 13:07:10 PST 2015
On Tue, Nov 17, 2015 at 4:00 PM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> For the case where we convert a double to an int, we should
> round the same as we do for floats.
>
> This fixes GL41-CTS.gpu_shader_fp64.state_query
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/mesa/main/uniform_query.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index 083087d..cbf7062 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -437,7 +437,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
> dst[didx].i = src[sidx].i ? 1 : 0;
> break;
> case GLSL_TYPE_DOUBLE:
> - dst[didx].i = *(double *)&src[sidx].f;
> + dst[didx].i = IROUND(*(double *)&src[sidx].f);
I think you want a IROUNDD... this one takes a float from what I can
see, which will end up giving you incorrect integers > 2^23.
I guess that CTS test isn't *that* sensitive :)
> break;
> default:
> assert(!"Should not get here.");
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list