gdk: Add GDK_DEBUG=nogl

This is mostly useful for fallback testing.

I suppose if people want finer grained GL ability testing, they can use
Mesa environment variables to tune things.
This commit is contained in:
Benjamin Otte 2014-10-16 03:13:45 +02:00
parent 8a7bd5cc00
commit 672a67d0af
4 changed files with 15 additions and 1 deletions

View File

@ -399,6 +399,10 @@ nevertheless.
<term>misc</term>
<listitem><para>Miscellaneous information</para></listitem>
</varlistentry>
<varlistentry>
<term>nogl</term>
<listitem><para>Turn off OpenGL. GDK will behave as if OpenGL support was not available.</para></listitem>
</varlistentry>
<varlistentry>
<term>nograbs</term>
<listitem><para>Turn off all pointer and keyboard grabs</para></listitem>

View File

@ -149,6 +149,7 @@ static const GDebugKey gdk_debug_keys[] = {
{"eventloop", GDK_DEBUG_EVENTLOOP},
{"frames", GDK_DEBUG_FRAMES},
{"settings", GDK_DEBUG_SETTINGS},
{"nogl", GDK_DEBUG_NOGL},
{"opengl", GDK_DEBUG_OPENGL},
};

View File

@ -85,7 +85,8 @@ typedef enum {
GDK_DEBUG_EVENTLOOP = 1 << 10,
GDK_DEBUG_FRAMES = 1 << 11,
GDK_DEBUG_SETTINGS = 1 << 12,
GDK_DEBUG_OPENGL = 1 << 13
GDK_DEBUG_NOGL = 1 << 13,
GDK_DEBUG_OPENGL = 1 << 14
} GdkDebugFlag;
typedef enum {

View File

@ -2722,6 +2722,14 @@ gdk_window_ref_impl_surface (GdkWindow *window)
GdkGLContext *
gdk_window_get_paint_gl_context (GdkWindow *window, GError **error)
{
if (_gdk_debug_flags & GDK_DEBUG_NOGL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("GL support disabled via GDK_DEBUG"));
return NULL;
}
if (window->impl_window->gl_paint_context == NULL)
window->impl_window->gl_paint_context =
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window,