Merge branch 'win32-check-shader-support' into 'master'

GDK-Win32: Reject GL context if shaders aren't supported (fix issue #4165)

Closes #4165

See merge request GNOME/gtk!3850
This commit is contained in:
Matthias Clasen 2021-08-18 12:19:57 +00:00
commit 5707b80a69
2 changed files with 20 additions and 1 deletions

View File

@ -277,7 +277,7 @@ gdk_win32_display_init_egl (GdkDisplay *display,
display_win32->egl_disp = egl_disp;
display_win32->egl_version = epoxy_egl_version (egl_disp);
eglBindAPI(EGL_OPENGL_ES_API);
eglBindAPI (EGL_OPENGL_ES_API);
display_win32->hasEglSurfacelessContext =
epoxy_has_egl_extension (egl_disp, "EGL_KHR_surfaceless_context");

View File

@ -278,6 +278,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
if (best_idx == 0 ||
!wglMakeCurrent (hdc, display_win32->dummy_context_wgl.hglrc))
{
if (display_win32->dummy_context_wgl.hglrc != NULL)
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL implementation is available"));
@ -288,6 +291,22 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
display_win32->wgl_pixel_format = best_idx;
display_win32->gl_version = epoxy_gl_version ();
/* We must have OpenGL/WGL 2.0 or later, or have the GL_ARB_shader_objects extension */
if (display_win32->gl_version < 20)
{
if (!epoxy_has_gl_extension ("GL_ARB_shader_objects"))
{
wglMakeCurrent (NULL, NULL);
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL implementation is available"));
return FALSE;
}
}
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =