[gtk+] gdk_x11_display_make_gl_context_current: move some code
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk_x11_display_make_gl_context_current: move some code
- Date: Thu, 30 Oct 2014 20:05:25 +0000 (UTC)
commit 869f300f0aefcff3b0302a9e4b7297e54f08c1dd
Author: Alexander Larsson <alexl redhat com>
Date: Thu Oct 30 16:04:28 2014 +0100
gdk_x11_display_make_gl_context_current: move some code
This moves the code related to the frame sync code into
the is_attached check, which means we don't have to ever
run this when making non-window-paint contexts current.
This is a minior speed thing, but the main advantage
is that it makes making a non-paint context current
threadsafe.
gdk/x11/gdkglcontext-x11.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 9c2d9a9..4315bfd 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -1152,17 +1152,6 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
context_x11 = GDK_X11_GL_CONTEXT (context);
- window = gdk_gl_context_get_window (context);
-
- // If the WM is compositing there is no particular need to delay
- // the swap when drawing on the offscreen, rendering to the screen
- // happens later anyway, and its up to the compositor to sync that
- // to the vblank.
- screen = gdk_window_get_screen (window);
- do_frame_sync = ! gdk_screen_is_composited (screen);
-
- context_x11->do_frame_sync = do_frame_sync;
-
GDK_NOTE (OPENGL,
g_print ("Making GLX context current to drawable %lu\n",
(unsigned long) context_x11->drawable));
@@ -1177,6 +1166,17 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
if (context_x11->is_attached && GDK_X11_DISPLAY (display)->has_glx_swap_interval)
{
+ window = gdk_gl_context_get_window (context);
+
+ /* If the WM is compositing there is no particular need to delay
+ * the swap when drawing on the offscreen, rendering to the screen
+ * happens later anyway, and its up to the compositor to sync that
+ * to the vblank. */
+ screen = gdk_window_get_screen (window);
+ do_frame_sync = ! gdk_screen_is_composited (screen);
+
+ context_x11->do_frame_sync = do_frame_sync;
+
if (context_x11->do_frame_sync)
glXSwapIntervalSGI (1);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]