Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2041 - trunk/Engine/Shadows


Chronological Thread 
  • From: "James Bigler" <bigler@cs.utah.edu>
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2041 - trunk/Engine/Shadows
  • Date: Thu, 7 Feb 2008 07:19:31 -0700 (MST)

Author: bigler
Date: Thu Feb  7 07:19:30 2008
New Revision: 2041

Modified:
   trunk/Engine/Shadows/HardShadows.cc
Log:
Engine/Shadows/HardShadows.cc

  Quiet a warning about validTimes be uninitialized.  His companions were
  initialized, so I suspect this was just an over-site.

  When figuring out the first valid ray for a SSE block, you shouldn't assume
  that it is always the first ray.  Check the mask to determine which is the
  actual first good ray.


Modified: trunk/Engine/Shadows/HardShadows.cc
==============================================================================
--- trunk/Engine/Shadows/HardShadows.cc (original)
+++ trunk/Engine/Shadows/HardShadows.cc Thu Feb  7 07:19:30 2008
@@ -155,7 +155,7 @@
       RayPacketData* shadowData = shadowRays.data;
       sse_t validOx=set4(0), validOy=set4(0), validOz=set4(0);
       sse_t validDx=set4(0), validDy=set4(0), validDz=set4(0);
-      sse_t validTimes;
+      sse_t validTimes=set4(0);
       for(;i<e;i+=4){
         __m128 normalx = _mm_load_ps(&sourceData->ffnormal[0][i]);
         __m128 normaly = _mm_load_ps(&sourceData->ffnormal[1][i]);
@@ -180,11 +180,15 @@
 
         const int maskResults = getmask4(mask);
         if(maskResults != 0xf){
+          // Some rays are valid (0 is valid, 1 are invalid => 0xf all 
invalid)
           last = i+3;
           if (first < 0) {
-            first = i;
+            // If we haven't found our first valid ray, set first to be the
+            // first ray that is valid.
 
             if (maskResults == 0) {
+              // All rays are valid, so just use the first one
+              first = i;
               validOx = load44(&sourceData->hitPosition[0][i]);
               validOy = load44(&sourceData->hitPosition[1][i]);
               validOz = load44(&sourceData->hitPosition[2][i]);
@@ -196,8 +200,12 @@
               validTimes = load44(&sourceData->time[i]);
             }
             else {
+              // Only some of the rays in the set are valid, so loop over 
each
+              // ray and figure out which one is our first valid hit.
               for (int r=0; r < 4; r++) {
                 if ( ((maskResults>>r)&1) == 0 ) { //r is valid
+                  // Set this ray as our first
+                  first = i+r;
                   validOx = set4(sourceData->hitPosition[0][i+r]);
                   validOy = set4(sourceData->hitPosition[1][i+r]);
                   validOz = set4(sourceData->hitPosition[2][i+r]);




  • [Manta] r2041 - trunk/Engine/Shadows, James Bigler, 02/07/2008

Archive powered by MHonArc 2.6.16.

Top of page