int width,
int height)
{
- GdkGLContext *paint_context;
+ GdkGLContext *paint_context, *current_context;
cairo_surface_t *image;
cairo_matrix_t matrix;
int dx, dy, window_scale;
int alpha_size = 0;
cairo_region_t *clip_region;
GdkGLContextPaintData *paint_data;
- GLsync sync = NULL;
+ GLsync sync;
impl_window = window->impl_window;
}
clip_region = gdk_cairo_region_from_clip (cr);
+ current_context = gdk_gl_context_get_current ();
- if ((gdk_gl_context_get_current () != NULL) && (gdk_gl_context_get_current () != paint_context))
+ if ((current_context != NULL) && (current_context != paint_context) &&
+ gdk_gl_context_has_sync (current_context))
sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ else
+ sync = NULL;
gdk_gl_context_make_current (paint_context);
guint has_gl_framebuffer_blit : 1;
guint has_frame_terminator : 1;
guint has_unpack_subimage : 1;
+ guint has_sync : 1;
guint extensions_checked : 1;
guint debug_enabled : 1;
guint forward_compatible : 1;
return priv->has_unpack_subimage;
}
+gboolean
+gdk_gl_context_has_sync (GdkGLContext *context)
+{
+ GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+
+ return priv->has_sync;
+}
+
/**
* gdk_gl_context_set_debug_enabled:
* @context: a #GdkGLContext
priv->has_frame_terminator = FALSE;
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
+ priv->has_sync = priv->gl_version >= 30;
}
else
{
priv->has_gl_framebuffer_blit = priv->gl_version >= 30 || epoxy_has_gl_extension ("GL_EXT_framebuffer_blit");
priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator");
priv->has_unpack_subimage = TRUE;
+ priv->has_sync = priv->gl_version >= 32 ||
+ epoxy_has_gl_extension ("GL_ARB_sync") ||
+ epoxy_has_gl_extension ("GL_APPLE_sync");
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
if (priv->gl_version < 32)
gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context);
gboolean gdk_gl_context_has_frame_terminator (GdkGLContext *context);
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
+gboolean gdk_gl_context_has_sync (GdkGLContext *context);
void gdk_gl_context_end_frame (GdkGLContext *context,
cairo_region_t *painted,
cairo_region_t *damage);