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

Comparing ray/src/rt/rc3.c (file contents):
Revision 2.17 by greg, Thu Nov 15 15:26:52 2012 UTC vs.
Revision 2.18 by greg, Thu Nov 15 19:41:03 2012 UTC

# Line 277 | Line 277 | in_rchild()
277                  if (rval < 0)
278                          error(SYSTEM, "open_process() call failed");
279                  if (rval == 0) {        /* if in child, set up & return true */
280 <                        lu_doall(&modconttab, set_stdout, NULL);
280 >                        lu_doall(&modconttab, &set_stdout, NULL);
281                          lu_done(&ofiletab);
282                          while (nchild--) {      /* don't share other pipes */
283                                  close(kida[nchild].pr.w);
# Line 409 | Line 409 | parental_loop()
409          flockfile(stdin);               /* avoid lock/unlock overhead */
410   #endif
411          while (getvec(orgdir[2*ninq]) == 0 && getvec(orgdir[2*ninq+1]) == 0) {
412 <                if (orgdir[2*ninq+1][0] == 0.0 &&       /* asking for flush? */
413 <                                (orgdir[2*ninq+1][1] == 0.0) &
414 <                                (orgdir[2*ninq+1][2] == 0.0)) {
415 <                        if (ninq) {                     /* preempt our queue */
416 <                                i = next_child_nq(0);
417 <                                n = ninq;
418 <                                memset(orgdir[2*n++], 0, sizeof(FVECT)*2);
419 <                                n *= sizeof(FVECT)*2;
420 <                                if (writebuf(kida[i].pr.w, (char *)orgdir, n) != n)
421 <                                        error(SYSTEM, "pipe write error");
422 <                                kida[i].r1 = lastray+1;
423 <                                lastray += kida[i].nr = ninq;
424 <                                ninq = 0;
425 <                        }
426 <                        if ((yres <= 0) | (xres <= 0) &&
427 <                                        (lastray+1) % accumulate == 0) {
428 <                                while (next_child_nq(1) >= 0)
429 <                                        ;               /* clear the queue */
430 <                                lastdone = lastray %= accumulate;
431 <                                waitflush = 1;          /* flush next */
432 <                        }
433 <                        put_zero_record(++lastray);
434 <                } else if (++ninq >= qlimit ||
412 >                const int       zero_ray = orgdir[2*ninq+1][0] == 0.0 &&
413 >                                                (orgdir[2*ninq+1][1] == 0.0) &
414 >                                                (orgdir[2*ninq+1][2] == 0.0);
415 >                ninq += !zero_ray;
416 >                                /* Zero ray cannot go in input queue */
417 >                if (zero_ray ? ninq : ninq >= qlimit ||
418                              lastray/accumulate != (lastray+ninq)/accumulate) {
419                          i = next_child_nq(0);           /* manages output */
420                          n = ninq;
421 <                        if (accumulate != 1)            /* request flush? */
421 >                        if (accumulate > 1)             /* need terminator? */
422                                  memset(orgdir[2*n++], 0, sizeof(FVECT)*2);
423                          n *= sizeof(FVECT)*2;           /* send assignment */
424                          if (writebuf(kida[i].pr.w, (char *)orgdir, n) != n)
# Line 450 | Line 433 | parental_loop()
433                          }
434                          ninq = 0;
435                  }
436 +                if (zero_ray) {                         /* put bogus record? */
437 +                        if ((yres <= 0) | (xres <= 1) &&
438 +                                        (lastray+1) % accumulate == 0) {
439 +                                while (next_child_nq(1) >= 0)
440 +                                        ;               /* clear the queue */
441 +                                lastdone = lastray = accumulate-1;
442 +                                waitflush = 1;          /* flush next */
443 +                        }
444 +                        put_zero_record(++lastray);
445 +                }
446                  if (raysleft && !--raysleft)
447                          break;                          /* preemptive EOI */
448          }
# Line 531 | Line 524 | feeder_loop()
524                                  error(SYSTEM, "pipe write error");
525                          kida[i].r1 = lastray+1;
526                          lastray += kida[i].nr = ninq;
534                        ninq = 0;
527                          if (lastray < lastdone)         /* RNUMBER wrapped? */
528                                  lastdone = lastray = 0;
529 +                        ninq = 0;
530                  }
531                  if (raysleft && !--raysleft)
532                          break;                          /* preemptive EOI */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines