WebGL map: keep the 2D map where WebGL is drawn by the processor

With the perf benchmark now waiting for the surface the map was drawn on,
headless Chromium showed what WebGL costs without a graphics card: its
SwiftShader renderer spends about 8 µs per instance, so the coastlines alone
(29k segments, twice) took about 480 ms and a big map 1.4 s a frame, where the
2D canvas takes 46 ms. Players get the same with a blocked driver, a virtual
machine or Mesa's llvmpipe. glInit() now reads the renderer first and keeps
the 2D map on SwiftShader, llvmpipe, softpipe, lavapipe, WARP or any
"software" renderer; GLX.soft lets the GPU benchmark measure them anyway.
This commit is contained in:
Antoine 2026-11-04 14:45:48 +01:00
parent 1e9b1d458b
commit 39941c257e
No known key found for this signature in database
GPG key ID: 728FF1CE15732B05
4 changed files with 35 additions and 3 deletions

View file

@ -139,6 +139,8 @@
addEventListener('load', async () => {
document.body.appendChild(box);
while (typeof migrate !== 'function' || typeof GLX === 'undefined') await sleep(50);
// A software renderer is measured too here (the game itself keeps the 2D map on one); the table names the renderer.
GLX.soft = true;
// ?dpr=2 draws the map as a screen of that density would (a 4K screen's pixels, measured on a smaller one).
const DPRQ = +QS.get('dpr'); if (DPRQ > 0) { Object.defineProperty(window, 'devicePixelRatio', { get: () => DPRQ }); resize(); WL.key = null; }
await sleep(800);