| 400 |
|
void |
| 401 |
|
parental_loop() |
| 402 |
|
{ |
| 403 |
< |
static int ignore_warning_given = 0; |
| 404 |
< |
int qlimit = (accumulate == 1) ? 1 : MAXIQ-1; |
| 403 |
> |
const int qlimit = (accumulate == 1) ? 1 : MAXIQ-1; |
| 404 |
|
int ninq = 0; |
| 405 |
|
FVECT orgdir[2*MAXIQ]; |
| 406 |
|
int i, n; |
| 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 (accumulate != 1) { |
| 416 |
< |
if (!ignore_warning_given++) |
| 417 |
< |
error(WARNING, |
| 418 |
< |
"dummy ray(s) ignored during accumulation\n"); |
| 419 |
< |
continue; |
| 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 |
< |
while (next_child_nq(1) >= 0) |
| 427 |
< |
; /* clear the queue */ |
| 428 |
< |
lastdone = lastray = 0; |
| 429 |
< |
if ((yres <= 0) | (xres <= 0)) |
| 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 || |
| 435 |
|
lastray/accumulate != (lastray+ninq)/accumulate) { |
| 442 |
|
error(SYSTEM, "pipe write error"); |
| 443 |
|
kida[i].r1 = lastray+1; |
| 444 |
|
lastray += kida[i].nr = ninq; /* mark as busy */ |
| 439 |
– |
ninq = 0; |
| 445 |
|
if (lastray < lastdone) { /* RNUMBER wrapped? */ |
| 446 |
|
while (next_child_nq(1) >= 0) |
| 447 |
|
; |
| 448 |
< |
lastdone = lastray = 0; |
| 448 |
> |
lastray -= ninq; |
| 449 |
> |
lastdone = lastray %= accumulate; |
| 450 |
|
} |
| 451 |
+ |
ninq = 0; |
| 452 |
|
} |
| 453 |
|
if (raysleft && !--raysleft) |
| 454 |
|
break; /* preemptive EOI */ |