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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.67 by greg, Tue Apr 10 05:16:50 2012 UTC vs.
Revision 1.68 by greg, Thu Apr 12 01:56:07 2012 UTC

# Line 9 | Line 9 | static const char RCSid[] = "$Id$";
9          Need to refactor code by forking a subprocess for each
10          rtrace call to take output and accumulate it into bins
11          for the parent process.  This will avoid our current
12 <        bottleneck around processing output queues, computing
13 <        bins and the associated buffer growth, which can be crazy
14 <        (gigabytes/subprocess).  Each child process will return
12 >        bottleneck around processing output queues.  We'll sum into
13 >        bins and avoid the associated buffer growth, which can be crazy
14 >        now (gigabytes/subprocess).  Each child process will return
15          a ray number and a fully computed and ready-to-output
16 <        record of modifiers and their summed bins.  These will
17 <        be queued and sorted by the parent for ordered output.
16 >        record of modifiers and their bin totals.  These will
17 >        be queued and sorted by the parent for ordered output or
18 >        accumulated for all rays if -c 0 is in play.
19   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
20  
21   #include  "standard.h"
# Line 36 | Line 37 | typedef int    ssize_t;
37   #define MAXMODLIST      1024            /* maximum modifiers we'll track */
38   #endif
39  
40 + #ifndef RNUMBER
41 + #define RNUMBER         unsigned long   /* ray counter (>= sizeof pointer) */
42 + #endif
43 +
44   ssize_t treebufsiz = BUFSIZ;            /* current tree buffer size */
45  
46   typedef double  DCOLOR[3];              /* double-precision color */
# Line 107 | Line 112 | void printresolu(FILE *fout, int xr, int yr);
112   struct rtproc {
113          struct rtproc   *next;          /* next in list of processes */
114          SUBPROC         pd;             /* rtrace pipe descriptors */
115 <        unsigned long   raynum;         /* ray number for this tree */
115 >        RNUMBER         raynum;         /* ray number for this tree */
116          size_t          bsiz;           /* ray tree buffer length */
117          char            *buf;           /* ray tree buffer */
118          size_t          nbr;            /* number of bytes from rtrace */
# Line 154 | Line 159 | int            xres = 0;               /* horiz. output resolution */
159   int             yres = 0;               /* vert. output resolution */
160  
161   int             account;                /* current accumulation count */
162 < unsigned long   raysleft;               /* number of rays left to trace */
162 > RNUMBER         raysleft;               /* number of rays left to trace */
163   long            waitflush;              /* how long until next flush */
164  
165 < unsigned long   lastray = 0;            /* last ray number sent */
166 < unsigned long   lastdone = 0;           /* last ray processed */
165 > RNUMBER         lastray = 0;            /* last ray number sent */
166 > RNUMBER         lastdone = 0;           /* last ray processed */
167  
168   int             using_stdout = 0;       /* are we using stdout? */
169  
# Line 591 | Line 596 | init(int np)
596          rtp->next = NULL;               /* terminate list */
597          if (yres > 0) {
598                  if (xres > 0)
599 <                        raysleft = (unsigned long)xres*yres;
599 >                        raysleft = (RNUMBER)xres*yres;
600                  else
601                          raysleft = yres;
602          } else
# Line 1566 | Line 1571 | recover_output(FILE *fin)
1571          for (nvals = 0; nvals < lastout; nvals++)
1572                  if (getinp(oname, fin) < 0)
1573                          error(USER, "unexpected EOF on input");
1574 <        lastray = lastdone = (unsigned long)lastout * accumulate;
1574 >        lastray = lastdone = (RNUMBER)lastout * accumulate;
1575          if (raysleft)
1576                  raysleft -= lastray;
1577   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines