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

Comparing ray/src/rt/rayfifo.c (file contents):
Revision 2.1 by greg, Sat Dec 12 05:20:10 2009 UTC vs.
Revision 2.2 by greg, Sat Dec 12 19:01:00 2009 UTC

# Line 27 | Line 27 | static const char RCSid[] = "$Id$";
27   *  pending ray calculations and frees the FIFO buffer.  If any of
28   *  the automatic calls to the ray_fifo_out callback return a
29   *  negative value, processing stops and -1 is returned.
30 + *
31 + *  Note:  The ray passed to ray_fifo_in() may be overwritten
32 + *  arbitrarily, since it is passed to ray_pqueue().
33   */
34  
35   #include  "ray.h"
# Line 79 | Line 82 | ray_fifo_push(         /* send finished ray to output (or que
82          if ((r->rno < r_fifo_start) | (r->rno >= r_fifo_end))
83                  error(INTERNAL, "unexpected ray number in ray_fifo_push");
84  
85 +        if (r->rno - r_fifo_start >= r_fifo_len)
86 +                ray_fifo_growbuf();             /* need more space */
87 +
88          if (r->rno > r_fifo_start) {            /* insert into output queue */
83                if (r->rno - r_fifo_start >= r_fifo_len)
84                        ray_fifo_growbuf();
89                  *r_fifo(r->rno) = *r;
90                  return(0);
91          }
# Line 118 | Line 122 | ray_fifo_in(           /* add ray to FIFO */
122  
123          if (!rv)                                /* no result this time? */
124                  return(rval);
125 <                                                /* else send/queue result */
126 <        if ((rv = ray_fifo_push(r)) < 0)
127 <                return(-1);
128 <        rval += rv;
125 >        
126 >        do {                                    /* else send/queue result */
127 >                if ((rv = ray_fifo_push(r)) < 0)
128 >                        return(-1);
129 >                rval += rv;
130 >
131 >        } while (ray_presult(r, -1) > 0);       /* empty in-core queue */
132 >
133          return(rval);
134   }
135  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines