TL;DR: it might be an issue with NVIDIA drivers, but there's also an unhandled edge case crash (see backtrace).
I'm still running into the same issue as before with a very simple SDL+OpenGL [test program](https://raw.githubusercontent.com/whrvt/sdlgpu_gears/772a34296ff64c3b75f07f9...).
The chain reaction seems to start from [`get_window_unused_drawable`](https://gitlab.winehq.org/rbernon/wine/-/blob/cf83ab2ab915605e6bbea32082fa46...). I think the call stack goes like: ``` context_sync_drawables() -> new_draw = get_updated_drawable() -> get_window_unused_drawable() -> driver_funcs->p_surface_create() -> x11drv_egl_surface_create() -> gl->base.surface = funcs->p_eglCreateWindowSurface() == NULL ```
The final `eglCreateWindowSurface` call seems to always return NULL, with an `EGL_BAD_CONFIG` error, for any format that has alpha (i.e. format ids 1 through 20 in my log).
If I just hardcode a format without alpha (e.g. 21) in the failing `eglCreateWindowSurface` call, like so:
``` if (!(gl->base.surface = funcs->p_eglCreateWindowSurface( egl->display, egl_config_for_format( 21 ), (void *)window, NULL ))) ```
the surface creation actually succeeds. Obviously, this fails later along the line when the surface is expected to have an alpha channel, but isn't.
I'll also attach a brief log that shows this happening with `WINEDEBUG=opengl,wgl,wined3d` here:
[eglgears.log](/uploads/a2a6c0ea93cdf0fb046fc9dbe8a3986c/eglgears.log) [gdb-segfault.txt](/uploads/4a08f2d8be0e419b95c91f04692e27d1/gdb-segfault.txt)
We segfault on `opengl_drawable_add_ref(NULL)` here: ``` else if (draw_hdc && draw_hdc == read_hdc) opengl_drawable_add_ref( (new_read = new_draw) ); ``` because the `new_draw` we got from `get_updated_drawable` was NULL.