ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/RtraceSimulManager.cpp
(Generate patch)

Comparing ray/src/rt/RtraceSimulManager.cpp (file contents):
Revision 2.21 by greg, Sat Nov 9 00:10:49 2024 UTC vs.
Revision 2.22 by greg, Wed Nov 13 02:43:51 2024 UTC

# Line 196 | Line 196 | RadSimulManager::SetThreadCount(int nt)
196          return NThreads();
197   }
198  
199 // Assign ray to subthread (fails if NThreads()<2)
200 bool
201 RadSimulManager::SplitRay(RAY *r)
202 {
203        if (!ray_pnprocs || ThreadsAvailable() < 1)
204                return false;
205
206        return (ray_psend(r) > 0);
207 }
208
199   // Process a ray (in subthread), optional result
200 < bool
200 > int
201   RadSimulManager::ProcessRay(RAY *r)
202   {
203          if (!Ready()) return false;
# Line 215 | Line 205 | RadSimulManager::ProcessRay(RAY *r)
205          if (!ray_pnprocs) {     // single-threaded mode?
206                  samplendx++;
207                  rayvalue(r);
208 <                return true;
208 >                return 1;
209          }
210 <        int     rv = ray_pqueue(r);
221 <        if (rv < 0) {
222 <                error(WARNING, "ray tracing process(es) died");
223 <                return false;
224 <        }
225 <        return (rv > 0);
210 >        return ray_pqueue(r);
211   }
212  
213   // Wait for next result (or fail)
# Line 249 | Line 234 | RadSimulManager::Cleanup(bool everything)
234          return 0;
235   }
236  
252 // How many threads are currently unoccupied?
253 int
254 RadSimulManager::ThreadsAvailable() const
255 {
256        if (!ray_pnprocs) return 1;
257
258        return ray_pnidle;
259 }
260
237   // Global pointer to simulation manager for trace call-back (only one)
238   static const RtraceSimulManager *       ourRTsimMan = NULL;
239  
# Line 405 | Line 381 | RtraceSimulManager::EnqueueBundle(const FVECT orig_dir
381                                  if (ray_fifo_in(&res) < 0)
382                                          return -1;
383                                  sendRes = false;
384 <                        } else
385 <                                sendRes &= ProcessRay(&res);
384 >                        } else {
385 >                                int     rv = ProcessRay(&res);
386 >                                if (rv < 0)
387 >                                        return -1;
388 >                                sendRes &= (rv > 0);
389 >                        }
390                  } else if (ThreadsAvailable() < NThreads() &&
391                                  FlushQueue() < 0)
392                          return -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines