From 2b4c29c7e2d9851fb04433a41805f787ae709db7 Mon Sep 17 00:00:00 2001 From: 4DBug <4DBug@github.com> Date: Wed, 21 Oct 2026 00:43:32 -0500 Subject: [PATCH] Roblox backend: DirtyRects skips primitives unchanged at the same list position (paired lists) Every pixel such a primitive covers is either inside a changed primitive's rect or drawn by the same primitives in the same order. Headless: 7% fewer pixels rasterized on resize, raster+upload -6..-9%. --- backends/roblox/render.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/roblox/render.lua b/backends/roblox/render.lua index f9faf88..8ca0367 100644 --- a/backends/roblox/render.lua +++ b/backends/roblox/render.lua @@ -328,7 +328,11 @@ local function DirtyRects(tile, layer, key, count, x0, y0, force, exposed, vx0, for k = i, count - j do local a, b, c, d = NX0[k], NY0[k], NX1[k], NY1[k] local oa, ob, oc, od = DrawnX0[k], DrawnY0[k], DrawnX1[k], DrawnY1[k] - if paired and lf[k] >= 0 and lf[k] == of[k] then + if paired and DrawnHash1[k] == ListHash1[k] and DrawnHash2[k] == ListHash2[k] then + -- same primitive at the same place in both lists: every pixel it covers is either in a changed one's + -- rect or drawn by the same primitives in the same order + continue + elseif paired and lf[k] >= 0 and lf[k] == of[k] then -- same flat rect, new bounds: only the strips between the old and new edges can differ local uy0, uy1 = min(b, ob), max(d, od) local ux0, ux1 = min(a, oa), max(c, oc)