Mesa (master): mesa/main: conversion from float in GetUniformi64v requires rounding to nearest

Iago Toral Quiroga itoral at kemper.freedesktop.org
Thu Jun 1 07:02:24 UTC 2017


Module: Mesa
Branch: master
Commit: 1356b422847dfa92dcae1e2709879daa27110795
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1356b422847dfa92dcae1e2709879daa27110795

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Thu May 18 11:43:56 2017 +0200

mesa/main: conversion from float in GetUniformi64v requires rounding to nearest

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 at gmail.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 b53f60bc45..2fdbc83be2 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -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;
                }




More information about the mesa-commit mailing list