diff --git a/cogl/cogl/cogl-onscreen-private.h b/cogl/cogl/cogl-onscreen-private.h index f7d44c0e2..0d85494c9 100644 --- a/cogl/cogl/cogl-onscreen-private.h +++ b/cogl/cogl/cogl-onscreen-private.h @@ -81,6 +81,9 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, void _cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen); +void +cogl_onscreen_bind (CoglOnscreen *onscreen); + COGL_EXPORT void cogl_onscreen_set_winsys (CoglOnscreen *onscreen, gpointer winsys); diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index d61a3a488..11868cde2 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -301,6 +301,12 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen, _cogl_onscreen_queue_dispatch_idle (onscreen); } +void +cogl_onscreen_bind (CoglOnscreen *onscreen) +{ + COGL_ONSCREEN_GET_CLASS (onscreen)->bind (onscreen); +} + void cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, diff --git a/cogl/cogl/cogl-onscreen.h b/cogl/cogl/cogl-onscreen.h index 6a134dc90..14d28a9b3 100644 --- a/cogl/cogl/cogl-onscreen.h +++ b/cogl/cogl/cogl-onscreen.h @@ -58,6 +58,8 @@ struct _CoglOnscreenClass /*< private >*/ CoglFramebufferClass parent_class; + void (* bind) (CoglOnscreen *onscreen); + void (* swap_buffers_with_damage) (CoglOnscreen *onscreen, const int *rectangles, int n_rectangles, diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c index 8a49d6f80..9b698f39c 100644 --- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c +++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c @@ -165,10 +165,8 @@ cogl_gl_framebuffer_back_bind (CoglGlFramebuffer *gl_framebuffer, CoglFramebuffer *framebuffer = cogl_framebuffer_driver_get_framebuffer (driver); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); - const CoglWinsysVtable *winsys = - _cogl_framebuffer_get_winsys (framebuffer); - winsys->onscreen_bind (COGL_ONSCREEN (framebuffer)); + cogl_onscreen_bind (COGL_ONSCREEN (framebuffer)); GE (ctx, glBindFramebuffer (target, 0)); diff --git a/cogl/cogl/winsys/cogl-onscreen-egl.c b/cogl/cogl/winsys/cogl-onscreen-egl.c index 7e4807ed4..3bfa4ba0e 100644 --- a/cogl/cogl/winsys/cogl-onscreen-egl.c +++ b/cogl/cogl/winsys/cogl-onscreen-egl.c @@ -126,7 +126,7 @@ cogl_onscreen_egl_dispose (GObject *object) } } -static gboolean +static void bind_onscreen_with_context (CoglOnscreen *onscreen, EGLContext egl_context) { @@ -147,24 +147,16 @@ bind_onscreen_with_context (CoglOnscreen *onscreen, eglSwapInterval (egl_renderer->edpy, 1); } - - return status; } -static gboolean -bind_onscreen (CoglOnscreen *onscreen) +static void +cogl_onscreen_egl_bind (CoglOnscreen *onscreen) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = cogl_framebuffer_get_context (framebuffer); CoglDisplayEGL *egl_display = context->display->winsys; - return bind_onscreen_with_context (onscreen, egl_display->egl_context); -} - -void -_cogl_winsys_onscreen_egl_bind (CoglOnscreen *onscreen) -{ - bind_onscreen (onscreen); + bind_onscreen_with_context (onscreen, egl_display->egl_context); } #ifndef EGL_BUFFER_AGE_EXT @@ -358,6 +350,7 @@ cogl_onscreen_egl_class_init (CoglOnscreenEglClass *klass) object_class->dispose = cogl_onscreen_egl_dispose; + onscreen_class->bind = cogl_onscreen_egl_bind; onscreen_class->swap_buffers_with_damage = cogl_onscreen_egl_swap_buffers_with_damage; onscreen_class->swap_region = cogl_onscreen_egl_swap_region; diff --git a/cogl/cogl/winsys/cogl-onscreen-egl.h b/cogl/cogl/winsys/cogl-onscreen-egl.h index b464405d2..6843439f2 100644 --- a/cogl/cogl/winsys/cogl-onscreen-egl.h +++ b/cogl/cogl/winsys/cogl-onscreen-egl.h @@ -41,9 +41,6 @@ struct _CoglOnscreenEglClass CoglOnscreenClass parent_class; }; -void -_cogl_winsys_onscreen_egl_bind (CoglOnscreen *onscreen); - int _cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen); diff --git a/cogl/cogl/winsys/cogl-onscreen-glx.c b/cogl/cogl/winsys/cogl-onscreen-glx.c index 882e793d1..1367336e2 100644 --- a/cogl/cogl/winsys/cogl-onscreen-glx.c +++ b/cogl/cogl/winsys/cogl-onscreen-glx.c @@ -272,8 +272,8 @@ cogl_onscreen_glx_dispose (GObject *object) } } -void -_cogl_winsys_onscreen_glx_bind (CoglOnscreen *onscreen) +static void +cogl_onscreen_glx_bind (CoglOnscreen *onscreen) { CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); @@ -1160,6 +1160,7 @@ cogl_onscreen_glx_class_init (CoglOnscreenGlxClass *klass) framebuffer_class->allocate = cogl_onscreen_glx_allocate; + onscreen_class->bind = cogl_onscreen_glx_bind; onscreen_class->swap_buffers_with_damage = cogl_onscreen_glx_swap_buffers_with_damage; onscreen_class->swap_region = cogl_onscreen_glx_swap_region; diff --git a/cogl/cogl/winsys/cogl-onscreen-glx.h b/cogl/cogl/winsys/cogl-onscreen-glx.h index e5e9a1f2f..946db8e4f 100644 --- a/cogl/cogl/winsys/cogl-onscreen-glx.h +++ b/cogl/cogl/winsys/cogl-onscreen-glx.h @@ -41,9 +41,6 @@ cogl_onscreen_glx_new (CoglContext *context, int width, int height); -void -_cogl_winsys_onscreen_glx_bind (CoglOnscreen *onscreen); - int _cogl_winsys_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen); diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index 5149b4eb6..fb2ab4be7 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -636,7 +636,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = .display_destroy = _cogl_winsys_display_destroy, .context_init = _cogl_winsys_context_init, .context_deinit = _cogl_winsys_context_deinit, - .onscreen_bind = _cogl_winsys_onscreen_egl_bind, .onscreen_get_buffer_age = _cogl_winsys_onscreen_egl_get_buffer_age, #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 5561b13d2..ad3eeea2f 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -1469,7 +1469,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = .context_init = _cogl_winsys_context_init, .context_deinit = _cogl_winsys_context_deinit, .context_get_clock_time = _cogl_winsys_get_clock_time, - .onscreen_bind = _cogl_winsys_onscreen_glx_bind, .onscreen_get_buffer_age = _cogl_winsys_onscreen_glx_get_buffer_age, .onscreen_x11_get_window_xid = _cogl_winsys_onscreen_glx_get_window_xid, diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index d6a235710..6956f4692 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -104,9 +104,6 @@ typedef struct _CoglWinsysVtable void (*context_deinit) (CoglContext *context); - void - (*onscreen_bind) (CoglOnscreen *onscreen); - gboolean (*onscreen_direct_scanout) (CoglOnscreen *onscreen, CoglScanout *scanout,