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

Comparing ray/src/rt/rxpiece.cpp (file contents):
Revision 2.6 by greg, Thu Oct 31 19:22:36 2024 UTC vs.
Revision 2.7 by greg, Wed Nov 6 18:28:52 2024 UTC

# Line 37 | Line 37 | double  mblur = 0.;                    /* motion blur parameter (unused
37  
38   double  dblur = 0.;                     /* depth-of-field blur parameter */
39  
40 < int  nproc = 1;                         /* number of processes to run */
40 > int  nproc = 1;                         /* number of processes to run (-1 in child) */
41  
42   RpictSimulManager       myRPmanager;    // global simulation manager
43  
# Line 57 | Line 57 | static RenderDataType rpiece(char *pout, RenderDataTyp
57                  "OutputCS=RGB,XYZ,prims,spec\n"
58  
59  
60 < // We could call myRPmanager.Cleanup() but why waste time
61 < // unwinding data structures when the whole frame is going away?
60 > // Exit program
61   void
62   quit(int code)                          /* quit program */
63   {
64 <        ambsync();                      // flush ambient cache
65 <
66 <        ray_done_pmap();                /* PMAP: free photon maps */
67 <
68 <        exit(code);
64 >        if (nproc < 0) {
65 >                ray_pnprocs = -1;       // hack to avoid cleanup in child
66 >                _exit(code);
67 >        }
68 >        exit(code);                     // parent still frees everything (*yawn*)
69   }
70  
71  
# Line 323 | Line 322 | main(int  argc, char  *argv[])
322                                          // render tiles
323          dtype = rpiece(outfile, dtype, zfile);
324  
325 +        ambsync();                      // flush ambient cache
326 +
327 +        ray_done_pmap();                /* PMAP: free photon maps */
328 +
329          quit(dtype==RDTnone);           // status is 1 on failure
330  
331   badopt:
# Line 509 | Line 512 | children_finished()
512  
513          if (cpid == 0) {                // children render tiles
514                  sleep(nproc - cnt);     // avoid race conditions
515 +                nproc = -1;             // flag as child
516                  return false;
517          }
518          cow_doneshare();                // parent frees memory and waits
# Line 614 | Line 618 | rpiece(char *pout, RenderDataType dt, char *zout)
618          } else {
619                  dt = myRPmanager.ReopenOutput(pdfp, pout, zout);
620                  if (dt == RDTnone)
621 <                        quit(1);
621 >                        return RDTnone;
622                  if (!fscnresolu(&hresolu, &vresolu, pdfp[0]))
623                          error(USER, "missing picture resolution");
624                  pixaspect = .0;                 // need to leave this as is
# Line 644 | Line 648 | rpiece(char *pout, RenderDataType dt, char *zout)
648                  myRPmanager.AddHeader(buf);
649                  dt = myRPmanager.NewOutput(pdfp, pout, dt, zout);
650                  if (dt == RDTnone)
651 <                        quit(1);
651 >                        return RDTnone;
652                  fprtresolu(hresolu, vresolu, pdfp[0]);
653                  fflush(pdfp[0]);
654                  if (RDTdepthT(dt) == RDTdshort) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines