| 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" |
| 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 |
|
} |
| 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 |
|
|