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.
This commit is contained in:
Sergey Sharybin
2015-06-14 13:13:03 +02:00
parent 208a917b73
commit 91b23992ce

View File

@@ -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,