wined3d relies on `WGL_WINE_query_renderer` to get information about current render. The issue is that EGL driver does not implement this extension, which often leads to troubles for wined3d in trying to apply their quirks based only on a `GL_RENDERER` string. Because VRAM size becomes unknown, wined3d refuses to render due to "lack of memory". This MR solves the issue by implementing `WGL_WINE_query_renderer` for EGL driver.
In EGL there's no extension like `GLX_MESA_query_renderer`, so we have to implement it ourselves.
Some caveats of this implementation:
- Obtaining some attributes involves context switching for direct quries to OpenGL driver. I tried to avoid risk of situation where we might lose current driver context, and from my tests it works, but maybe I’m missing something.
- Getting vendor and device PCI IDs is done through DRM, which is a bit tricky at the moment as we have to go through devfs. This can be made cleaner through libdrm, but I don’t think we should introduce a new dependency just for a few attributes.
- The `GL_NVX_gpu_memory_info` extension is used for VRAM size. It is quite common but not supported everywhere, unfortunately there is no simpler way to get information about VRAM.
- There is no API for `WGL_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_WINE`. Same as for winemac.drv, but it’s not a big problem since it doesn’t seem to be used now.
Some advantages:
- Unlike GLX, we are not tied to Mesa specific extensions, which allows it to work for NVIDIA as well, sparing wined3d from having to guess something based only on the GPU name.
- Unlike the same GLX, we can actually query multiple devices. Although `GLX_MESA_query_renderer` also proclaims this, in fact Mesa does not implement anything other than queries to the current renderer: https://gitlab.freedesktop.org/mesa/mesa/-/blob/32a10ccbdd1e6750c84aac3393dc...
Hope I didn’t miss anything.
Signed-off-by: Vasiliy Stelmachenok ventureo@cachyos.org
-- v3: win32u: Advertise WGL_WINE_query_renderer extension win32u: Add wglQueryRendererStringWINE implementation for EGL driver win32u: Add wglQueryRendererIntegerWINE implementation for EGL driver win32u: Add wglQueryCurrentRendererStringWINE implementation for EGL driver win32u: Add wglQueryCurrentRendererIntegerWINE implementation for EGL driver