The check was dropped in e392e0ac2846edc25610723c19d6a796372017e1, leaving the dwFlags variable unused.
I have no idea if it was indeed unnecessary or if it was dropped by mistake but either we need to keep the check, or we should remove the variable.
From: Rémi Bernon rbernon@codeweavers.com
The check was dropped in e392e0ac2846edc25610723c19d6a796372017e1, leaving the dwFlags variable unused. --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 52f363461e4..5179c4e6405 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2633,7 +2633,7 @@ static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, c }
for (i = 0; i < nb_pixel_formats; ++i) - if (pixel_formats[i].fmt_id == fmt_id) + if (pixel_formats[i].fmt_id == fmt_id && (pixel_formats[i].dwFlags & dwFlags) == dwFlags) break;
if (i == nb_pixel_formats)
This ultimately deserves a test, even if out of tree one. I made some ad-hoc one [1] and in confirms (tested on Windows / AMD) that the formats with missing flags do not appear in the list (i. e., the change is correct). It also conforms to spec [2] where flags are listed as exact match criteria.
The only thing here ``` for (i = 0; i < nb_pixel_formats; ++i) - if (pixel_formats[i].fmt_id == fmt_id) + if (pixel_formats[i].fmt_id == fmt_id && (pixel_formats[i].dwFlags & dwFlags) == dwFlags) break; ``` The loop just searches for fmt_id in our format list, it makes no sense to continue searching once format is found, the flag check should probably go after the loop. I don't recall the details now (my patch is from almost 2 years ago) but that's probably how I lost that flags check back then.
1. [test.patch](/uploads/b3ae677c8a7072b069d8dfc779cd8002/test.patch) 2. https://registry.khronos.org/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt
PS the test can probably be included as well? With ```+ WGL_SUPPORT_GDI_ARB, 1,``` part dropped, as limiting the list of formats further will void the testing for depth bits currently performed in the test. It is just that WGL_DRAW_TO_WINDOW_ARB, WGL_SUPPORT_OPENGL_ARB don't limit format list in Wine here so I added it as a sanity check for patch testing.