From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/opengl.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 3d583a170e7..908101d2cc8 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -735,7 +735,7 @@ static UINT x11drv_init_pixel_formats( UINT *onscreen_count ) { struct glx_pixel_format *list; int size = 0, onscreen_size = 0; - int fmt_id, nCfgs, i, run, bmp_formats; + int fmt_id, nCfgs, i, run; GLXFBConfig* cfgs; XVisualInfo *visinfo;
@@ -746,21 +746,7 @@ static UINT x11drv_init_pixel_formats( UINT *onscreen_count ) return 0; }
- /* Bitmap rendering on Windows implies the use of the Microsoft GDI software renderer. - * Further most GLX drivers only offer pixmap rendering using indirect rendering (except for modern drivers which support 'AIGLX' / composite). - * Indirect rendering can indicate software rendering (on Nvidia it is hw accelerated) - * Since bitmap rendering implies the use of software rendering we can safely use indirect rendering for bitmaps. - * - * Below we count the number of formats which are suitable for bitmap rendering. Windows restricts bitmap rendering to single buffered formats. - */ - for(i=0, bmp_formats=0; i<nCfgs; i++) - { - if(check_fbconfig_bitmap_capability(gdi_display, cfgs[i])) - bmp_formats++; - } - TRACE("Found %d bitmap capable fbconfigs\n", bmp_formats); - - list = calloc( 1, (nCfgs + bmp_formats) * sizeof(*list) ); + list = calloc( 1, (nCfgs * 2) * sizeof(*list) );
/* Fill the pixel format list. Put onscreen formats at the top and offscreen ones at the bottom. * Do this as GLX doesn't guarantee that the list is sorted */ @@ -828,7 +814,8 @@ static UINT x11drv_init_pixel_formats( UINT *onscreen_count ) list[size].fbconfig = cfgs[i]; list[size].fmt_id = fmt_id; list[size].render_type = get_render_type_from_fbconfig(gdi_display, cfgs[i]); - list[size].dwFlags = 0; + if (!check_fbconfig_bitmap_capability( gdi_display, cfgs[i] )) list[size].dwFlags = 0; + else list[size].dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI | PFD_GENERIC_FORMAT; size++; } else if (visinfo) XFree(visinfo);
From: Rémi Bernon rbernon@codeweavers.com
Some onscreen llvmpipe formats have inconsistent 32 vs 24 bpp, we should make sure they aren't used for bitmap rendering. --- dlls/winex11.drv/opengl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 908101d2cc8..4881e504d9e 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -720,10 +720,14 @@ static int get_render_type_from_fbconfig(Display *display, GLXFBConfig fbconfig) }
/* Check whether a fbconfig is suitable for Windows-style bitmap rendering */ -static BOOL check_fbconfig_bitmap_capability(Display *display, GLXFBConfig fbconfig) +static BOOL check_fbconfig_bitmap_capability( GLXFBConfig fbconfig, const XVisualInfo *vis ) { int dbuf, value; - pglXGetFBConfigAttrib(display, fbconfig, GLX_DOUBLEBUFFER, &dbuf); + + pglXGetFBConfigAttrib( gdi_display, fbconfig, GLX_BUFFER_SIZE, &value ); + if (vis && value != vis->depth) return FALSE; + + pglXGetFBConfigAttrib( gdi_display, fbconfig, GLX_DOUBLEBUFFER, &dbuf ); pglXGetFBConfigAttrib(gdi_display, fbconfig, GLX_DRAWABLE_TYPE, &value);
/* Windows only supports bitmap rendering on single buffered formats, further the fbconfig needs to have @@ -783,7 +787,7 @@ static UINT x11drv_init_pixel_formats( UINT *onscreen_count ) onscreen_size++;
/* Clone a format if it is bitmap capable for indirect rendering to bitmaps */ - if(check_fbconfig_bitmap_capability(gdi_display, cfgs[i])) + if (check_fbconfig_bitmap_capability( cfgs[i], visinfo )) { TRACE("Found bitmap capable format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", fmt_id, size+1, i); list[size].fbconfig = cfgs[i]; @@ -814,7 +818,7 @@ static UINT x11drv_init_pixel_formats( UINT *onscreen_count ) list[size].fbconfig = cfgs[i]; list[size].fmt_id = fmt_id; list[size].render_type = get_render_type_from_fbconfig(gdi_display, cfgs[i]); - if (!check_fbconfig_bitmap_capability( gdi_display, cfgs[i] )) list[size].dwFlags = 0; + if (!check_fbconfig_bitmap_capability( cfgs[i], NULL )) list[size].dwFlags = 0; else list[size].dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI | PFD_GENERIC_FORMAT; size++; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/wgl.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 7de0d1b1dba..e24327af15b 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -29,6 +29,7 @@ #include "winbase.h" #include "winreg.h" #include "ntuser.h" +#include "ntgdi.h" #include "malloc.h"
#include "unixlib.h" @@ -314,6 +315,7 @@ static struct wgl_pixel_format *get_pixel_formats( HDC hdc, UINT *num_formats, struct get_pixel_formats_params args = { .teb = NtCurrentTeb(), .hdc = hdc }; PVOID *glReserved = NtCurrentTeb()->glReserved1; NTSTATUS status; + DWORD is_memdc;
if (glReserved[WINE_GL_RESERVED_FORMATS_HDC] == hdc) { @@ -329,6 +331,9 @@ static struct wgl_pixel_format *get_pixel_formats( HDC hdc, UINT *num_formats, args.max_formats = args.num_formats; if ((status = UNIX_CALL( get_pixel_formats, &args ))) goto error;
+ if (NtGdiGetDCDword( hdc, NtGdiIsMemDC, &is_memdc ) && is_memdc) + args.num_onscreen_formats = args.num_formats; + *num_formats = args.num_formats; *num_onscreen_formats = args.num_onscreen_formats;
From: Rémi Bernon rbernon@codeweavers.com
The llvmpipe formats with 8 alpha bits are all "onscreen" and have bogus inconsistent depth between their config and visual which cause BadMatch errors when flushing, including with PBuffers. Offscreen formats have only 2 alpha bits, so relax the tests so they work on the CI. --- dlls/opengl32/tests/opengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 4443945c8c6..10d4e9a491f 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -1539,7 +1539,7 @@ static void test_bitmap_rendering( BOOL use_dib ) ok( ret == count, "got %d\n", ret );
if ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) && (pfd.dwFlags & PFD_SUPPORT_OPENGL) && - pfd.cColorBits == bpp && pfd.cAlphaBits == 8) + pfd.cColorBits == bpp && pfd.cAlphaBits > 0) { ret = SetPixelFormat( hdc, i, &pfd ); if (pixel_format) ok( !ret, "SetPixelFormat succeeded\n" ); @@ -1825,7 +1825,7 @@ static void test_d3dkmt_rendering(void) ok( ret == count, "got %d\n", ret );
if ((pfd.dwFlags & PFD_DRAW_TO_BITMAP) && (pfd.dwFlags & PFD_SUPPORT_OPENGL) && - pfd.cColorBits == 32 && pfd.cAlphaBits == 8) + pfd.cColorBits == 32 && pfd.cAlphaBits > 0) { ret = SetPixelFormat( desc.hDc, i, &pfd ); if (pixel_format) ok( !ret, "SetPixelFormat succeeded\n" );