From f3d27f51c2f752777d16c1d310095978f9a68a16 Mon Sep 17 00:00:00 2001 From: Cyd Date: Sun, 9 Aug 2026 22:40:25 -0500 Subject: [PATCH] glass panels: drop HALFTONE stretch (the per-display-mode perf sink) Playtester (Dave, SCREECH-PC, 4K) reported ~20 fps in the exploded per-display glass panels vs ~130 fps in the cockpit surround -- same scene, same machine (solo_20260809.log; maxDraw 57-92ms in panels vs 6-31ms surround). Root cause: BlitSurface used SetStretchBltMode(HALFTONE) -- GDI's slowest, per-output-pixel resample filter -- and BTGlassPanels_Tick repaints all 7 glass windows SYNCHRONOUSLY on the main render thread every ~16 Hz. 7x HALFTONE StretchDIBits of a 640x480 surface per pump stalls the frame. Default to COLORONCOLOR (nearest); BT_GLASS_SMOOTH=1 restores HALFTONE. The MFDs are low-res pixel content, so nearest reads crisp -- arguably closer to the pod CRT than the blur. A/B on the dev box (fast, understates Dave's gain): avg work 3.3->1.4ms, maxDraw stall 12-27->7ms, ~2.2x more frames per window. Co-Authored-By: Claude Opus 4.8 --- engine/MUNGA_L4/L4GLASSWIN.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/MUNGA_L4/L4GLASSWIN.cpp b/engine/MUNGA_L4/L4GLASSWIN.cpp index ded2c53..744417c 100644 --- a/engine/MUNGA_L4/L4GLASSWIN.cpp +++ b/engine/MUNGA_L4/L4GLASSWIN.cpp @@ -1180,7 +1180,16 @@ static void info.bmiHeader.biCompression = BI_RGB; const RECT &r = w->surfaceRect; - SetStretchBltMode(dc, HALFTONE); + // STRETCH MODE (perf, 2026-08-09): default COLORONCOLOR. HALFTONE runs a + // per-output-pixel resample filter; done synchronously for all 7 glass windows + // every ~16 Hz repaint (BTGlassPanels_Tick), it was the per-display-mode perf + // sink -- playtesters saw ~20 fps in the exploded panels vs ~130 fps in the + // cockpit surround (same scene, same machine). The MFDs are low-res pixel + // content, so nearest-neighbour reads crisp (and closer to the pod CRT). + // BT_GLASS_SMOOTH=1 restores HALFTONE for anyone who prefers smoothing to speed. + static int sSmooth = -1; + if (sSmooth < 0) sSmooth = getenv("BT_GLASS_SMOOTH") ? 1 : 0; + SetStretchBltMode(dc, sSmooth ? HALFTONE : COLORONCOLOR); SetBrushOrgEx(dc, 0, 0, NULL); StretchDIBits(dc, r.left, r.top, r.right - r.left, r.bottom - r.top,