On Thu, May 18, 2017 at 2:43 AM, Iago Toral Quiroga <ito...@igalia.com> wrote:
> v2:
>   - need unsigned rounding for double->uint64 conversion (Nicolai)
>   - use round() instead of IROUND() macros
> ---
>  src/mesa/main/uniform_query.cpp | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index aca5416..b53f60b 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -580,6 +580,13 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint 
> program, GLint location,
>                    memcpy(&dst[didx].u, &tmp, sizeof(tmp));
>                    break;
>                 }
> +               case GLSL_TYPE_DOUBLE: {
> +                  double d;
> +                  memcpy(&d, &src[sidx].f, sizeof(d));
> +                  int64_t tmp = (int64_t) round(d);

llround()

> +                  memcpy(&dst[didx].u, &tmp, sizeof(tmp));
> +                  break;
> +               }
>                 default:
>                    assert(!"Should not get here.");
>                    break;
> @@ -618,6 +625,13 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint 
> program, GLint location,
>                    memcpy(&dst[didx].u, &tmp, sizeof(tmp));
>                    break;
>                 }
> +               case GLSL_TYPE_DOUBLE: {
> +                  double d;
> +                  memcpy(&d, &src[sidx].f, sizeof(d));
> +                  uint64_t tmp = (d < 0.0) ? 0ull : (uint64_t) round(d);

llround()
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to