[Mesa-dev] [PATCH v2 5/6] mesa/main: conversion from float in GetUniformi64v requires rounding to nearest

Iago Toral Quiroga itoral at igalia.com
Thu May 18 09:43:56 UTC 2017


As we do for all other cases of float/double conversions to integers.

v2: use round() instead of IROUND() macros
---
 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 b53f60b..2fdbc83 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;
                }
-- 
2.9.3



More information about the mesa-dev mailing list