mesa/main: conversion from float in GetUniformi64v requires rounding to nearest
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 18 May 2017 09:43:56 +0000 (11:43 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 1 Jun 2017 06:44:34 +0000 (08:44 +0200)
As we do for all other cases of float/double conversions to integers.

v2: use round() instead of IROUND() macros (Iago)

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/uniform_query.cpp

index b53f60bc4567e002c325f499764b842c2cc4c877..2fdbc83be24380ef4226561d2d06d32e081d2d66 100644 (file)
@@ -576,7 +576,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
                   break;
                }
                case GLSL_TYPE_FLOAT: {
-                  int64_t tmp = src[sidx].f;
+                  int64_t tmp = (int64_t) roundf(src[sidx].f);
                   memcpy(&dst[didx].u, &tmp, sizeof(tmp));
                   break;
                }