From b2394691cc9829cad8ff8f28d296e0cd32f55fb9 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Wed, 4 Sep 2024 17:21:12 +0200 Subject: [PATCH] Inspector: Fix append_wgl_extension_row() wglGetExtensionsStringARB takes an HDC argument even though it checks extensions for the current context. This was done for future extensibility. From [1]: > Should this function take an hdc? It seems like a good idea. At > some point MS may want to incorporate this into OpenGL32. If they > do this and and they want to support more than one ICD, then an HDC > would be needed. Currently the HDC argument is unused, but still wglGetExtensionsStringARB() is required to check if HDC is valid: > If does not indicate a valid device context then the function > fails and the error ERROR_DC_NOT_FOUND is generated. If the function > fails, the return value is NULL. To get extended error information, > call GetLastError. So wglGetExtensionsStringARB fails if we pass NULL. Here we can pass any valid HDC, like for example the screen DC returned by GetDC(NULL), but probably using wglGetCurrentDC() makes most sense. Reference: [1] - https://registry.khronos.org/OpenGL/extensions/ARB/WGL_ARB_extensions_string.txt --- gtk/inspector/general.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 1eb204c85e..1752759150 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -322,7 +322,7 @@ static void append_wgl_extension_row (GtkInspectorGeneral *gen, const char *ext) { - HDC hdc = 0; + HDC hdc = wglGetCurrentDC (); add_check_row (gen, GTK_LIST_BOX (gen->gl_extensions_box), ext, epoxy_has_wgl_extension (hdc, ext), 0); }