Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1609 - in trunk: Core/Math scenes/galileo


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1609 - in trunk: Core/Math scenes/galileo
  • Date: Fri, 3 Aug 2007 16:25:46 -0600 (MDT)

Author: bigler
Date: Fri Aug  3 16:25:45 2007
New Revision: 1609

Modified:
   trunk/Core/Math/Noise.cc
   trunk/scenes/galileo/galileo.cc
Log:
Core/Math/Noise.cc

  Clean out code that wasn't being used anymore.

scenes/galileo/galileo.cc

  Update to new API for addBookmark (fov -> hfov/vfov).


Modified: trunk/Core/Math/Noise.cc
==============================================================================
--- trunk/Core/Math/Noise.cc    (original)
+++ trunk/Core/Math/Noise.cc    Fri Aug  3 16:25:45 2007
@@ -330,79 +330,6 @@
   }
 
 #if MANTA_SSE
-  static inline __m128i CheapRNG(const __m128i& val)
-  {
-    return _mm_and_si128(_mm_set1_epi32(0xFF),
-                         _mm_add_epi32(_mm_set1_epi32(1013904223),
-                                       
_mm_mullo_epi32(_mm_set1_epi32(1664525), val)));
-  }
-  static inline __m128i DissolveRNG(const __m128i& val)
-  {
-//     val = val & 255;
-//     if (val & 1)
-//       val = (val >> 1) ^ mask;
-//     else
-//       val = val >> 1;
-    __m128i ifmask = _mm_cmpeq_epi32(_mm_and_si128(val, _mm_set1_epi32(1)), 
_mm_set1_epi32(1));
-    return _mm_xor_si128(_mm_srli_epi32(val, 1),
-                         _mm_and_si128(ifmask, _mm_set1_epi32(0xB8)));
-  }
-
-  static inline __m128i PermutationTable(const __m128i& index)
-  {
-    union {
-      unsigned int i[4];
-      __m128i      s;
-    } indicies, results;
-    indicies.s = index;
-    for(unsigned int i = 0; i < 4; ++i)
-      results.i[i] = NoiseXPermutationTable[indicies.i[i]];
-    return results.s;
-  }
-
-  // This will return a random hash number from 0 to 255
-  static inline __m128i permutationSSE(const __m128i& index)
-  {
-    __m128i index_masked = _mm_and_si128(index, _mm_set1_epi32(0xFF));
-    __m128i result;
-#if 1 // 0 for table, 1 for RNG
-#if 0 // 0 for CheapRNG, 1 for DissolveRNG
-    result = DissolveRNG(index_masked);
-#else
-#if 1
-    result = _mm_mullo_epi32(index, _mm_set1_epi32(741103597));
-#else
-    result = CheapRNG(index_masked);
-#endif
-#endif
-#else
-    result = PermutationTable(index_masked);
-#endif
-    return result;
-  }
-
-  static inline __m128i ssehash(const __m128i& x, const __m128i& y, const 
__m128i& z)
-  {
-#if 0
-    __m128i xx = _mm_mullo_epi32(x, _mm_set1_epi32(741103597));
-    __m128i yy = _mm_mullo_epi32(_mm_add_epi32(xx, y), 
_mm_set1_epi32(741103597));
-    __m128i zz = _mm_mullo_epi32(_mm_add_epi32(yy, z), 
_mm_set1_epi32(741103597));
-    return _mm_sri_epi32(zz, 17);
-#else
-    __m128 xx = _mm_cvtepi32_ps(x);
-    __m128 yy = _mm_cvtepi32_ps(y);
-    __m128 zz = _mm_cvtepi32_ps(z);
-    __m128 pi = _mm_set1_ps(3.14159265389793);
-    __m128 inv_golden = _mm_set1_ps(0.6180339887);
-    xx = _mm_add_ps(xx, inv_golden); // Avoid singularity when x==0
-    yy = _mm_add_ps(yy, pi);
-    zz = _mm_add_ps(zz, inv_golden);
-    __m128 hh = _mm_mul_ps(_mm_mul_ps(xx, yy),
-                           _mm_mul_ps(zz, pi));
-    return _mm_srai_epi32(_mm_castps_si128(hh), 17);
-#endif
-  }
-
   static inline __m128 grad(const __m128i& hash,
                             const __m128 & x,
                             const __m128 & y,
@@ -448,8 +375,6 @@
                                  _mm_sub_ps(d2, d1)));
   }
 
