summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-07 18:40:35 +0000
committerrodri <rgl@antares-labs.eu>2024-09-07 18:40:35 +0000
commite862d6f0224de67b0a329e16b91841206feb844a (patch)
treea712a7447153a234daae207f26db21ef4f979477
parenta3add1cdcbd30704a34d2876f556d0bff8694402 (diff)
download3dee-e862d6f0224de67b0a329e16b91841206feb844a.tar.gz
3dee-e862d6f0224de67b0a329e16b91841206feb844a.tar.bz2
3dee-e862d6f0224de67b0a329e16b91841206feb844a.zip
let the renderer print the profiling results.
-rw-r--r--med.c8
-rw-r--r--procgen.c4
-rw-r--r--solar.c8
-rw-r--r--vis.c8
4 files changed, 10 insertions, 18 deletions
diff --git a/med.c b/med.c
index 8d01511..ae56169 100644
--- a/med.c
+++ b/med.c
@@ -506,12 +506,6 @@ renderproc(void *)
shootcamera(cam, shader);
qunlock(&scenelk);
shootcamera(compass.cam, getshader("ident"));
- if(doprof)
- fprint(2, "R %llud %llud\nE %llud %llud\nT %llud %llud\nr %llud %llud\n\n",
- cam->times.R[cam->times.cur-1].t0, cam->times.R[cam->times.cur-1].t1,
- cam->times.E[cam->times.cur-1].t0, cam->times.E[cam->times.cur-1].t1,
- cam->times.Tn[cam->times.cur-1].t0, cam->times.Tn[cam->times.cur-1].t1,
- cam->times.Rn[cam->times.cur-1].t0, cam->times.Rn[cam->times.cur-1].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
lockdisplay(display);
@@ -841,6 +835,8 @@ threadmain(int argc, char *argv[])
if((mctl = initmouse(nil, screen)) == nil)
sysfatal("initmouse: %r");
+ rctl->doprof = doprof;
+
screenb = eallocimage(display, rectsubpt(screen->r, screen->r.min), XRGB32, 0, DNofill);
cam = Cam(screenb->r, rctl, camcfg.ptype, camcfg.fov, camcfg.clipn, camcfg.clipf);
placecamera(cam, scene, camcfg.p, camcfg.lookat, camcfg.up);
diff --git a/procgen.c b/procgen.c
index e34b82d..d94e48e 100644
--- a/procgen.c
+++ b/procgen.c
@@ -24,6 +24,8 @@ Entity *ent;
Model *mdl;
Primitive quad[2];
+static int doprof;
+
static Color
getskycolor(double x, double y)
{
@@ -149,6 +151,7 @@ threadmain(int argc, char *argv[])
skip = 0;
ARGBEGIN{
case 's': skip = strtoul(EARGF(usage()), nil, 10); break;
+ case 'p': doprof++; break;
default: usage();
}ARGEND;
if(argc > 0)
@@ -165,6 +168,7 @@ threadmain(int argc, char *argv[])
sysfatal("memimageinit: %r");
if((rctl = initgraphics()) == nil)
sysfatal("initgraphics: %r");
+ rctl->doprof = doprof;
scn = newscene(nil);
mdl = newmodel();
diff --git a/solar.c b/solar.c
index 5d35329..5db3337 100644
--- a/solar.c
+++ b/solar.c
@@ -564,12 +564,6 @@ renderproc(void *)
t0 = nsec();
for(;;){
shootcamera(camera, &shader);
- if(doprof)
- fprint(2, "R %llud %llud\nE %llud %llud\nT %llud %llud\nr %llud %llud\n\n",
- camera->times.R[camera->times.cur-1].t0, camera->times.R[camera->times.cur-1].t1,
- camera->times.E[camera->times.cur-1].t0, camera->times.E[camera->times.cur-1].t1,
- camera->times.Tn[camera->times.cur-1].t0, camera->times.Tn[camera->times.cur-1].t1,
- camera->times.Rn[camera->times.cur-1].t0, camera->times.Rn[camera->times.cur-1].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
lockdisplay(display);
@@ -943,6 +937,8 @@ threadmain(int argc, char *argv[])
if((mctl = initmouse(nil, screen)) == nil)
sysfatal("initmouse: %r");
+ rctl->doprof = doprof;
+
viewr = rectsubpt(Rpt(screen->r.min, subpt(screen->r.max, Pt(0,Cmdwinht))), screen->r.min);
cmdbox.r = Rect(viewr.min.x, viewr.max.y, Dx(viewr), Dy(screen->r));
cmdbox.cmds = cmds;
diff --git a/vis.c b/vis.c
index 589ce9b..32cedd1 100644
--- a/vis.c
+++ b/vis.c
@@ -602,12 +602,6 @@ renderproc(void *)
t0 = nsec();
for(;;){
shootcamera(maincam, shader);
- if(doprof)
- fprint(2, "R %llud %llud\nE %llud %llud\nT %llud %llud\nr %llud %llud\n\n",
- maincam->times.R[maincam->times.last].t0, maincam->times.R[maincam->times.last].t1,
- maincam->times.E[maincam->times.last].t0, maincam->times.E[maincam->times.last].t1,
- maincam->times.Tn[maincam->times.last].t0, maincam->times.Tn[maincam->times.last].t1,
- maincam->times.Rn[maincam->times.last].t0, maincam->times.Rn[maincam->times.last].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
lockdisplay(display);
@@ -1112,6 +1106,8 @@ threadmain(int argc, char *argv[])
if((mctl = initmouse(nil, screen)) == nil)
sysfatal("initmouse: %r");
+ rctl->doprof = doprof;
+
screenb = eallocimage(display, rectsubpt(screen->r, screen->r.min), XRGB32, 0, 0x888888FF);
fprint(2, "screen %R\n", screenb->r);
for(i = 0; i < nelem(cams); i++){