mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
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.
This commit is contained in:
parent
7a73ec1bb2
commit
869f300f0a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user