Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-11-07 11:35:45 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-11-07 11:35:45 +0300
commita8b9402c8ffdcf294929e11051bcc49e1bbc1037 (patch)
tree9d6f0c9efde2d7945ec10ff0bd251ee6b4028f4c /intern/cycles/kernel
parent548b8f51c9b8ab6a3c830618d6e788ec0c6dff43 (diff)
Cycles: Tweak to the expf() speed workaround
Add compile-time check for particular glibc version which fixed the issue. This makes it so own-compiled blender is the fastest in the world, and the only issue remains what should we do for release builds. After some discussion with Campbell we decided to keep it as is for now because slowdown is not that much noticeable. We'll disable this workaround for release builds when all the majority of the distros will switch to the new version of glibc.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/kernel_compat_cpu.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h
index 37cba03ff97..08c8bdd369d 100644
--- a/intern/cycles/kernel/kernel_compat_cpu.h
+++ b/intern/cycles/kernel/kernel_compat_cpu.h
@@ -25,10 +25,12 @@
#include "util_half.h"
#include "util_types.h"
-/* On 64bit linux single precision exponent is really slow comparing to the
- * double precision version, even with float<->double conversion involved.
+/* On x86_64, versions of glibc < 2.16 have an issue where expf is
+ * much slower than the double version. This was fixed in glibc 2.16.
*/
-#if !defined(__KERNEL_GPU__) && defined(__linux__) && defined(__x86_64__)
+#if !defined(__KERNEL_GPU__) && defined(__x86_64__) && defined(__x86_64__) && \
+ defined(__GNU_LIBRARY__) && defined(__GLIBC__ ) && defined(__GLIBC_MINOR__) && \
+ (__GLIBC__ <= 2 && __GLIBC_MINOR__ < 16)
# define expf(x) ((float)exp((double)(x)))
#endif