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 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-08-09 22:40:25 -05:00
co-authored by Claude Opus 4.8
parent 39144813a4
commit f3d27f51c2
+10 -1
View File
@@ -1180,7 +1180,16 @@ static void
info.bmiHeader.biCompression = BI_RGB; info.bmiHeader.biCompression = BI_RGB;
const RECT &r = w->surfaceRect; 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); SetBrushOrgEx(dc, 0, 0, NULL);
StretchDIBits(dc, StretchDIBits(dc,
r.left, r.top, r.right - r.left, r.bottom - r.top, r.left, r.top, r.right - r.left, r.bottom - r.top,