Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r960 - in trunk: Engine/Control fox/grid_demo/Model/Groups fox/grid_demo/scenes


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r960 - in trunk: Engine/Control fox/grid_demo/Model/Groups fox/grid_demo/scenes
  • Date: Fri, 24 Feb 2006 15:23:04 -0700 (MST)

Author: abe
Date: Fri Feb 24 15:23:04 2006
New Revision: 960

Modified:
   trunk/Engine/Control/RTRT.cc
   trunk/Engine/Control/RTRT.h
   trunk/fox/grid_demo/Model/Groups/DyGridParallelBuilder.cc
   trunk/fox/grid_demo/scenes/dygrid.cc
Log:


Fixed indexing problem with the parallel build.
M    fox/grid_demo/Model/Groups/DyGridParallelBuilder.cc
M    fox/grid_demo/scenes/dygrid.cc

Fixed parallel one shot deletion by adding a transaction to perform the 
deletion.
M    Engine/Control/RTRT.cc
M    Engine/Control/RTRT.h


Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc        (original)
+++ trunk/Engine/Control/RTRT.cc        Fri Feb 24 15:23:04 2006
@@ -387,13 +387,6 @@
       if(firstFrame)
         firstFrame=false;
 
-      // P0 process deletions
-      if(proc == 0){
-        //callbackLock.readLock();
-        processDeletions();
-        //callbackLock.readUnlock();
-      }
-
       if(pipelineNeedsSetup){
 
         // Negotiate the image pipeline for each channel
@@ -497,15 +490,28 @@
   }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// PARALLEL ANIMATION CALLBACKS
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
 void RTRT::doParallelAnimationCallbacks(bool& changed, int proc, int 
numProcs) {
   
   // Parallel one shot callbacks.
   ParallelOneShotMapType::iterator iter = parallelOneShots.begin();
   while(iter != parallelOneShots.end() && iter->first < 
animFrameState.frameNumber){
     iter->second->call(proc, numProcs);
-    delete iter->second;
-    parallelOneShots.erase(iter);
-    iter = parallelOneShots.begin();
+
+    // Add a deletion transaction.
+    if (proc == 0) {
+      static_cast<MantaInterface *>
+        (this)->addTransaction( "delete oneshot",
+                                Callback::create( this,
+                                                  
&RTRT::deleteParallelOneShot,
+                                                  iter ) );
+    }
+    
+    ++iter;
   }
 
   // All threads do the parallel animation callbacks
@@ -515,6 +521,20 @@
   }
 }
 
