OSMesa Gallium frontend using 16-bit packed pixel format with inappropriate color channel spec for WGL
- Wine/Proton version: 6.12 (git mainline head)
Describe the issue
In resolving #5094, it exposed the pixel format in use by OSMesa is an inappropriate match for 16-bit WGL pixel formats. The 5-6-5 packing is correct, however the color channels are ... reversed. In doing analysis on screenshots of the game, converting the on-screen colors back to 5-6-5, then swapping the red / blue channel results in the proper 16bit color from the GL graphics context. Of course, the mostly green pixels being rasterized by mesa look mostly correct -- :-)
The issue, is that WINE is making use of the 5-6-5 packing mode exposed by OSMesa, but that mode is using a pixel format which has the wrong color channel spec for a Windows Device Independent Bitmap. (WGL expects BGR, not RGB).
Screenshot of Civilization 3 (https://bugs.winehq.org/show_bug.cgi?id=41930) with proposed fix for #5094 applied:
Note the coloration of the GL 'diamond' around the settler unit in the center of the screen. This is supposed to be a greenish-blue diamond alpha-blended atop the pixels from the user-supplied buffer.