summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-08 14:31:19 +0000
committerrodri <rgl@antares-labs.eu>2024-09-08 14:31:19 +0000
commitef7b6cacac451015b7c3f0ed96eeeb002daab7db (patch)
tree4584d1420210e2b9c3e9c14a08473767b399a1b1
parentfb2c8083f028676d0c46e0d9a89de78b3f129552 (diff)
downloadlibgraphics-ef7b6cacac451015b7c3f0ed96eeeb002daab7db.tar.gz
libgraphics-ef7b6cacac451015b7c3f0ed96eeeb002daab7db.tar.bz2
libgraphics-ef7b6cacac451015b7c3f0ed96eeeb002daab7db.zip
allocate renderjob times dynamically for the parallel stages.
-rw-r--r--camera.c4
-rw-r--r--graphics.h2
-rw-r--r--render.c13
3 files changed, 10 insertions, 9 deletions
diff --git a/camera.c b/camera.c
index d5d660d..bd6ccb5 100644
--- a/camera.c
+++ b/camera.c
@@ -270,8 +270,8 @@ shootcamera(Camera *c, Shadertab *s)
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);
diff --git a/graphics.h b/graphics.h
index ef2e419..3cd070f 100644
--- a/graphics.h
+++ b/graphics.h
@@ -256,7 +256,7 @@ struct Renderjob
struct {
/* renderer, entityproc, tilers, rasterizers */
- Rendertime R, E, Tn[20], Rn[20];
+ Rendertime R, E, *Tn, *Rn;
} times;
Renderjob *next;
diff --git a/render.c b/render.c
index 4574d62..d97390a 100644
--- a/render.c
+++ b/render.c
@@ -642,12 +642,13 @@ entityproc(void *arg)
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){