+void RTRT::deleteParallelOneShot( RTRT::ParallelOneShotMapType::iterator 
iter ) {
+
+  // Delete the callback
+  delete iter->second;
+
+  // Delete the iterator.
+  parallelOneShots.erase(iter);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+// SERIAL ANIMATION CALLBACKS
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
 void RTRT::doSerialAnimationCallbacks(bool& changed, int proc, int numProcs)
 {
   if(proc == 0){
@@ -611,12 +631,6 @@
   PRCallbackMapType::iterator stop = end+serialPreRenderCallbacks.begin();
   for(; iter != stop; iter++)
     (*iter)->call(proc, numProcs);
-}
-
-void RTRT::processDeletions()
-{
-#if NOTFINISHED
-#endif
 }
 
 void RTRT::doIdleModeCallbacks(bool changed, bool firstFrame,

Modified: trunk/Engine/Control/RTRT.h
==============================================================================
--- trunk/Engine/Control/RTRT.h (original)
+++ trunk/Engine/Control/RTRT.h Fri Feb 24 15:23:04 2006
@@ -181,13 +181,16 @@
 
     void doParallelAnimationCallbacks(bool& changed, int proc, int numProcs);
     void doSerialAnimationCallbacks(bool& changed, int proc, int numProcs);
+    
     void doParallelPreRenderCallbacks(int proc, int numProcs);
     void doSerialPreRenderCallbacks(int proc, int numProcs);
-    void processDeletions();
+
     void doIdleModeCallbacks(bool changed, bool firstFrame,
                              bool& pipelineNeedsSetup,
                              int proc, int numProcs);
     void doTerminationCallbacks();
+
+
     
     void resizeImages(long frameNumber);
     void setupPipelines(int numProcs);
@@ -217,6 +220,8 @@
 
     typedef multimap<long, CallbackBase_2Data<int, int>*, less<long> > 
ParallelOneShotMapType;
     ParallelOneShotMapType parallelOneShots;
+
+    void deleteParallelOneShot( ParallelOneShotMapType::iterator iter );
     
     typedef vector<CallbackBase_2Data<int, int>*> PRCallbackMapType;
     typedef vector<CallbackBase_3Data<int, int, bool&>*> ACallbackMapType;

Modified: trunk/fox/grid_demo/Model/Groups/DyGridParallelBuilder.cc
==============================================================================
--- trunk/fox/grid_demo/Model/Groups/DyGridParallelBuilder.cc   (original)
+++ trunk/fox/grid_demo/Model/Groups/DyGridParallelBuilder.cc   Fri Feb 24 
15:23:04 2006
@@ -108,10 +108,8 @@
   std::cerr << "Total grid cells: " << total_cells << "\n";
   
   
/////////////////////////////////////////////////////////////////////////////
-  // Resize the grid if necessary.
-  if (grid->cell_array->size() < total_cells) {
-    grid->cell_array->resize( total_cells );
-  }
+  // Resize the grid.
+  grid->cell_array->resize( total_cells );
 
   // if (grid->macro_cell_array.size() < total_macro_cells) {
   //   grid->macro_cell_array.resize( total_macro_cells );
@@ -120,7 +118,7 @@
   
/////////////////////////////////////////////////////////////////////////////
   // Clear the grid.
   for (int i=0;i<total_cells;++i) {
-    (*grid->cell_array)[i].index_list.remove_all();
+    (*grid->cell_array)[i].index_list.remove_all(); // Sets size to zero.
   }
 
   // for (int i=0;i<total_macro_cells;++i) {
@@ -213,6 +211,8 @@
           const int c = grid->get_index( x, y, z );
 
           // Add the triangle to the cell.
+          ASSERT( tri < total_triangles );
+          ASSERT( tri >= 0 );
           (*thread_cells)[c].index_list.add( tri );
         }
       }
@@ -227,7 +227,7 @@
   // Merge Stage
   const int startZ = (grid->N[2] * proc)/numProcs;
   const int endZ   = (grid->N[2] * (proc+1))/numProcs;
-
+  
   for (int z=startZ; z<endZ; ++z) {
     for (int y=0;y<grid->N[1];++y) {
       for (int x=0;x<grid->N[0];++x) {
@@ -235,25 +235,18 @@
         const int c = grid->get_index( x, y, z );
         int new_size = 0;
 
-        // Sum all of the triangles in each thread's grid.
+        // Resize the destination cell.
+        (*grid->cell_array)[c].index_list.remove_all();
+        
+        // Copy all of the triangle id's into the destination
+        // index list.
+        
+        // TODO: Have the destination cell array be used by proc 0 and
+        // avoid copying the triangles in it's array.
+        
         for (int i=0;i<builder_cells.size();++i) {
-          new_size += (*builder_cells[i])[c].index_list.size();
-        }
-
-        // Resize the destination cell if necessary.
-        if (new_size > 0) {
-          (*grid->cell_array)[c].index_list.resize( new_size );
-
-          // Copy all of the triangle id's into the destination
-          // index list.
-          
-          // TODO: Have the destination cell array be used by proc 0 and
-          // avoid copying the triangles in it's array.
-          
-          for (int i=0;i<builder_cells.size();++i) {
-            for (int j=0;j<(*builder_cells[i])[c].index_list.size();++j) {
-              (*grid->cell_array)[c].index_list[j] = 
(*builder_cells[i])[c].index_list[j];
-            }
+          for (int j=0;j<(*builder_cells[i])[c].index_list.size();++j) {
+            (*grid->cell_array)[c].index_list.add ( 
(*builder_cells[i])[c].index_list[j] );
           }
         }
       }

Modified: trunk/fox/grid_demo/scenes/dygrid.cc
==============================================================================
--- trunk/fox/grid_demo/scenes/dygrid.cc        (original)
+++ trunk/fox/grid_demo/scenes/dygrid.cc        Fri Feb 24 15:23:04 2006
@@ -112,14 +112,18 @@
 
   // Set background.
   scene->setBackground( new ConstantBackground( Color(RGB(0.8, 0.8, 0.8)) ) 
);
-  
+
+  Material *material = 0;
+  // material = new Lambertian( new 
WireframeTexture<Kdtree::KDTree::ScratchPadInfo>( new NormalTexture(), 
Color(RGB(0,0,0)) ) );
+  material = new Lambertian( new NormalTexture );
+
   
/////////////////////////////////////////////////////////////////////////////
   // Load the input triangles and normals.
   DyGridData *grid_data = new DyGridData();
   Dygrid::load( grid_data, file_name.c_str() );
 
   // Create a single ray traversal grid.
-  DyGridSingle *grid = new DyGridSingle( grid_data, new Lambertian( new 
RaySignTexture ) );
+  DyGridSingle *grid = new DyGridSingle( grid_data, material );
   scene->setObject( grid );
 
   // Create a loose parallel builder.




  • [MANTA] r960 - in trunk: Engine/Control fox/grid_demo/Model/Groups fox/grid_demo/scenes, abe, 02/24/2006

Archive powered by MHonArc 2.6.16.

Top of page