-#define USE_PERMUTATION_UNPACKED 1
-
   typedef union {
       unsigned int i[4];
       __m128i      s;
@@ -459,13 +384,10 @@
                          const __m128& location_y,
                          const __m128& location_z)
   {
+    // x
     __m128  offset_of_x  = fracSSE(location_x);
-#if USE_PERMUTATION_UNPACKED
     unsigned_int_ssei integer_of_x;
     integer_of_x.s = _mm_and_si128(_mm_cvttps_epi32(_mm_sub_ps(location_x, 
offset_of_x)), _mm_set1_epi32(0xFF));
-#else
-    __m128i integer_of_x = _mm_cvttps_epi32(_mm_sub_ps(location_x, 
offset_of_x));
-#endif
     __m128  fade_x       = _mm_mul_ps(_mm_mul_ps(offset_of_x, offset_of_x),
                                       _mm_mul_ps(offset_of_x,
                                                  
_mm_add_ps(_mm_mul_ps(offset_of_x,
@@ -474,25 +396,18 @@
                                                                              
     _mm_set_ps1(15.f))),
                                                             
_mm_set_ps1(10.f))));
 
+    // y
     __m128  offset_of_y  = fracSSE(location_y);
-#if USE_PERMUTATION_UNPACKED
     unsigned_int_ssei integer_of_y;
     integer_of_y.s = _mm_cvttps_epi32(_mm_sub_ps(location_y, offset_of_y));
-#else
-    __m128i integer_of_y = _mm_cvttps_epi32(_mm_sub_ps(location_y, 
offset_of_y));
-#endif
     __m128  fade_y       = _mm_mul_ps(_mm_mul_ps(offset_of_y, offset_of_y), 
_mm_mul_ps(offset_of_y, _mm_add_ps(_mm_mul_ps(offset_of_y, 
_mm_sub_ps(_mm_mul_ps(offset_of_y, _mm_set_ps1(6.f)), _mm_set_ps1(15.f))), 
_mm_set_ps1(10.f))));
 
+    // z
     __m128  offset_of_z  = fracSSE(location_z);
-#if USE_PERMUTATION_UNPACKED
     unsigned_int_ssei integer_of_z;
     integer_of_z.s = _mm_cvttps_epi32(_mm_sub_ps(location_z, offset_of_z));
-#else
-    __m128i integer_of_z = _mm_cvttps_epi32(_mm_sub_ps(location_z, 
offset_of_z));
-#endif
     __m128  fade_z       = _mm_mul_ps(_mm_mul_ps(offset_of_z, offset_of_z), 
_mm_mul_ps(offset_of_z, _mm_add_ps(_mm_mul_ps(offset_of_z, 
_mm_sub_ps(_mm_mul_ps(offset_of_z, _mm_set_ps1(6.f)), _mm_set_ps1(15.f))), 
_mm_set_ps1(10.f))));
 
-#if USE_PERMUTATION_UNPACKED
     unsigned_int_ssei hash_000, hash_001, hash_010, hash_011, hash_100, 
hash_101, hash_110, hash_111;
     for(unsigned int i = 0; i < 4; ++i) {
       unsigned int x = integer_of_x.i[i];
@@ -523,46 +438,6 @@
     __m128  value_110    = grad(hash_110.s, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), _mm_sub_ps(offset_of_y, _mm_set_ps1(1)), offset_of_z);
     __m128  value_111    = grad(hash_111.s, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), _mm_sub_ps(offset_of_y, _mm_set_ps1(1)), 
_mm_sub_ps(offset_of_z, _mm_set_ps1(1)));
 
