Text archives Help
- From: brownlee@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1468 - in trunk: DynLT scenes
- Date: Thu, 12 Jul 2007 19:31:48 -0600 (MDT)
Author: brownlee
Date: Thu Jul 12 19:31:47 2007
New Revision: 1468
Modified:
trunk/DynLT/DynLTWorker.cc
trunk/scenes/CMakeLists.txt
trunk/scenes/dynlt.cc
Log:
DynLT compilation/ seg fault fixes
Modified: trunk/DynLT/DynLTWorker.cc
==============================================================================
--- trunk/DynLT/DynLTWorker.cc (original)
+++ trunk/DynLT/DynLTWorker.cc Thu Jul 12 19:31:47 2007
@@ -11,6 +11,7 @@
#include <Engine/Shadows/HardShadows.h>
#include <Model/Primitives/Sphere.h>
#include <SCIRun/Core/Thread/Time.h>
+#include <cassert>
#include <string>
@@ -18,6 +19,8 @@
using namespace SCIRun;
using namespace std;
+#define RAND() ((float)rng.nextInt()/(unsigned int)0xffffffff)
//Carson/10/07
+
// XXX: the exit strategy for static thread scheduling only works
occasionally
// (no segfault) when the queue isn't empty, and never when it is empty
@@ -25,7 +28,7 @@
context(context), id(id), exitSem(0)
{
// Seed the random number generator
- rng.seed_rng(100 + id);
+ rng.seed(100 + id);
// Generate groups of random 2D sample points
sample_groups.resize(context->ngroups);
@@ -40,8 +43,8 @@
for (unsigned int j=0; j<nsamples_root; ++j) {
Real v=0;
for (unsigned int k=0; k<nsamples_root; ++k) {
- sample_groups[i][idx++]=Vector2D(u - 0.5 + delta*rng.gendrand(),
- v - 0.5 + delta*rng.gendrand());
+ sample_groups[i][idx++]=Vector2D(u - 0.5 + delta*RAND(),
+ v - 0.5 + delta*RAND());
v += delta;
}
@@ -53,7 +56,7 @@
unsigned int nsamples=context->nsamples;
unsigned int max_idx=nsamples - 1;
for (unsigned int j=0; j<nsamples; ++j) {
- unsigned int target=static_cast<unsigned int>(max_idx*rng.gendrand());
+ unsigned int target=static_cast<unsigned int>(max_idx*RAND());
Vector2D tmp=sample_groups[i][j];
sample_groups[i][j]=sample_groups[i][target];
sample_groups[i][target]=tmp;
@@ -78,7 +81,7 @@
// RenderContext(MantaInterface*, int, int, int, const FrameState*,
// LoadBalancer*, PixelSampler*, Renderer*, ShadowAlgorithm*,
// const Camera*, const Scene*, ThreadStorage*);
- RenderContext rctx(0, 0, 0, 0, 0, 0, 0, 0, &shadows, 0, context->scene, 0);
+ RenderContext rctx(0, 0, 0, 0, 0, 0, 0, 0, &shadows, 0, context->scene, 0,
&rng);
DynLTMessage msg=context->queue->receive();
while (msg.particle>=0) {
@@ -105,7 +108,7 @@
// RenderContext(MantaInterface*, int, int, int, const FrameState*,
// LoadBalancer*, PixelSampler*, Renderer*, ShadowAlgorithm*,
// const Camera*, const Scene*, ThreadStorage*);
- RenderContext rctx(0, 0, 0, 0, 0, 0, 0, 0, &shadows, 0, context->scene, 0);
+ RenderContext rctx(0, 0, 0, 0, 0, 0, 0, 0, &shadows, 0, context->scene, 0,
&rng);
double start=Time::currentSeconds();
DynLTMessage msg;
@@ -199,11 +202,11 @@
for (unsigned int v=0; v<yres; ++v) {
for (unsigned int u=0; u<xres; ++u) {
// Pick a random sample group for surface points
- unsigned int sidx=static_cast<unsigned int>(ngroups*rng.gendrand());
+ unsigned int sidx=static_cast<unsigned int>(ngroups*RAND());
// Pick random sample group for points on the hemisphere at each depth
for (int d=0; d<=max_depth; ++d)
- hidx[d]=static_cast<unsigned int>(ngroups*rng.gendrand());
+ hidx[d]=static_cast<unsigned int>(ngroups*RAND());
Real ambient=0;
for (unsigned int s=0; s<nsamples; s += RayPacket::MaxSize) {
@@ -361,11 +364,11 @@
for (unsigned int v=0; v<yres; ++v) {
for (unsigned int u=0; u<xres; ++u) {
// Pick a random sample group for surface points
- unsigned int sidx=static_cast<unsigned int>(ngroups*rng.gendrand());
+ unsigned int sidx=static_cast<unsigned int>(ngroups*RAND());
// Pick random sample group for points on the hemisphere at each depth
for (int d=0; d<=max_depth; ++d)
- hidx[d]=static_cast<unsigned int>(ngroups*rng.gendrand());
+ hidx[d]=static_cast<unsigned int>(ngroups*RAND());
for (unsigned int s=0; s<nsamples; s += RayPacket::MaxSize) {
Real diffuse=0;
Modified: trunk/scenes/CMakeLists.txt
==============================================================================
--- trunk/scenes/CMakeLists.txt (original)
+++ trunk/scenes/CMakeLists.txt Thu Jul 12 19:31:47 2007
@@ -112,6 +112,14 @@
TARGET_LINK_LIBRARIES(scene_dynlt Manta_DynLT ${MANTA_SCENE_LINK})
ENDIF(BUILD_DYNLT)
+# Test different primitives.
+SET(SCENE_PARTICLE_CGT 0 CACHE BOOL "Test scene for particle Coherent Grid
Traversal")
+IF(SCENE_PARTICLE_CGT)
+ ADD_LIBRARY(scene_particleCGTTest particleCGTTest.cc)
+ TARGET_LINK_LIBRARIES(scene_particleCGTTest ${MANTA_SCENE_LINK})
+ENDIF(SCENE_PARTICLE_CGT)
+
+
# Recurse into galileo directory
SUBDIRS(galileo)
Modified: trunk/scenes/dynlt.cc
==============================================================================
--- trunk/scenes/dynlt.cc (original)
+++ trunk/scenes/dynlt.cc Thu Jul 12 19:31:47 2007
@@ -183,7 +183,7 @@
throw IllegalArgument("scene dynlt", i, args);
}
}
-
+
if (!world)
world=new Group();
@@ -202,20 +202,17 @@
queue=new DynLTPriorityQ(nthreads*qsize);
cerr<<"Using Priority Queue\n";
}
-
Background* bg=0;
if (env_fname != "")
bg=new EnvMapBackground(env_fname);
else
bg=new ConstantBackground(Color(RGB(0, 0, 0)));
-
if (static_threads) {
// Static thread scheduling --> create DynLTWorker threads
DynLTContext* dpltctx=new DynLTContext(context.manta_interface,
queue, scene, ngroups, nsamples,
max_depth, dilate, bg /*,
runtime,
minproc, maxproc, kd, ka */);
-
for (unsigned int i=0; i<nthreads; ++i) {
ostringstream name;
name<<"DynLT Worker "<<i;
@@ -240,8 +237,8 @@
}
#ifdef USE_STATS_COLLECTOR
- // Register DynLTStatsCollector::resetPerFrameStats to reset per-frame
stats
-
context.manta_interface->registerSerialPreRenderCallback(Callback::create(DynLTStatsCollector::resetPerFrameStats));
+ //Register DynLTStatsCollector::resetPerFrameStats to reset per-frame
stats
+
context.manta_interface->registerSerialPreRenderCallback(Callback::create(DynLTStatsCollector::resetPerFrameStats));
if (stats) {
// Register DynLTStatsCollector::dump to output statistics on exit
- [MANTA] r1468 - in trunk: DynLT scenes, brownlee, 07/12/2007
Archive powered by MHonArc 2.6.16.