Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1685 - in trunk: Engine/Control Interface


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1685 - in trunk: Engine/Control Interface
  • Date: Tue, 28 Aug 2007 16:07:51 -0600 (MDT)

Author: bigler
Date: Tue Aug 28 16:07:50 2007
New Revision: 1685

Modified:
   trunk/Engine/Control/RTRT.cc
   trunk/Engine/Control/RTRT.h
   trunk/Interface/Context.cc
   trunk/Interface/Context.h
   trunk/Interface/MantaInterface.h
   trunk/Interface/Object.h
Log:
Engine/Control/RTRT.cc
Engine/Control/RTRT.h
Interface/MantaInterface.h
  Added getPreprocessBarrier function.

Interface/Context.cc
Interface/Context.h

  The barrier pointer now comes from the MantaInterface or through
  setBarrier().

Interface/Object.h

  Added comment about preprocess needing to call context.done() if the
  classes data members are changed during the call.


Modified: trunk/Engine/Control/RTRT.cc
==============================================================================
--- trunk/Engine/Control/RTRT.cc        (original)
+++ trunk/Engine/Control/RTRT.cc        Tue Aug 28 16:07:50 2007
@@ -127,6 +127,7 @@
     barrier1("RTRT frame barrier #1"),
     barrier2("RTRT frame barrier #2"),
     barrier3("RTRT frame barrier #3"),
+    preprocessBarrier("Barrier for preprocessing"),
     transaction_lock("RTRT transaction lock"),
     thread_storage( 0 ),
     channel_create_lock("RTRT channel creation lock")
@@ -1249,6 +1250,12 @@
 }
 
 #include <Interface/RayPacket.h>
+
+//
+SCIRun::Barrier* RTRT::getPreprocessBarrier()
+{
+  return &preprocessBarrier;
+}
 
 
///////////////////////////////////////////////////////////////////////////////
 

Modified: trunk/Engine/Control/RTRT.h
==============================================================================
--- trunk/Engine/Control/RTRT.h (original)
+++ trunk/Engine/Control/RTRT.h Tue Aug 28 16:07:50 2007
@@ -170,6 +170,9 @@
     virtual CallbackHandle* registerTerminationCallback( CallbackBase_1Data< 
MantaInterface *> *);
     virtual void unregisterCallback(CallbackHandle*);
 
+    //
+    virtual SCIRun::Barrier* getPreprocessBarrier();
+
     
///////////////////////////////////////////////////////////////////////////
     
///////////////////////////////////////////////////////////////////////////
     // Debug
@@ -283,6 +286,7 @@
     SCIRun::Barrier barrier1;
     SCIRun::Barrier barrier2;
     SCIRun::Barrier barrier3;
+    SCIRun::Barrier preprocessBarrier;
     struct ReductionData {
       bool changed;
       char pad[MAXCACHELINESIZE-sizeof(bool)];

Modified: trunk/Interface/Context.cc
==============================================================================
--- trunk/Interface/Context.cc  (original)
+++ trunk/Interface/Context.cc  Tue Aug 28 16:07:50 2007
@@ -1,4 +1,5 @@
 #include <Interface/Context.h>
+#include <Interface/MantaInterface.h>
 #include <Core/Thread/Barrier.h>
 
 using namespace Manta;
@@ -10,7 +11,8 @@
   proc(0),
   numProcs(1),
   globalLights(0),
-  barrier(new SCIRun::Barrier("preprocess barrier")) {
+  barrier(0)
+{
 }
 
 PreprocessContext::PreprocessContext(MantaInterface* manta_interface,
@@ -21,14 +23,24 @@
   proc(proc),
   numProcs(numProcs),
   globalLights(globalLights),
-  barrier(new SCIRun::Barrier("preprocess barrier")) {
+  barrier(manta_interface->getPreprocessBarrier())
+{
 }
 
 PreprocessContext::~PreprocessContext() {
-  delete barrier;
+  // Don't delete barrier.  We didn't allocate it.
 }
 
 void PreprocessContext::done() const {
-  barrier->wait(numProcs);
+  if (barrier) barrier->wait(numProcs);
 }
+
+SCIRun::Barrier* PreprocessContext::setBarrier(SCIRun::Barrier* new_barrier)
+{
+  SCIRun::Barrier* old = barrier;
+  barrier = new_barrier;
+  return old;
+}
+
+
 

Modified: trunk/Interface/Context.h
==============================================================================
--- trunk/Interface/Context.h   (original)
+++ trunk/Interface/Context.h   Tue Aug 28 16:07:50 2007
@@ -199,6 +199,11 @@
                       LightSet* globalLights);
     ~PreprocessContext();
 
+    // Set the barrier.  You shouldn't need to call this if you used
+    // the constructor that takes a manta_interface.  It returns the
+    // old barrier.
+    SCIRun::Barrier* setBarrier(SCIRun::Barrier* barrier);
+    
     // Call this when you're done changing your state values during a
     // preprocess call.  It ensures that all the threads finish
     // together.

Modified: trunk/Interface/MantaInterface.h
==============================================================================
--- trunk/Interface/MantaInterface.h    (original)
+++ trunk/Interface/MantaInterface.h    Tue Aug 28 16:07:50 2007
@@ -40,6 +40,10 @@
 #include <vector>
 #include <sgi_stl_warnings_on.h>
 
+namespace SCIRun {
+  class Barrier;
+}
+
 namespace Manta {
 
   using namespace std;
@@ -205,6 +209,9 @@
     virtual CallbackHandle* 
registerParallelPreRenderCallback(CallbackBase_2Data<int, int>*) = 0;
     virtual CallbackHandle* registerTerminationCallback( CallbackBase_1Data< 
MantaInterface *> *) = 0;
     virtual void unregisterCallback(CallbackHandle*) = 0;
+
+    //
+    virtual SCIRun::Barrier* getPreprocessBarrier() = 0;
     
     
///////////////////////////////////////////////////////////////////////////
     
///////////////////////////////////////////////////////////////////////////

Modified: trunk/Interface/Object.h
==============================================================================
--- trunk/Interface/Object.h    (original)
+++ trunk/Interface/Object.h    Tue Aug 28 16:07:50 2007
@@ -16,6 +16,10 @@
     Object();
     virtual ~Object();
 
+    // If you have a function that modifies the state of the class,
+    // you need to call context.done().  This is to maintain
+    // consistency for when you have multiple threads calling
+    // preprocess.
     virtual void preprocess(const PreprocessContext& context) {};
     virtual void computeBounds(const PreprocessContext& context, BBox& bbox) 
const = 0;
     virtual void intersect(const RenderContext& context, RayPacket& rays) 
const = 0;




  • [Manta] r1685 - in trunk: Engine/Control Interface, bigler, 08/28/2007

Archive powered by MHonArc 2.6.16.

Top of page