[Mesa-dev] [PATCH v2 6/6] mesa/main: replace remaining uses of IROUND() in GetUniform*() by round()

Matt Turner mattst88 at gmail.com
Sat May 20 21:08:20 UTC 2017


On Thu, May 18, 2017 at 2:43 AM, Iago Toral Quiroga <itoral at igalia.com> wrote:
> These were correct since they were used only in conversions to signed integers,
> however this makes the implementation a bit more is more consistent and reduces
> chances of propagating use of these macros to unsigned cases in the future, which
> would not be correct.
> ---
>  src/mesa/main/uniform_query.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index 2fdbc83..e6c78bf 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -471,7 +471,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>                     *      a floating-point value is rounded to the
>                     *      nearest integer..."
>                     */
> -                  dst[didx].i = IROUND(src[sidx].f);
> +                  dst[didx].i = (int64_t) roundf(src[sidx].f);

llroundf()

>                    break;
>                 case GLSL_TYPE_BOOL:
>                    dst[didx].i = src[sidx].i ? 1 : 0;
> @@ -482,7 +482,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
>                 case GLSL_TYPE_DOUBLE: {
>                    double tmp;
>                    memcpy(&tmp, &src[sidx].f, sizeof(tmp));
> -                  dst[didx].i = IROUNDD(tmp);
> +                  dst[didx].i = (int64_t) round(tmp);

llround()


More information about the mesa-dev mailing list