[Bf-blender-cvs] [2d7b533] master: Fix cycles using acosf in panorama render when it should use safe_acosf.

Brecht Van Lommel noreply at git.blender.org
Fri Apr 18 14:55:26 CEST 2014


Commit: 2d7b53331c80e878d48e3c2a6bdc81fef9a1a6e0
Author: Brecht Van Lommel
Date:   Thu Apr 17 14:49:57 2014 +0200
https://developer.blender.org/rB2d7b53331c80e878d48e3c2a6bdc81fef9a1a6e0

Fix cycles using acosf in panorama render when it should use safe_acosf.

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

M	intern/cycles/kernel/kernel_projection.h

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

diff --git a/intern/cycles/kernel/kernel_projection.h b/intern/cycles/kernel/kernel_projection.h
index e210860..6744471 100644
--- a/intern/cycles/kernel/kernel_projection.h
+++ b/intern/cycles/kernel/kernel_projection.h
@@ -39,7 +39,7 @@ CCL_NAMESPACE_BEGIN
 
 ccl_device float2 direction_to_spherical(float3 dir)
 {
-	float theta = acosf(dir.z);
+	float theta = safe_acosf(dir.z);
 	float phi = atan2f(dir.x, dir.y);
 
 	return make_float2(theta, phi);
@@ -97,7 +97,7 @@ ccl_device float3 fisheye_to_direction(float u, float v, float fov)
 	if(r > 1.0f)
 		return make_float3(0.0f, 0.0f, 0.0f);
 
-	float phi = acosf((r != 0.0f)? u/r: 0.0f);
+	float phi = safe_acosf((r != 0.0f)? u/r: 0.0f);
 	float theta = r * fov * 0.5f;
 
 	if(v < 0.0f) phi = -phi;
@@ -111,7 +111,7 @@ ccl_device float3 fisheye_to_direction(float u, float v, float fov)
 
 ccl_device float2 direction_to_fisheye_equisolid(float3 dir, float lens, float width, float height)
 {
-	float theta = acosf(dir.x);
+	float theta = safe_acosf(dir.x);
 	float r = 2.0f * lens * sinf(theta * 0.5f);
 	float phi = atan2f(dir.z, dir.y);
 
@@ -132,7 +132,7 @@ ccl_device float3 fisheye_equisolid_to_direction(float u, float v, float lens, f
 	if(r > rmax)
 		return make_float3(0.0f, 0.0f, 0.0f);
 
-	float phi = acosf((r != 0.0f)? u/r: 0.0f);
+	float phi = safe_acosf((r != 0.0f)? u/r: 0.0f);
 	float theta = 2.0f * asinf(r/(2.0f * lens));
 
 	if(v < 0.0f) phi = -phi;




More information about the Bf-blender-cvs mailing list