Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2014-06-13 23:13:18 +0400
committerThomas Dinges <blender@dingto.org>2014-06-13 23:59:12 +0400
commitcd5e1ff74e4f6443f3e4b836dd23fe46b56cb7ed (patch)
tree578ee132eab87d348147e49c91e1929660558c20 /intern/cycles/render/curves.cpp
parentd0573ce9054e325c0ad2fbb943087e0f8b9e159a (diff)
Cycles Refactor: Add SSE Utility code from Embree for cleaner SSE code.
This makes the code a bit easier to understand, and might come in handy if we want to reuse more Embree code. Differential Revision: https://developer.blender.org/D482 Code by Brecht, with fixes by Lockal, Sergey and myself.
Diffstat (limited to 'intern/cycles/render/curves.cpp')
-rw-r--r--intern/cycles/render/curves.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/intern/cycles/render/curves.cpp b/intern/cycles/render/curves.cpp
index 2c96ffa655e..dc7665fe144 100644
--- a/intern/cycles/render/curves.cpp
+++ b/intern/cycles/render/curves.cpp
@@ -46,8 +46,9 @@ void curvebounds(float *lower, float *upper, float3 *p, int dim)
float discroot = curve_coef[2] * curve_coef[2] - 3 * curve_coef[3] * curve_coef[1];
float ta = -1.0f;
float tb = -1.0f;
+
if(discroot >= 0) {
- discroot = sqrt(discroot);
+ discroot = sqrtf(discroot);
ta = (-curve_coef[2] - discroot) / (3 * curve_coef[3]);
tb = (-curve_coef[2] + discroot) / (3 * curve_coef[3]);
ta = (ta > 1.0f || ta < 0.0f) ? -1.0f : ta;
@@ -56,20 +57,21 @@ void curvebounds(float *lower, float *upper, float3 *p, int dim)
*upper = max(p1[dim],p2[dim]);
*lower = min(p1[dim],p2[dim]);
+
float exa = p1[dim];
float exb = p2[dim];
- float t2;
- float t3;
+
if(ta >= 0.0f) {
- t2 = ta * ta;
- t3 = t2 * ta;
+ float t2 = ta * ta;
+ float t3 = t2 * ta;
exa = curve_coef[3] * t3 + curve_coef[2] * t2 + curve_coef[1] * ta + curve_coef[0];
}
if(tb >= 0.0f) {
- t2 = tb * tb;
- t3 = t2 * tb;
+ float t2 = tb * tb;
+ float t3 = t2 * tb;
exb = curve_coef[3] * t3 + curve_coef[2] * t2 + curve_coef[1] * tb + curve_coef[0];
}
+
*upper = max(*upper, max(exa,exb));
*lower = min(*lower, min(exa,exb));
}