mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
On NVIDIA (RTX 2070 SUPER, driver 615.78, Xwayland) the game showed a black screen and logged "Metal Device timed out giving us a Drawable to present" every second (#3). X11Window picked its visual with glXChooseVisual, which on NVIDIA returns a GLX-only visual (0x304 here). NVIDIA's EGL configs only map to the default visual (0x69) and the 32-bit one (0x99), so CGLGetWindow's eglCreateWindowSurface failed with EGL_BAD_CONFIG for the window and its subwindows, for every one of the 40 window configs. CGLGetWindow returns NULL without logging, CALayerContext keeps _cglWindow == NULL, -render returns before prepareMetalLayers, and CAMetalLayer never gets its three drawables back. Mesa accepts the GLX visual, which is why AMD works. Use the default visual when it is TrueColor with depth >= 24, falling back to glXChooseVisual otherwise. This also fixes every other Darling window on NVIDIA: plain AppKit windows (title bars included), layer-backed views and NSOpenGLView were all black without it.