diff options
author | Dave Airlie <[email protected]> | 2015-10-15 05:07:40 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2016-01-11 02:27:51 +0000 |
commit | a9eace326ece7496109a8e2a55aae8fc802e89d8 (patch) | |
tree | af391221f728469eff4593724f1ff15f939807a7 /src/mesa/main/imports.h | |
parent | 124c9c2b977013f540f417d5dd102775ad02c77d (diff) |
mesa/uniform_query: add IROUNDD and use for doubles->ints (v2)
For the case where we convert a double to an int, we should
round the same as we do for floats.
This fixes GL41-CTS.gpu_shader_fp64.state_query
v2: add IROUNDD (Ilia)
Reviewed-by: Ilia Mirkin <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/imports.h')
-rw-r--r-- | src/mesa/main/imports.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 042147fd8bb..ad7af5c1d8c 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -151,6 +151,13 @@ static inline int IROUND(float f) return (int) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F)); } +/** + * Convert double to int by rounding to nearest integer, away from zero. + */ +static inline int IROUNDD(double d) +{ + return (int) ((d >= 0.0) ? (d + 0.5) : (d - 0.5)); +} /** * Convert float to int64 by rounding to nearest integer. |