summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fb.c12
-rw-r--r--graphics.h2
-rw-r--r--render.c1
3 files changed, 8 insertions, 7 deletions
diff --git a/fb.c b/fb.c
index d7a896b..6037f5a 100644
--- a/fb.c
+++ b/fb.c
@@ -13,10 +13,10 @@ framebufctl_draw(Framebufctl *ctl, Image *dst)
{
Framebuf *fb;
- lock(ctl);
+ qlock(ctl);
fb = ctl->getfb(ctl);
loadimage(dst, rectaddpt(fb->r, dst->r.min), byteaddr(fb->cb, fb->r.min), bytesperline(fb->r, fb->cb->depth)*Dy(fb->r));
- unlock(ctl);
+ qunlock(ctl);
}
static void
@@ -24,18 +24,18 @@ framebufctl_memdraw(Framebufctl *ctl, Memimage *dst)
{
Framebuf *fb;
- lock(ctl);
+ qlock(ctl);
fb = ctl->getfb(ctl);
memimagedraw(dst, dst->r, fb->cb, ZP, nil, ZP, SoverD);
- unlock(ctl);
+ qunlock(ctl);
}
static void
framebufctl_swap(Framebufctl *ctl)
{
- lock(ctl);
+ qlock(ctl);
ctl->idx ^= 1;
- unlock(ctl);
+ qunlock(ctl);
}
static void
diff --git a/graphics.h b/graphics.h
index 1158bef..90a79dd 100644
--- a/graphics.h
+++ b/graphics.h
@@ -217,7 +217,7 @@ struct Framebuf
struct Framebufctl
{
- Lock;
+ QLock;
Framebuf *fb[2]; /* double buffering */
uint idx; /* front buffer index */
diff --git a/render.c b/render.c
index 400c268..6879861 100644
--- a/render.c
+++ b/render.c
@@ -123,6 +123,7 @@ rasterize(Rastertask *task)
z = flerp(prim.v[0].p.z, prim.v[1].p.z, perc);
depth = fclamp(z, 0, 1);
+ /* TODO get rid of the bounds check and make sure the clipping doesn't overflow */
if(!ptinrect(p, params->fb->r) || depth <= params->fb->zb[p.x + p.y*Dx(params->fb->r)])
goto discard;
params->fb->zb[p.x + p.y*Dx(params->fb->r)] = depth;