diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-28 23:21:13 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-28 23:21:13 +0400 |
commit | 131de4352b9e8f3e4ce77d2d9dc145f5db461aed (patch) | |
tree | c796dc4d9697a1122383dea92aab31493e9c0e1a /intern/cycles/kernel/kernel_projection.h | |
parent | c2be2fd4083845a381c2462a65dc0856dc6efb8e (diff) |
Cycles: fixes to make CUDA 4.2 work, compiling gave errors in shadows and
other places, was mainly due to instancing not working, but also found
issues in procedural textures.
The problem was with --use_fast_math, this seems to now have way lower
precision for some operations. Disabled this flag and selectively use
fast math functions. Did not find performance regression on GTX 460 after
doing this.
Diffstat (limited to 'intern/cycles/kernel/kernel_projection.h')
-rw-r--r-- | intern/cycles/kernel/kernel_projection.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/intern/cycles/kernel/kernel_projection.h b/intern/cycles/kernel/kernel_projection.h index a5735920cd9..72d36811626 100644 --- a/intern/cycles/kernel/kernel_projection.h +++ b/intern/cycles/kernel/kernel_projection.h @@ -69,20 +69,20 @@ __device float3 equirectangular_to_direction(float u, float v) float theta = M_PI_F*(1.0f - v); return make_float3( - sin(theta)*cos(phi), - sin(theta)*sin(phi), - cos(theta)); + sinf(theta)*cosf(phi), + sinf(theta)*sinf(phi), + cosf(theta)); } /* Fisheye <-> Cartesian direction */ __device float2 direction_to_fisheye(float3 dir, float fov) { - float r = atan2f(sqrt(dir.y*dir.y + dir.z*dir.z), dir.x) / fov; - float phi = atan2(dir.z, dir.y); + float r = atan2f(sqrtf(dir.y*dir.y + dir.z*dir.z), dir.x) / fov; + float phi = atan2f(dir.z, dir.y); - float u = r * cos(phi) + 0.5f; - float v = r * sin(phi) + 0.5f; + float u = r * cosf(phi) + 0.5f; + float v = r * sinf(phi) + 0.5f; return make_float2(u, v); } @@ -92,7 +92,7 @@ __device float3 fisheye_to_direction(float u, float v, float fov) u = (u - 0.5f) * 2.0f; v = (v - 0.5f) * 2.0f; - float r = sqrt(u*u + v*v); + float r = sqrtf(u*u + v*v); if(r > 1.0f) return make_float3(0.0f, 0.0f, 0.0f); @@ -127,7 +127,7 @@ __device float3 fisheye_equisolid_to_direction(float u, float v, float lens, flo v = (v - 0.5f) * height; float rmax = 2.0f * lens * sinf(fov * 0.25f); - float r = sqrt(u*u + v*v); + float r = sqrtf(u*u + v*v); if(r > rmax) return make_float3(0.0f, 0.0f, 0.0f); @@ -153,7 +153,7 @@ __device float3 mirrorball_to_direction(float u, float v) dir.x = 2.0f*u - 1.0f; dir.z = 2.0f*v - 1.0f; - dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f)); + dir.y = -sqrtf(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f)); /* reflection */ float3 I = make_float3(0.0f, -1.0f, 0.0f); @@ -166,7 +166,7 @@ __device float2 direction_to_mirrorball(float3 dir) /* inverse of mirrorball_to_direction */ dir.y -= 1.0f; - float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f)); + float div = 2.0f*sqrtf(max(-0.5f*dir.y, 0.0f)); if(div > 0.0f) dir /= div; |