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 c2420fee56
commit 2dc4c07d3a
Notes: blender-bot 2023-02-14 10:04:47 +01:00
Referenced by issue #41870, Cycles OSL - Changing rotation value in anisotropic shader crashes Blender
1 changed files with 14 additions and 0 deletions

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,