Fixes a testbot crash.
From: Alex Henrie alexhenrie24@gmail.com
Fixes a testbot crash. --- dlls/opengl32/tests/opengl.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 42c2626a2c2..f906eb0e6d9 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -55,6 +55,15 @@ static void (WINAPI *pglDebugMessageInsertARB)(GLenum, GLenum, GLuint, GLenum, G
static const char* wgl_extensions = NULL;
+static BOOL is_wine; + +static enum +{ + UNKNOWN, + NVIDIA, +} +vendor; + static void init_functions(void) { #define GET_PROC(func) \ @@ -1907,9 +1916,16 @@ static void test_copy_context(HDC hdc) ctx2 = wglCreateContext(hdc); ok(!!ctx2, "Failed to create GL context, last error %#lx.\n", GetLastError());
- ret = wglCopyContext(ctx, ctx2, GL_ALL_ATTRIB_BITS); - todo_wine - ok(ret, "Failed to copy GL context, last error %#lx.\n", GetLastError()); + if (vendor == NVIDIA && !is_wine) + { + win_skip("Avoiding a crash with Nvidia drivers on Windows.\n"); + } + else + { + ret = wglCopyContext(ctx, ctx2, GL_ALL_ATTRIB_BITS); + todo_wine + ok(ret, "Failed to copy GL context, last error %#lx.\n", GetLastError()); + }
ret = wglDeleteContext(ctx2); ok(ret, "Failed to delete GL context, last error %#lx.\n", GetLastError()); @@ -1971,6 +1987,8 @@ START_TEST(opengl) res = SetPixelFormat(hdc, iPixelFormat, &pfd); ok(res, "SetPixelformat failed: %lx\n", GetLastError());
+ is_wine = (strcmp(winetest_platform, "wine") == 0); + test_bitmap_rendering( TRUE ); test_bitmap_rendering( FALSE ); test_minimized(); @@ -1988,6 +2006,8 @@ START_TEST(opengl) trace("OpenGL renderer: %s\n", glGetString(GL_RENDERER)); trace("OpenGL driver version: %s\n", glGetString(GL_VERSION)); trace("OpenGL vendor: %s\n", glGetString(GL_VENDOR)); + if(strcmp((char*)glGetString(GL_VENDOR), "NVIDIA Corporation") == 0) + vendor = NVIDIA; } else {
Zhiyi Zhang (@zhiyi) commented about dlls/opengl32/tests/opengl.c:
ctx2 = wglCreateContext(hdc); ok(!!ctx2, "Failed to create GL context, last error %#lx.\n", GetLastError());
- ret = wglCopyContext(ctx, ctx2, GL_ALL_ATTRIB_BITS);
- todo_wine
- ok(ret, "Failed to copy GL context, last error %#lx.\n", GetLastError());
- if (vendor == NVIDIA && !is_wine)
I don't think we will need to check vendors often in this test. So I would prefer this condition to be (!strcmp((char *)glGetString(GL_VENDOR), "NVIDIA Corporation") && strcmp(winetest_platform, "wine")). This way you don't need to add an enum type and only change test_copy_context().
You can also add a Wine-Bug link to bug 54103.
Otherwise, this looks good to me. Thanks for looking into this.
On Wed Feb 1 07:38:40 2023 +0000, Zhiyi Zhang wrote:
I don't think we will need to check vendors often in this test. So I would prefer this condition to be (!strcmp((char *)glGetString(GL_VENDOR), "NVIDIA Corporation") && strcmp(winetest_platform, "wine")). This way you don't need to add an enum type and only change test_copy_context(). You can also add a Wine-Bug link to bug 54103. Otherwise, this looks good to me. Thanks for looking into this.
There is also bug 51311 on AMD.