MacGamingFixes
macgamingfixes / blank window fix

blank window fix

part of macgamingfixes. the same article is in the app, next to the switch.

rpg maker games, electron apps and browsers open under crossover as an empty window: the macos title bar is there, the picture never comes. the app is running. its drawing process is not: it crashes on its first frame. this makes the app draw inside its own process.

symptom

a game or an app starts, its process stays alive, the window shows a title bar over a blank area. it happens with everything built on chromium: nw.js games (rpg maker mv and mz), electron apps, chrome and edge.

cause

chromium does not draw in the process that owns the window. it starts a second one, the gpu process, and that one presents into the first one's window. wine's mac driver keeps window data per process and has none for a window that belongs to somebody else. d3dmetal asks for it and uses the answer without checking:

gpu process
Received fatal exception EXCEPTION_ACCESS_VIOLATION
Backtrace:
  WineSwapchainCallbacks::InitializeForHWND(void*, DXGI_SWAP_CHAIN_DESC1 const*, D3D12_RESOURCE_DESC&) +51
The GPU process has crashed 1 time(s)
The GPU process has crashed 2 time(s)
The GPU process has crashed 3 time(s)

after the third crash chromium stops trying and falls back to software drawing, which still runs in the second process and still cannot reach the window. an rpg maker game then reports Your browser does not support WebGL to a window nobody sees.

what was checked

crossover 26.0, a bottle on the d3dmetal backend, each app started with no extra options.

appstockfixed
rpg maker mz game (nw.js)empty window, gpu process crashed 3 timesdraws, no gpu process
vortex 2.6.3 (electron)empty window, gpu process crashed 3 timesdraws, no gpu process
edge 155empty window, gpu process crashed 3 timesdraws, webgl works, no gpu process

the fix

chromium has a switch for this, --in-process-gpu: the gpu work runs on a thread of the process that owns the window. steam passes it to its own chromium under wine. every other app would need it added by hand, in a place that differs per app.

so the switch is added where every windows program gets its command line: wine's ntdll, before any windows code runs. a wrapper replaces the unix side of ntdll.so, re-exports the real one, and when a chromium main process starts, appends the switches to its command line.

ntdll_chromium.c
// no --type= switch: a main process, not one of chromium's children
// icudtl.dat next to the program: chromium ships its data under that name
if (!contains(line, chars, "--type=") && is_chromium(dir))
    append(cmd, " --in-process-gpu --no-sandbox");

--no-sandbox goes with it. chromium's sandbox does not start its page processes under wine: edge showed its toolbar and no page until the sandbox was off.

what changes on disk

limits