summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2017-05-18 11:43:55 +0200
committerIago Toral Quiroga <[email protected]>2017-06-01 08:44:34 +0200
commitc33308248357c40896872336258a66190e3c7048 (patch)
tree9a2469a5ad8fbca7b1ddc5db67a79827e0875b10 /src
parentcc972c2845e7c8554918e3aaaab95c1581ff5599 (diff)
mesa/main: Add conversion from double to uint64/int64 in GetUniform*i64v()
v2: - need unsigned rounding for double->uint64 conversion (Nicolai) - use round() instead of IROUND() macros (Iago) Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/uniform_query.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index aca54163bff..b53f60bc456 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);
+ 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);
+ memcpy(&dst[didx].u, &tmp, sizeof(tmp));
+ break;
+ }
default:
assert(!"Should not get here.");
break;