diff options
author | rodri <rgl@antares-labs.eu> | 2023-12-19 11:44:16 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-12-19 11:44:16 +0000 |
commit | d60d6cd1d01d25dd4931e8c3d3f2f9476cfe2a4b (patch) | |
tree | 4ede0361f88e9af01eda4f1b2f9db7c20e980c03 /main.c | |
parent | c6b9f1912fd3821f9806f74fa9b81ff9ba4d7b4e (diff) | |
download | tinyrend-d60d6cd1d01d25dd4931e8c3d3f2f9476cfe2a4b.tar.gz tinyrend-d60d6cd1d01d25dd4931e8c3d3f2f9476cfe2a4b.tar.bz2 tinyrend-d60d6cd1d01d25dd4931e8c3d3f2f9476cfe2a4b.zip |
put the zbuflk in the Framebuf.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -65,6 +65,7 @@ struct Framebuf Memimage *cb; Memimage *zb; double *zbuf; + Lock zbuflk; Memimage *nb; /* XXX DBG */ Rectangle r; }; @@ -90,7 +91,6 @@ struct Stats Stats fps; Framebufctl *fbctl; Memimage *screenfb; -Lock zbuflk; Memimage *red, *green, *blue; OBJ *model; Memimage *modeltex; @@ -588,9 +588,9 @@ rasterize(SUparams *params, Triangle3 st, Triangle2 tt, Memimage *frag) z = st.p0.z*bc.x + st.p1.z*bc.y + st.p2.z*bc.z; w = st.p0.w*bc.x + st.p1.w*bc.y + st.p2.w*bc.z; depth = fclamp(z/w, 0, 1); - lock(&zbuflk); + lock(¶ms->fb->zbuflk); if(depth <= params->fb->zbuf[p.x + p.y*Dx(params->fb->r)]){ - unlock(&zbuflk); + unlock(¶ms->fb->zbuflk); continue; } params->fb->zbuf[p.x + p.y*Dx(params->fb->r)] = depth; @@ -600,7 +600,7 @@ rasterize(SUparams *params, Triangle3 st, Triangle2 tt, Memimage *frag) cbuf[3] = 0xFF*depth; memfillcolor(frag, *(ulong*)cbuf); pixel(params->fb->zb, p, frag); - unlock(&zbuflk); + unlock(¶ms->fb->zbuflk); cbuf[0] = 0xFF; if((tt.p0.w + tt.p1.w + tt.p2.w) != 0){ |