From 8806aad87f7be2d2e82c7db2b9f0978246e5a747 Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 10 Sep 2024 14:26:35 +0000 Subject: fix a use-after-free when profiling rasterizer times. this commit also includes the turbo drawing pool. the experiment was successful in getting reasonable drawing times to a fullhd image, but the process causes glitches when moving the objects around, which is unacceptable. it's been commented out for now. --- render.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 1a858e4..c86c3d8 100644 --- a/render.c +++ b/render.c @@ -9,6 +9,7 @@ #include "internal.h" Rectangle UR = {0,0,1,1}; +//Procpool *turbodrawingpool; static ulong col2ul(Color); @@ -368,10 +369,11 @@ rasterizer(void *arg) if(decref(job) < 1){ if(job->camera->enableAbuff) squashAbuf(job->fb, job->camera->enableblend); + if(job->rctl->doprof) + job->times.Rn[rp->id].t1 = nanosec(); nbsend(job->donec, nil); free(params); - } - if(job->rctl->doprof) + }else if(job->rctl->doprof) job->times.Rn[rp->id].t1 = nanosec(); free(task); continue; @@ -749,6 +751,8 @@ initgraphics(void) nproc = 1; free(nprocs); +// turbodrawingpool = mkprocpool(nproc); + r = emalloc(sizeof *r); memset(r, 0, sizeof *r); r->jobq = chancreate(sizeof(Renderjob*), 8); -- cgit v1.2.3