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

Comparing ray/src/rt/raypcalls.c (file contents):
Revision 2.12 by greg, Sat Dec 17 22:17:51 2005 UTC vs.
Revision 2.13 by greg, Tue Dec 20 20:36:44 2005 UTC

# Line 23 | Line 23 | static const char      RCSid[] = "$Id$";
23   *  The first step is opening one or more rendering processes
24   *  with a call to ray_pinit(oct, nproc).  Before calling fork(),
25   *  ray_pinit() loads the octree and data structures into the
26 < *  caller's memory.  This permits all sorts of queries that
27 < *  wouldn't be possible otherwise, without causing any real
26 > *  caller's memory, and ray_popen() synchronizes the ambient
27 > *  file, if any.  Shared memory permits all sorts of queries
28 > *  that wouldn't be possible otherwise, without causing any real
29   *  memory overhead, since all the static data are shared
30   *  between processes.  Rays are then traced using a simple
31   *  queuing mechanism, explained below.
32   *
33 < *  The ray queue holds as many rays as there are rendering
34 < *  processes.  Rays are queued and returned by a single
33 > *  The ray queue holds at least RAYQLEN rays, up to
34 > *  as many rays as there are rendering processes.
35 > *  Rays are queued and returned by a single
36   *  ray_pqueue() call.  A ray_pqueue() return
37   *  value of 0 indicates that no rays are ready
38   *  and the queue is not yet full.  A return value of 1
# Line 105 | Line 107 | static const char      RCSid[] = "$Id$";
107   *  Note:  These routines are written to coordinate with the
108   *  definitions in raycalls.c, and in fact depend on them.
109   *  If you want to trace a ray and get a result synchronously,
110 < *  use the ray_trace() call to compute it in the parent process
110 > *  use the ray_trace() call to compute it in the parent process.
111   *  This will not interfere with any subprocess calculations,
112   *  but beware that a fatal error may end with a call to quit().
113   *
# Line 138 | Line 140 | static const char      RCSid[] = "$Id$";
140   #include  "selcall.h"
141  
142   #ifndef RAYQLEN
143 < #define RAYQLEN         16              /* # rays to send at once */
143 > #define RAYQLEN         12              /* # rays to send at once */
144   #endif
145  
146   #ifndef MAX_RPROCS
# Line 170 | Line 172 | static int     r_recv_next;            /* next receive ray placement
172   #define sendq_full()    (r_send_next >= RAYQLEN)
173  
174   static int ray_pflush(void);
175 < static void ray_pchild(int      fd_in, int      fd_out);
175 > static void ray_pchild(int fd_in, int fd_out);
176  
177  
178   extern void
# Line 267 | Line 269 | ray_pqueue(                    /* queue a ray for computation */
269                  r_send_next++;
270                  return(rval);           /* done */
271          }
272 <                                        /* add ray to send queue */
272 >                                        /* else add ray to send queue */
273          r_queue[r_send_next] = *r;
274          r_send_next++;
275                                          /* check for returned ray... */
# Line 370 | Line 372 | getready:                              /* any children waiting for us? */
372                  rp->slights = NULL;
373          }
374                                          /* return first ray received */
375 <        *r = r_queue[r_recv_first];
374 <        r_recv_first++;
375 >        *r = r_queue[r_recv_first++];
376          return(1);
377   }
378  
# Line 447 | Line 448 | ray_popen(                     /* open the specified # processes */
448                  nadd = MAX_NPROCS - ray_pnprocs;
449          if (nadd <= 0)
450                  return;
451 <        fflush(stderr);                 /* clear pending output */
452 <        fflush(stdout);
451 >        ambsync();                      /* load any new ambient values */
452 >        fflush(NULL);                   /* clear pending output */
453          while (nadd--) {                /* fork each new process */
454                  int     p0[2], p1[2];
455                  if (pipe(p0) < 0 || pipe(p1) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines