diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-14 14:13:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-14 14:14:11 +0300 |
commit | 91b23992ce46d963aa0d81247f37ba5c59a17f05 (patch) | |
tree | 992ed1f27c7d349536c13a3d6acfe36f96a368ed | |
parent | 208a917b730b878db7fe6edfabfbba5d6e8f1c4a (diff) |
Fix T41870: Cycles OSL - Changing rotation value in anisotropic shader crashes Blender
Older OSX has major issues with sincos() function, it's likely a big in OSL
or LLVM. For until we've updated to new versions of this libraries we'll use
a workaround to prevent possible crashes on all the platforms.
Shouldn't be that bad because it's mainly used for anisotropic shader where
angle is usually constant.
This fix is safe for inclusion into final Blender 2.75 release.
-rw-r--r-- | intern/cycles/kernel/shaders/stdosl.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h index 6babe98717c..697a1756119 100644 --- a/intern/cycles/kernel/shaders/stdosl.h +++ b/intern/cycles/kernel/shaders/stdosl.h @@ -249,7 +249,21 @@ point rotate (point p, float angle, point a, point b) { vector axis = normalize (b - a); float cosang, sinang; + /* Older OSX has major issues with sincos() function, + * it's likely a big in OSL or LLVM. For until we've + * updated to new versions of this libraries we'll + * use a workaround to prevent possible crashes on all + * the platforms. + * + * Shouldn't be that bad because it's mainly used for + * anisotropic shader where angle is usually constant. + */ +#if 0 sincos (angle, sinang, cosang); +#else + sinang = sin (angle); + cosang = cos (angle); +#endif float cosang1 = 1.0 - cosang; float x = axis[0], y = axis[1], z = axis[2]; matrix M = matrix (x * x + (1.0 - x * x) * cosang, |