Rémi Bernon (@rbernon) commented about dlls/win32u/opengl.c:
funcs->p_glReadPixels( 0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, temp_image );
for (int i = 0; i < pixel_count; i++)
bitmap_pixels[i] = blend_8888_pixel_onto_555( temp_image[i], bitmap_pixels[i] );
/* Something difficult to fake about bitmap rendering is that a program can use
* a mix of blitting and OpenGL operations. Civilization 3 and SimGolf depend on
* this. There's no easy way to replicate the direct memory edits on the
* GPU-based pbuffer (since there's no API call), so instead I'm using a
* workaround: Each time after we draw the pbuffer onto the bitmap, we clear the
* pbuffer with transparent. In the end, this gives you the same bitmap as a
* result (unless you call glReadPixels, which will give you pixels from the
* transparent-background pbuffer). */
/* Remember the old clear color (rather inefficient). */
funcs->p_glClear( GL_COLOR_BUFFER_BIT );
funcs->p_glReadPixels( 0, 0, 1, 1, GL_RGBA, GL_FLOAT, clear_color );
I think this could be `funcs->p_glGetFloatv( GL_COLOR_CLEAR_VALUE, clear_color )`?