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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user