[Performance/UI] Opening scoreboard (TAB) causes a ~15ms frame hitch due to synchronous GDI font metric queries
Your system information:
https://gist.github.com/1337Shameless/73844b763f3b6e9865dc68726cec9754
Please describe your issue in as much detail as possible:
Pressing TAB to view the in-game scoreboard during active gameplay induces an instantaneous, severe frametime spike. Low-level thread interaction profiling in Superluminal isolates the root cause directly to synchronous Win32 GDI legacy font metric queries executed on the Main Thread via vfont.dll.
1. Profiler Trace: 9 ms Main Thread Freeze
Inspecting thread state during scoreboard invocation shows MainThrd entering a blocking kernel wait:
- Stall Duration:
MainThrdis halted for ~9 in stateIO. - Frame Budget Impact: On a high-refresh setup targeting 300+ FPS (frame budget $\le 3.33\text{ ms}$), a single 9 ms stall consumes ~3 consecutive frames, resulting in an aggressive, visible screen hitch.
- Unblocking Entity: The thread is unblocked by an
unknown thread, reflecting completion within the Windows kernel subsystem (win32k.sys) rather than an internal engine worker thread.
2. Blocking Callstack: Synchronous Win32 GDI Font Metric Queries
The callstack captures invoking legacy GDI functions on the presentation path:
gdi32full.dll!GetCharABCWidthsW
gdi32full.dll!GetFontCharWidthW
When the scoreboard renders (displaying 10 player names, clan tags, scores, and pings), materialsystem2.dll performs synchronous Win32 GDI calls (gdi32full.dll!GetCharABCWidthsW) on MainThrd to measure individual character glyph widths through the OS. These calls transition into kernel mode (win32u.dll / ntdll.dll!ZwWaitForSingleObject), blocking the render pipeline until the OS font driver finishes rasterization/metric queries.
Describe what you expected should happen and what did happen:
- Expected behavior: Opening the scoreboard (TAB) should be non-blocking, using pre-cached/pre-baked font atlases without stalling frame delivery or dropping frames during active gameplay. Or using hardware accelerated apis as DirectWrite.
- Actual behavior:
vfont.dllqueries character widths synchronously viagdi32full.dll!GetCharABCWidthsW, suspendingMainThrdinZwWaitForSingleObjectfor 14.8 ms and inducing a noticeable frame drop.
Steps for reproducing this issue:
- Launch Counter-Strike 2 and join an active match.
- Attach Superluminal (or capture an ETW trace using Windows Performance Recorder with kernel wait/context switch events enabled).
- Press and hold the scoreboard key (TAB) during active gameplay.
- Locate the resulting frametime spike on
MainThrdand filter by stateDelayExecution. - Observe the block halting in
vfont.dll!0x41DA->gdi32full.dll!GetCharABCWidthsW->ZwWaitForSingleObject.