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.27 by greg, Sat Aug 20 06:05:53 2011 UTC vs.
Revision 2.28 by greg, Sat Aug 20 18:23:38 2011 UTC

# Line 176 | Line 176 | static int     r_send_next = 0;        /* next send ray placement
176   static int      r_recv_first = RAYQLEN; /* position of first unreported ray */
177   static int      r_recv_next = RAYQLEN;  /* next received ray placement */
178  
179 + static int      samplestep = 1;         /* sample step size */
180 +
181   #define sendq_full()    (r_send_next >= RAYQLEN)
182  
183   static int ray_pflush(void);
# Line 428 | Line 430 | ray_pchild(    /* process rays (never returns) */
430                          r_queue[i].clipset = NULL;
431                          r_queue[i].slights = NULL;
432                          r_queue[i].rlvl = 0;
433 <                        samplendx++;
433 >                        samplendx += samplestep;
434                          rayclear(&r_queue[i]);
435                          rayvalue(&r_queue[i]);
436                  }
# Line 462 | Line 464 | ray_popen(                     /* open the specified # processes */
464                  strcpy(shm_boundary, "SHM_BOUNDARY");
465          }
466          fflush(NULL);                   /* clear pending output */
467 +        samplestep = ray_pnprocs + nadd;
468          while (nadd--) {                /* fork each new process */
469                  int     p0[2], p1[2];
470                  if (pipe(p0) < 0 || pipe(p1) < 0)
# Line 480 | Line 483 | ray_popen(                     /* open the specified # processes */
483                  if (r_proc[ray_pnprocs].pid < 0)
484                          error(SYSTEM, "cannot fork child process");
485                  close(p1[0]); close(p0[1]);
486 <                if (rand_samp)          /* desynchronize random function */
487 <                        srandom((long)r_proc[ray_pnprocs].pid);
486 >                if (rand_samp)          /* decorrelate random sequence */
487 >                        srandom(random());
488 >                else
489 >                        samplendx++;
490                  /*
491                   * Close write stream on exec to avoid multiprocessing deadlock.
492                   * No use in read stream without it, so set flag there as well.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines