Text archives Help
- From: wald@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1778 - in trunk: Core/Math Model/Primitives
- Date: Tue, 16 Oct 2007 15:44:38 -0600 (MDT)
Author: wald
Date: Tue Oct 16 15:44:37 2007
New Revision: 1778
Modified:
trunk/Core/Math/SSEDefs.h
trunk/Model/Primitives/Sphere.cc
Log:
renamed "cast_f2i" and "cast_i2f" to (DynRT-style) cast4_f2i/i2f -- all other
sse-macros use an explicit "4" in the name, so this is more consistent.
also added oneOver4 (though I kept "oneOver" intact, in case somebody needs
it).
Suggest to either add a "4" to _all_ sse-related fcts (even those that are
not macros, ie, where it is not absolutely necessary), or to replace all
"4-macros" with "non-4" inline fct counterparts....
Modified: trunk/Core/Math/SSEDefs.h
==============================================================================
--- trunk/Core/Math/SSEDefs.h (original)
+++ trunk/Core/Math/SSEDefs.h Tue Oct 16 15:44:37 2007
@@ -54,8 +54,8 @@
#define store44i _mm_store_si128
// The cast_x2y are more like reinterpret casts. For convertions of
// types use the convert4 functions below.
-#define cast_i2f _mm_castsi128_ps
-#define cast_f2i _mm_castps_si128
+#define cast4_i2f _mm_castsi128_ps
+#define cast4_f2i _mm_castps_si128
#define convert4_f2i _mm_cvttps_epi32
#define convert4_i2f _mm_cvtepi32_ps
#define sqrt4 _mm_sqrt_ps
@@ -197,6 +197,11 @@
}
inline sse_t oneOver(const sse_t v)
+ {
+ const sse_t rcp = _mm_rcp_ps(v);
+ return _mm_sub_ps(_mm_add_ps(rcp,rcp),_mm_mul_ps(_mm_mul_ps(rcp,rcp),v));
+ }
+ inline sse_t oneOver4(const sse_t v)
{
const sse_t rcp = _mm_rcp_ps(v);
return _mm_sub_ps(_mm_add_ps(rcp,rcp),_mm_mul_ps(_mm_mul_ps(rcp,rcp),v));
Modified: trunk/Model/Primitives/Sphere.cc
==============================================================================
--- trunk/Model/Primitives/Sphere.cc (original)
+++ trunk/Model/Primitives/Sphere.cc Tue Oct 16 15:44:37 2007
@@ -132,7 +132,7 @@
sse_t r = sqrt4(disc);
// -(r+B) The xor negates the value
- sse_t t0 = xor4(add4(r, B), cast_i2f(set4i(0x80000000)));
+ sse_t t0 = xor4(add4(r, B), cast4_i2f(set4i(0x80000000)));
sse_t hit0 = and4(hit, cmp4_gt(t0, set4(T_EPSILON)));
rays.hitWithoutTminCheck(i, hit0, t0, getMaterial(), this,
getTexCoordMapper());
@@ -262,7 +262,7 @@
sse_t r = _mm_sqrt_ps(disc);
// -(r+B) The xor negates the value
- sse_t t0 = xor4(add4(r, B), cast_i2f(set4i(0x80000000)));
+ sse_t t0 = xor4(add4(r, B), cast4_i2f(set4i(0x80000000)));
sse_t hit0 = and4(hit, cmp4_gt(t0, set4(T_EPSILON)));
rays.hitWithoutTminCheck(i, hit0, t0, getMaterial(), this,
getTexCoordMapper());
- [Manta] r1778 - in trunk: Core/Math Model/Primitives, wald, 10/16/2007
Archive powered by MHonArc 2.6.16.