-#else
-#if 0
-    __m128i hash_0       = permutationSSE(integer_of_x);
-    __m128i hash_00      = permutationSSE(_mm_add_epi32(hash_0,  
integer_of_y));
-    __m128i hash_000     = permutationSSE(_mm_add_epi32(hash_00, 
integer_of_z));
-    __m128i hash_001     = 
permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_00, integer_of_z), 
_mm_set1_epi32(1)));
-
-    __m128i hash_01      = permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_0 
, integer_of_y), _mm_set1_epi32(1)));
-    __m128i hash_010     = permutationSSE(_mm_add_epi32(hash_01, 
integer_of_z));
-    __m128i hash_011     = 
permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_01, integer_of_z), 
_mm_set1_epi32(1)));
-
-    __m128i hash_1       = permutationSSE(_mm_add_epi32(integer_of_x, 
_mm_set1_epi32(1)));
-    __m128i hash_10      = permutationSSE(_mm_add_epi32(hash_1,  
integer_of_y));
-    __m128i hash_100     = permutationSSE(_mm_add_epi32(hash_10, 
integer_of_z));
-    __m128i hash_101     = 
permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_10, integer_of_z), 
_mm_set1_epi32(1)));
-
-    __m128i hash_11      = permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_1 
, integer_of_y), _mm_set1_epi32(1)));
-    __m128i hash_110     = permutationSSE(_mm_add_epi32(hash_11, 
integer_of_z));
-    __m128i hash_111     = 
permutationSSE(_mm_add_epi32(_mm_add_epi32(hash_11, integer_of_z), 
_mm_set1_epi32(1)));
-#else
-    __m128i hash_000 = ssehash(integer_of_x, integer_of_y, integer_of_z);
-    __m128i hash_001 = ssehash(integer_of_x, integer_of_y, 
_mm_add_epi32(integer_of_z, _mm_set1_epi32(1)));
-    __m128i hash_010 = ssehash(integer_of_x, _mm_add_epi32(integer_of_y, 
_mm_set1_epi32(1)), integer_of_z);
-    __m128i hash_011 = ssehash(integer_of_x, _mm_add_epi32(integer_of_y, 
_mm_set1_epi32(1)), _mm_add_epi32(integer_of_z, _mm_set1_epi32(1)));
-    __m128i hash_100 = ssehash(_mm_add_epi32(integer_of_x, 
_mm_set1_epi32(1)), integer_of_y, integer_of_z);
-    __m128i hash_101 = ssehash(_mm_add_epi32(integer_of_x, 
_mm_set1_epi32(1)), integer_of_y, _mm_add_epi32(integer_of_z, 
_mm_set1_epi32(1)));
-    __m128i hash_110 = ssehash(_mm_add_epi32(integer_of_x, 
_mm_set1_epi32(1)), _mm_add_epi32(integer_of_y, _mm_set1_epi32(1)), 
integer_of_z);
-    __m128i hash_111 = ssehash(_mm_add_epi32(integer_of_x, 
_mm_set1_epi32(1)), _mm_add_epi32(integer_of_y, _mm_set1_epi32(1)), 
_mm_add_epi32(integer_of_z, _mm_set1_epi32(1)));
-#endif
-
-    __m128  value_000    = grad(hash_000, offset_of_x, offset_of_y, 
offset_of_z);
-    __m128  value_001    = grad(hash_001, offset_of_x, offset_of_y, 
_mm_sub_ps(offset_of_z, _mm_set_ps1(1)));
-    __m128  value_010    = grad(hash_010, offset_of_x, 
_mm_sub_ps(offset_of_y, _mm_set_ps1(1)), offset_of_z);
-    __m128  value_011    = grad(hash_011, offset_of_x, 
_mm_sub_ps(offset_of_y, _mm_set_ps1(1)), _mm_sub_ps(offset_of_z, 
_mm_set_ps1(1)));
-    __m128  value_100    = grad(hash_100, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), offset_of_y, offset_of_z);
-    __m128  value_101    = grad(hash_101, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), offset_of_y, _mm_sub_ps(offset_of_z, _mm_set_ps1(1)));
-    __m128  value_110    = grad(hash_110, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), _mm_sub_ps(offset_of_y, _mm_set_ps1(1)), offset_of_z);
-    __m128  value_111    = grad(hash_111, _mm_sub_ps(offset_of_x, 
_mm_set_ps1(1)), _mm_sub_ps(offset_of_y, _mm_set_ps1(1)), 
_mm_sub_ps(offset_of_z, _mm_set_ps1(1)));
-
-#endif // #if USE_PERMUTATION_UNPACKED
     //
     __m128  value_00     = Interpolate(value_000, value_001, fade_z);
     __m128  value_01     = Interpolate(value_010, value_011, fade_z);

Modified: trunk/scenes/galileo/galileo.cc
==============================================================================
--- trunk/scenes/galileo/galileo.cc     (original)
+++ trunk/scenes/galileo/galileo.cc     Fri Aug  3 16:25:45 2007
@@ -65,7 +65,8 @@
                      /* eye */    Vector(10, 10, 10),
                      /* lookat */ Vector(1,1,1),
                      /* up     */ Vector(0,0,1),
-                     /* fov    */ 28.2);
+                     /* hfov    */ 28.2,
+                     /* vfov   */ 28.2);
 
   LightSet* lights = new LightSet();
   lights->add(new PointLight(Vector(5,-3,3), Color(RGB(1,1,.8))*2));




  • [MANTA] r1609 - in trunk: Core/Math scenes/galileo, bigler, 08/03/2007

Archive powered by MHonArc 2.6.16.

Top of page