ref: ef7b6cacac451015b7c3f0ed96eeeb002daab7db
parent: fb2c8083f028676d0c46e0d9a89de78b3f129552
author: rodri <rgl@antares-labs.eu>
date: Sun Sep 8 10:31:19 EDT 2024
allocate renderjob times dynamically for the parallel stages.
--- a/camera.c
+++ b/camera.c
@@ -270,8 +270,8 @@
updatestats(c, t1-t0);
printtimings(job);
-// free(job->times.Tn);
-// free(job->times.Rn);
+ free(job->times.Tn);
+ free(job->times.Rn);
chanfree(job->donec);
free(job->camera);
--- a/graphics.h
+++ b/graphics.h
@@ -256,7 +256,7 @@
struct {
/* renderer, entityproc, tilers, rasterizers */
- Rendertime R, E, Tn[20], Rn[20];
+ Rendertime R, E, *Tn, *Rn;
} times;
Renderjob *next;
--- a/render.c
+++ b/render.c
@@ -642,12 +642,13 @@
params->job->times.E.t0 = t0;
/* prof: initialize timing slots for the next stages */
-// if(params->job->times.Tn == nil){
-// params->job->times.Tn = emalloc(nproc*sizeof(Rendertime));
-// params->job->times.Rn = emalloc(nproc*sizeof(Rendertime));
-// memset(params->job->times.Tn, 0, nproc*sizeof(Rendertime));
-// memset(params->job->times.Rn, 0, nproc*sizeof(Rendertime));
-// }
+ if(params->job->times.Tn == nil){
+ assert(params->job->times.Rn == nil);
+ params->job->times.Tn = emalloc(nproc*sizeof(Rendertime));
+ params->job->times.Rn = emalloc(nproc*sizeof(Rendertime));
+ memset(params->job->times.Tn, 0, nproc*sizeof(Rendertime));
+ memset(params->job->times.Rn, 0, nproc*sizeof(Rendertime));
+ }
/* end of job */
if(params->entity == nil){