[gtk/fix-picking-with-transforms: 1/2] inspector: Use new get_egl_display apis
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-picking-with-transforms: 1/2] inspector: Use new get_egl_display apis
- Date: Thu, 13 May 2021 00:57:09 +0000 (UTC)
commit a95bfd79b6d8ca54c7a937e64d2626e5b9a05ef4
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 12 15:57:33 2021 -0400
inspector: Use new get_egl_display apis
This makes the code a bit more concise.
gtk/inspector/general.c | 151 ++++++++++++++----------------------------------
1 file changed, 42 insertions(+), 109 deletions(-)
---
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index e8c1b08eda..2ff37c4acb 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -247,7 +247,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen,
}
#endif
-#if defined(GDK_WINDOWING_WAYLAND) || defined (GDK_WINDOWING_X11)
+#if defined(GDK_WINDOWING_WAYLAND) || defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32)
static void
append_egl_extension_row (GtkInspectorGeneral *gen,
EGLDisplay dpy,
@@ -255,62 +255,34 @@ append_egl_extension_row (GtkInspectorGeneral *gen,
{
add_check_row (gen, GTK_LIST_BOX (gen->gl_box), ext, epoxy_has_egl_extension (dpy, ext), 0);
}
+#endif
static EGLDisplay
get_egl_display (GdkDisplay *display)
{
- void *native;
- GLenum platform;
- EGLDisplay dpy = NULL;
-
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (display))
- {
- native = gdk_wayland_display_get_wl_display (display);
- platform = EGL_PLATFORM_WAYLAND_EXT;
- }
+ return gdk_wayland_display_get_egl_display (display);
else
#endif
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
- {
- native = gdk_x11_display_get_xdisplay (display);
- platform = EGL_PLATFORM_X11_EXT;
- }
+ return gdk_x11_display_get_egl_display (display);
+ else
+#endif
+#ifdef GDK_WINDOWING_WIN32
+ if (GDK_IS_WIN32_DISPLAY (display))
+ return gdk_win32_display_get_egl_display (display);
else
#endif
return NULL;
-
- if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
- {
- PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
- (void *) eglGetProcAddress ("eglGetPlatformDisplay");
-
- if (getPlatformDisplay)
- dpy = getPlatformDisplay (platform, native, NULL);
- if (dpy)
- return dpy;
- }
-
- if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
- {
- PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
- (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
-
- if (getPlatformDisplay)
- dpy = getPlatformDisplay (platform, native, NULL);
- if (dpy)
- return dpy;
- }
-
- return eglGetDisplay ((EGLNativeDisplayType)native);
}
-#endif
-
static void
init_gl (GtkInspectorGeneral *gen)
{
+ EGLDisplay egl_display;
+
if (gdk_display_get_debug_flags (gen->display) & GDK_DEBUG_GL_DISABLE)
{
gtk_label_set_text (GTK_LABEL (gen->gl_version), C_("GL version", "Disabled"));
@@ -318,85 +290,46 @@ init_gl (GtkInspectorGeneral *gen)
return;
}
-#ifdef GDK_WINDOWING_X11
- if (GDK_IS_X11_DISPLAY (gen->display))
+ egl_display = get_egl_display (gen->display);
+ if (egl_display)
{
- if (gdk_display_get_debug_flags (gen->display) & GDK_DEBUG_GL_GLX)
- {
- Display *dpy = GDK_DISPLAY_XDISPLAY (gen->display);
- int error_base, event_base;
- char *version;
-
- if (!glXQueryExtension (dpy, &error_base, &event_base))
- return;
-
- version = g_strconcat ("GLX ", glXGetClientString (dpy, GLX_VERSION), NULL);
- gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
- g_free (version);
- gtk_label_set_text (GTK_LABEL (gen->gl_vendor), glXGetClientString (dpy, GLX_VENDOR));
-
- append_glx_extension_row (gen, dpy, "GLX_ARB_create_context_profile");
- append_glx_extension_row (gen, dpy, "GLX_SGI_swap_control");
- append_glx_extension_row (gen, dpy, "GLX_EXT_texture_from_pixmap");
- append_glx_extension_row (gen, dpy, "GLX_SGI_video_sync");
- append_glx_extension_row (gen, dpy, "GLX_EXT_buffer_age");
- append_glx_extension_row (gen, dpy, "GLX_OML_sync_control");
- append_glx_extension_row (gen, dpy, "GLX_ARB_multisample");
- append_glx_extension_row (gen, dpy, "GLX_EXT_visual_rating");
- }
- else
- {
- EGLDisplay dpy;
- EGLint major, minor;
- char *version;
-
- dpy = get_egl_display (gen->display);
-
- if (!eglInitialize (dpy, &major, &minor))
- {
- gtk_label_set_text (GTK_LABEL (gen->gl_version), C_("GL version", "None"));
- gtk_label_set_text (GTK_LABEL (gen->gl_vendor), C_("GL vendor", "None"));
- return;
- }
-
- version = g_strconcat ("EGL ", eglQueryString (dpy, EGL_VERSION), NULL);
- gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
- g_free (version);
- gtk_label_set_text (GTK_LABEL (gen->gl_vendor), eglQueryString (dpy, EGL_VENDOR));
-
- append_egl_extension_row (gen, dpy, "EGL_KHR_create_context");
- append_egl_extension_row (gen, dpy, "EGL_EXT_buffer_age");
- append_egl_extension_row (gen, dpy, "EGL_EXT_swap_buffers_with_damage");
- append_egl_extension_row (gen, dpy, "EGL_KHR_surfaceless_context");
- }
+ char *version;
+
+ version = g_strconcat ("EGL ", eglQueryString (egl_display, EGL_VERSION), NULL);
+ gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
+ g_free (version);
+
+ gtk_label_set_text (GTK_LABEL (gen->gl_vendor), eglQueryString (egl_display, EGL_VENDOR));
+
+ append_egl_extension_row (gen, egl_display, "EGL_KHR_create_context");
+ append_egl_extension_row (gen, egl_display, "EGL_EXT_buffer_age");
+ append_egl_extension_row (gen, egl_display, "EGL_EXT_swap_buffers_with_damage");
+ append_egl_extension_row (gen, egl_display, "EGL_KHR_surfaceless_context");
}
else
-#endif
-#ifdef GDK_WINDOWING_WAYLAND
- if (GDK_IS_WAYLAND_DISPLAY (gen->display))
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gen->display))
{
- EGLDisplay dpy;
- EGLint major, minor;
+ Display *dpy = GDK_DISPLAY_XDISPLAY (gen->display);
+ int error_base, event_base;
char *version;
- dpy = get_egl_display (gen->display);
+ if (!glXQueryExtension (dpy, &error_base, &event_base))
+ return;
- if (!eglInitialize (dpy, &major, &minor))
- {
- gtk_label_set_text (GTK_LABEL (gen->gl_version), C_("GL version", "None"));
- gtk_label_set_text (GTK_LABEL (gen->gl_vendor), C_("GL vendor", "None"));
- return;
- }
-
- version = g_strconcat ("EGL ", eglQueryString (dpy, EGL_VERSION), NULL);
+ version = g_strconcat ("GLX ", glXGetClientString (dpy, GLX_VERSION), NULL);
gtk_label_set_text (GTK_LABEL (gen->gl_version), version);
g_free (version);
- gtk_label_set_text (GTK_LABEL (gen->gl_vendor), eglQueryString (dpy, EGL_VENDOR));
-
- append_egl_extension_row (gen, dpy, "EGL_KHR_create_context");
- append_egl_extension_row (gen, dpy, "EGL_EXT_buffer_age");
- append_egl_extension_row (gen, dpy, "EGL_EXT_swap_buffers_with_damage");
- append_egl_extension_row (gen, dpy, "EGL_KHR_surfaceless_context");
+ gtk_label_set_text (GTK_LABEL (gen->gl_vendor), glXGetClientString (dpy, GLX_VENDOR));
+
+ append_glx_extension_row (gen, dpy, "GLX_ARB_create_context_profile");
+ append_glx_extension_row (gen, dpy, "GLX_SGI_swap_control");
+ append_glx_extension_row (gen, dpy, "GLX_EXT_texture_from_pixmap");
+ append_glx_extension_row (gen, dpy, "GLX_SGI_video_sync");
+ append_glx_extension_row (gen, dpy, "GLX_EXT_buffer_age");
+ append_glx_extension_row (gen, dpy, "GLX_OML_sync_control");
+ append_glx_extension_row (gen, dpy, "GLX_ARB_multisample");
+ append_glx_extension_row (gen, dpy, "GLX_EXT_visual_rating");
}
else
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]