Skip to content

Fix static glapi on Windows

Jesse Natalie requested to merge jenatali/mesa:fix-windows-static-glapi into main

On Linux, the static glapi path sees libGL.so implementing the static glapi, and the drivers (libgallium_dri.so) updating/reading the TLS vars.

On Windows, to allow libgallium_wgl.dll to be a full ICD, it's responsible for implementing the actual static glapi. However, before this change, OpenGL32.dll was also implementing the static glapi, meaning that GL API calls from OpenGL32.dll didn't route to the driver correctly because the TLS vars were never actually set - the driver set its copy, and OpenGL32.dll read its own copy.

Now, always build a bridge and static version of glapi when not using shared. The bridge version is linked into OpenGL32.dll, and the static version is linked into the driver on Windows. GLES only builds with shared glapi - but after this, shared glapi is not really needed on Windows for GLES, since the driver has all of the data.

Fixes: f36921ef ("wgl: Refactor drivers to a libgallium_wgl.dll") Closes: #6560 (closed)

/cc @pal1000 - looks like you called it out in Mesa 21.3 release notes ("Always build Mesa3D 21.3+ with shared glapi as static glapi is no longer supported") but that wasn't my intention. Not sure if you had filed an issue for it.

Merge request reports