shithub: libgraphics

Download patch

ref: a101d22599c9052ab242d68e12522732e710cc9e
parent: fc8284f73c62cc205bcdc1be04802763a019ec1b
author: rodri <rgl@antares-labs.eu>
date: Mon Apr 15 18:39:00 EDT 2024

render: split tiles vertically instead of horizontally.

this makes more sense memory-wise, and it also fixes a
clipping glitch that was occurring at tile boundaries.

--- a/render.c
+++ b/render.c
@@ -411,7 +411,7 @@
 	Triangle *t;				/* triangles to raster */
 	Rectangle *wr;
 	Channel **taskc;
-	ulong Δx, nproc;
+	ulong Δy, nproc;
 	int i, nt;
 	uvlong t0;
 
@@ -444,10 +444,10 @@
 		vsp.su = params;
 
 		wr[0] = params->fb->r;
-		Δx = Dx(wr[0])/nproc;
-		wr[0].max.x = wr[0].min.x + Δx;
+		Δy = Dy(wr[0])/nproc;
+		wr[0].max.y = wr[0].min.y + Δy;
 		for(i = 1; i < nproc; i++)
-			wr[i] = rectaddpt(wr[i-1], Pt(Δx,0));
+			wr[i] = rectaddpt(wr[i-1], Pt(0,Δy));
 
 		verts = params->entity->mdl->obj->vertdata[OBJVGeometric].verts;
 		tverts = params->entity->mdl->obj->vertdata[OBJVTexture].verts;