win32: Always try WGL_SUPPORT_GDI_ARB
We can avoid a quirk here by always trying WGL_SUPPORT_GDI_ARB first and falling back when it's not supported.
This commit is contained in:
@@ -214,7 +214,6 @@ struct _GdkWin32Display
|
||||
guint hasGlWINSwapHint : 1;
|
||||
|
||||
struct wgl_quirks {
|
||||
guint force_gdi_compatibility : 1;
|
||||
guint disallow_swap_exchange : 1;
|
||||
} *wgl_quirks;
|
||||
|
||||
|
@@ -367,11 +367,10 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
attribs_add_static_array (&attribs, attribs_base);
|
||||
|
||||
if (display_win32->wgl_quirks->force_gdi_compatibility)
|
||||
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
|
||||
|
||||
attribs_commit (&attribs);
|
||||
|
||||
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
|
||||
|
||||
attribs_add_static_array (&attribs, attribs_ancillary_buffers);
|
||||
|
||||
do
|
||||
@@ -450,13 +449,16 @@ get_distance (PIXELFORMATDESCRIPTOR *pfd,
|
||||
int is_double_buffered = (pfd->dwFlags & PFD_DOUBLEBUFFER) != 0;
|
||||
int is_swap_defined = (pfd->dwFlags & swap_flags) != 0;
|
||||
int is_mono = (pfd->dwFlags & PFD_STEREO) == 0;
|
||||
int is_transparent = (pfd->dwFlags & PFD_SUPPORT_GDI) != 0;
|
||||
int ancillary_bits = pfd->cStencilBits + pfd->cDepthBits + pfd->cAccumBits;
|
||||
|
||||
int opacity_distance = !is_transparent * 5000;
|
||||
int quality_distance = !is_double_buffered * 1000;
|
||||
int performance_distance = !is_swap_defined * 200;
|
||||
int memory_distance = !is_mono + ancillary_bits;
|
||||
|
||||
return quality_distance +
|
||||
return opacity_distance +
|
||||
quality_distance +
|
||||
performance_distance +
|
||||
memory_distance;
|
||||
}
|
||||
@@ -477,8 +479,7 @@ choose_pixel_format_opengl32 (GdkWin32Display *display_win32,
|
||||
const DWORD skip_flags = PFD_GENERIC_FORMAT |
|
||||
PFD_GENERIC_ACCELERATED;
|
||||
const DWORD required_flags = PFD_DRAW_TO_WINDOW |
|
||||
PFD_SUPPORT_OPENGL |
|
||||
(display_win32->wgl_quirks->force_gdi_compatibility ? PFD_SUPPORT_GDI : 0);
|
||||
PFD_SUPPORT_OPENGL;
|
||||
const DWORD best_swap_flags = PFD_SWAP_COPY |
|
||||
(display_win32->wgl_quirks->disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
|
||||
|
||||
@@ -619,18 +620,6 @@ create_dummy_gl_window (void)
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
static bool
|
||||
check_driver_is_d3d12 (void)
|
||||
{
|
||||
const char *vendor = (const char *) glGetString (GL_VENDOR);
|
||||
const char *renderer = (const char *) glGetString (GL_RENDERER);
|
||||
|
||||
return vendor != NULL &&
|
||||
g_ascii_strncasecmp (vendor, "MICROSOFT", strlen ("MICROSOFT")) == 0 &&
|
||||
renderer != NULL &&
|
||||
g_ascii_strncasecmp (renderer, "D3D12", strlen ("D3D12")) == 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
check_vendor_is_nvidia (void)
|
||||
{
|
||||
@@ -694,7 +683,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
display_win32->hasGlWINSwapHint =
|
||||
epoxy_has_gl_extension ("GL_WIN_swap_hint");
|
||||
|
||||
display_win32->wgl_quirks->force_gdi_compatibility = check_driver_is_d3d12 ();
|
||||
display_win32->wgl_quirks->disallow_swap_exchange = check_vendor_is_nvidia ();
|
||||
|
||||
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
|
||||
@@ -714,7 +702,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
GDK_NOTE (OPENGL, g_print ("WGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Renderer: %s\n"
|
||||
" - Quirks / force GDI compatiblity: %s\n"
|
||||
" - Quirks / disallow swap exchange: %s\n"
|
||||
" - Checked extensions:\n"
|
||||
"\t* WGL_ARB_pixel_format: %s\n"
|
||||
@@ -725,7 +712,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
major, minor,
|
||||
glGetString (GL_VENDOR),
|
||||
glGetString (GL_RENDERER),
|
||||
display_win32->wgl_quirks->force_gdi_compatibility ? "enabled" : "disabled",
|
||||
display_win32->wgl_quirks->disallow_swap_exchange ? "enabled" : "disabled",
|
||||
display_win32->hasWglARBPixelFormat ? "yes" : "no",
|
||||
display_win32->hasWglARBCreateContext ? "yes" : "no",
|
||||
|
Reference in New Issue
Block a user