projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e8ca1a5
)
util/u_format: Round when converting depth values from float to z16_unorm.
author
José Fonseca
<jfonseca@vmware.com>
Thu, 20 Dec 2012 12:03:45 +0000
(12:03 +0000)
committer
José Fonseca
<jfonseca@vmware.com>
Fri, 21 Dec 2012 10:04:51 +0000
(10:04 +0000)
This makes the z16_unorm -> float -> z16_unorm conversion lossless.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/util/u_format_zs.c
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_format_zs.c
b/src/gallium/auxiliary/util/u_format_zs.c
index 816ef14204c54a3c35c3b15ff9a0d7b1b28c2edb..ed45c52f9c973fc863cb3a355f0075a52a2d30c7 100644
(file)
--- a/
src/gallium/auxiliary/util/u_format_zs.c
+++ b/
src/gallium/auxiliary/util/u_format_zs.c
@@
-72,7
+72,7
@@
static INLINE uint16_t
z32_float_to_z16_unorm(float z)
{
const float scale = 0xffff;
- return (uint16_t)(z * scale);
+ return (uint16_t)(z * scale
+ 0.5f
);
}
static INLINE float