Merge branch 'wip/otte/for-gtk-3-24' into 'gtk-3-24'
Check for GLsync before using it See merge request GNOME/gtk!6162
This commit is contained in:
10
gdk/gdkgl.c
10
gdk/gdkgl.c
@ -341,7 +341,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
|||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
GdkGLContext *paint_context;
|
GdkGLContext *paint_context, *current_context;
|
||||||
cairo_surface_t *image;
|
cairo_surface_t *image;
|
||||||
cairo_matrix_t matrix;
|
cairo_matrix_t matrix;
|
||||||
int dx, dy, window_scale;
|
int dx, dy, window_scale;
|
||||||
@ -352,7 +352,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
|||||||
int alpha_size = 0;
|
int alpha_size = 0;
|
||||||
cairo_region_t *clip_region;
|
cairo_region_t *clip_region;
|
||||||
GdkGLContextPaintData *paint_data;
|
GdkGLContextPaintData *paint_data;
|
||||||
GLsync sync = NULL;
|
GLsync sync;
|
||||||
|
|
||||||
impl_window = window->impl_window;
|
impl_window = window->impl_window;
|
||||||
|
|
||||||
@ -366,9 +366,13 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
clip_region = gdk_cairo_region_from_clip (cr);
|
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);
|
sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
|
else
|
||||||
|
sync = NULL;
|
||||||
|
|
||||||
gdk_gl_context_make_current (paint_context);
|
gdk_gl_context_make_current (paint_context);
|
||||||
|
|
||||||
|
|||||||
@ -101,6 +101,7 @@ typedef struct {
|
|||||||
guint has_gl_framebuffer_blit : 1;
|
guint has_gl_framebuffer_blit : 1;
|
||||||
guint has_frame_terminator : 1;
|
guint has_frame_terminator : 1;
|
||||||
guint has_unpack_subimage : 1;
|
guint has_unpack_subimage : 1;
|
||||||
|
guint has_sync : 1;
|
||||||
guint extensions_checked : 1;
|
guint extensions_checked : 1;
|
||||||
guint debug_enabled : 1;
|
guint debug_enabled : 1;
|
||||||
guint forward_compatible : 1;
|
guint forward_compatible : 1;
|
||||||
@ -441,6 +442,14 @@ gdk_gl_context_has_unpack_subimage (GdkGLContext *context)
|
|||||||
return priv->has_unpack_subimage;
|
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:
|
* gdk_gl_context_set_debug_enabled:
|
||||||
* @context: a #GdkGLContext
|
* @context: a #GdkGLContext
|
||||||
@ -809,6 +818,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
|||||||
priv->has_frame_terminator = FALSE;
|
priv->has_frame_terminator = FALSE;
|
||||||
|
|
||||||
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
|
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
|
||||||
|
priv->has_sync = priv->gl_version >= 30;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -818,6 +828,9 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
|||||||
priv->has_gl_framebuffer_blit = priv->gl_version >= 30 || epoxy_has_gl_extension ("GL_EXT_framebuffer_blit");
|
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_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator");
|
||||||
priv->has_unpack_subimage = TRUE;
|
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 */
|
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
|
||||||
if (priv->gl_version < 32)
|
if (priv->gl_version < 32)
|
||||||
|
|||||||
@ -86,6 +86,7 @@ gboolean gdk_gl_context_use_texture_rectangle (GdkGLContext
|
|||||||
gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context);
|
gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context);
|
||||||
gboolean gdk_gl_context_has_frame_terminator (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_unpack_subimage (GdkGLContext *context);
|
||||||
|
gboolean gdk_gl_context_has_sync (GdkGLContext *context);
|
||||||
void gdk_gl_context_end_frame (GdkGLContext *context,
|
void gdk_gl_context_end_frame (GdkGLContext *context,
|
||||||
cairo_region_t *painted,
|
cairo_region_t *painted,
|
||||||
cairo_region_t *damage);
|
cairo_region_t *damage);
|
||||||
|
|||||||
Reference in New Issue
Block a user