[Bf-blender-cvs] [91b2399] master: Fix T41870: Cycles OSL - Changing rotation value in anisotropic shader crashes Blender

Sergey Sharybin noreply at git.blender.org
Sun Jun 14 13:18:43 CEST 2015


Commit: 91b23992ce46d963aa0d81247f37ba5c59a17f05
Author: Sergey Sharybin
Date:   Sun Jun 14 13:13:03 2015 +0200
Branches: master
https://developer.blender.org/rB91b23992ce46d963aa0d81247f37ba5c59a17f05

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.

===================================================================

M	intern/cycles/kernel/shaders/stdosl.h

===================================================================

diff --git a/intern/cycles/kernel/shaders/stdosl.h b/intern/cycles/kernel/shaders/stdosl.h
index 6babe98..697a175 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,




More information about the Bf-blender-cvs mailing list