aboutsummaryrefslogtreecommitdiff
path: root/camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'camera.c')
-rw-r--r--camera.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/camera.c b/camera.c
index 67bca08..9b4c1ef 100644
--- a/camera.c
+++ b/camera.c
@@ -21,6 +21,16 @@ updatestats(Camera *c, uvlong v)
}
static void
+updatetimes(Camera *c, Renderjob *j)
+{
+ c->times.R[c->times.cur] = j->times.R;
+ c->times.E[c->times.cur] = j->times.E;
+ c->times.Tn[c->times.cur] = j->times.Tn;
+ c->times.Rn[c->times.cur] = j->times.Rn;
+ c->times.cur = ++c->times.cur % nelem(c->times.R);
+}
+
+static void
verifycfg(Camera *c)
{
assert(c->vp != nil);
@@ -86,7 +96,7 @@ shootcamera(Camera *c, Shadertab *s)
job = emalloc(sizeof *job);
memset(job, 0, sizeof *job);
- job->fb = c->vp->fbctl->fb[c->vp->fbctl->idx^1]; /* address the back buffer */
+ job->fb = c->vp->fbctl->getbb(c->vp->fbctl);
job->scene = c->s;
job->shaders = s;
job->donec = chancreate(sizeof(void*), 0);
@@ -98,8 +108,9 @@ shootcamera(Camera *c, Shadertab *s)
t1 = nanosec();
c->vp->fbctl->swap(c->vp->fbctl);
+ updatestats(c, t1-t0);
+ updatetimes(c, job);
+
chanfree(job->donec);
free(job);
-
- updatestats(c, t1-t0);
}