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 <hdc> 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
This commit is contained in:
Luca Bacci 2024-09-04 17:21:12 +02:00
parent 84d2961a91
commit b2394691cc

View File

@ -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);
}