mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Win32 GL: Also force not to use depth/stencil/accum bits on legacy contexts
For completeness' sake, also specifiy in the PIXELFORMATDESCRIPTOR to use no depth, stencil and accum bits to initializing WGL when we can't (yet) use wglChoosePixelFormatARB(), as we must always fist have a base legacy WGL context using ChoosePixelFormat() before we can use that to use wglChoosePixelFormatARB(), or if wglChoosePixelFormatARB() is somehow not available for us. Some drivers, however, enforces enabling depth buffers, so if we can't acquire a pixel format that disables depth buffers, retry acquiring one with that, which sadly is not optimal but we must make do. Attempts to complete fix for issue #6401.
This commit is contained in:
parent
7477e8626d
commit
54a86a2a7e
@ -134,6 +134,7 @@ struct _GdkWin32Display
|
||||
guint hasWglEXTSwapControl : 1;
|
||||
guint hasWglOMLSyncControl : 1;
|
||||
guint hasWglARBPixelFormat : 1;
|
||||
guint force_enable_depth_bits : 1;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
guint hasEglKHRCreateContext : 1;
|
||||
|
@ -142,8 +142,7 @@ get_wgl_pfd (HDC hdc,
|
||||
|
||||
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
||||
|
||||
if (display_win32 != NULL &&
|
||||
display_win32->hasWglARBPixelFormat)
|
||||
if (display_win32->hasWglARBPixelFormat)
|
||||
{
|
||||
UINT num_formats;
|
||||
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
@ -176,15 +175,18 @@ get_wgl_pfd (HDC hdc,
|
||||
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
|
||||
pixelAttribs[i++] = 8;
|
||||
|
||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
|
||||
if (!display_win32->force_enable_depth_bits)
|
||||
{
|
||||
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
|
||||
pixelAttribs[i++] = 0;
|
||||
}
|
||||
|
||||
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
|
||||
|
||||
pixelAttribs[i++] = 0; /* end of pixelAttribs */
|
||||
@ -215,8 +217,20 @@ get_wgl_pfd (HDC hdc,
|
||||
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
|
||||
pfd->cAlphaBits = 8;
|
||||
pfd->iLayerType = PFD_MAIN_PLANE;
|
||||
pfd->cAccumBits = 0;
|
||||
pfd->cStencilBits = 0;
|
||||
|
||||
if (!display_win32->force_enable_depth_bits)
|
||||
pfd->cDepthBits = 0;
|
||||
|
||||
best_pf = ChoosePixelFormat (hdc, pfd);
|
||||
|
||||
/* try again if driver enforces depth buffers */
|
||||
if (best_pf == 0 && !display_win32->force_enable_depth_bits)
|
||||
{
|
||||
display_win32->force_enable_depth_bits = TRUE;
|
||||
get_wgl_pfd (hdc, pfd, display_win32);
|
||||
}
|
||||
}
|
||||
|
||||
return best_pf;
|
||||
@ -234,7 +248,7 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
|
||||
|
||||
memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR));
|
||||
|
||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, NULL);
|
||||
best_idx = get_wgl_pfd (display_win32->dummy_context_wgl.hdc, &pfd, display_win32);
|
||||
|
||||
if (best_idx != 0)
|
||||
set_pixel_format_result = SetPixelFormat (display_win32->dummy_context_wgl.hdc,
|
||||
|
Loading…
Reference in New Issue
Block a user