cogl/framebuffer: Move flush() and finish() to driver class

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
Jonas Ådahl 2020-10-20 09:42:57 +02:00 committed by Robert Mader
parent 1b3937491c
commit b7c6865225
12 changed files with 48 additions and 44 deletions

View File

@ -85,12 +85,6 @@ struct _CoglDriverVtable
CoglFramebuffer *read_buffer,
CoglFramebufferState state);
void
(* framebuffer_finish) (CoglFramebuffer *framebuffer);
void
(* framebuffer_flush) (CoglFramebuffer *framebuffer);
void
(* framebuffer_discard_buffers) (CoglFramebuffer *framebuffer,
unsigned long buffers);

View File

@ -81,6 +81,18 @@ cogl_framebuffer_driver_clear (CoglFramebufferDriver *driver,
alpha);
}
void
cogl_framebuffer_driver_finish (CoglFramebufferDriver *driver)
{
COGL_FRAMEBUFFER_DRIVER_GET_CLASS (driver)->finish (driver);
}
void
cogl_framebuffer_driver_flush (CoglFramebufferDriver *driver)
{
COGL_FRAMEBUFFER_DRIVER_GET_CLASS (driver)->flush (driver);
}
static void
cogl_framebuffer_driver_get_property (GObject *object,
guint prop_id,

View File

@ -51,6 +51,10 @@ struct _CoglFramebufferDriverClass
float green,
float blue,
float alpha);
void (* finish) (CoglFramebufferDriver *driver);
void (* flush) (CoglFramebufferDriver *driver);
};
CoglFramebuffer *
@ -68,4 +72,10 @@ cogl_framebuffer_driver_clear (CoglFramebufferDriver *driver,
float blue,
float alpha);
void
cogl_framebuffer_driver_finish (CoglFramebufferDriver *driver);
void
cogl_framebuffer_driver_flush (CoglFramebufferDriver *driver);
#endif /* COGL_FRAMEBUFFER_DRIVER_H */

View File

@ -1707,11 +1707,10 @@ cogl_framebuffer_finish (CoglFramebuffer *framebuffer)
{
CoglFramebufferPrivate *priv =
cogl_framebuffer_get_instance_private (framebuffer);
CoglContext *ctx = priv->context;
_cogl_framebuffer_flush_journal (framebuffer);
ctx->driver_vtable->framebuffer_finish (framebuffer);
cogl_framebuffer_driver_finish (priv->driver);
}
void
@ -1719,11 +1718,10 @@ cogl_framebuffer_flush (CoglFramebuffer *framebuffer)
{
CoglFramebufferPrivate *priv =
cogl_framebuffer_get_instance_private (framebuffer);
CoglContext *ctx = priv->context;
_cogl_framebuffer_flush_journal (framebuffer);
ctx->driver_vtable->framebuffer_flush (framebuffer);
cogl_framebuffer_driver_flush (priv->driver);
}
void

View File

@ -51,12 +51,6 @@ struct _CoglGlFramebufferClass
GLenum target);
};
void
_cogl_framebuffer_gl_finish (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_gl_flush (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers);

View File

@ -312,16 +312,20 @@ cogl_gl_framebuffer_clear (CoglFramebufferDriver *driver,
GE (ctx, glClear (gl_buffers));
}
void
_cogl_framebuffer_gl_finish (CoglFramebuffer *framebuffer)
static void
cogl_gl_framebuffer_finish (CoglFramebufferDriver *driver)
{
GE (cogl_framebuffer_get_context (framebuffer), glFinish ());
CoglContext *ctx = context_from_driver (driver);
GE (ctx, glFinish ());
}
void
_cogl_framebuffer_gl_flush (CoglFramebuffer *framebuffer)
static void
cogl_gl_framebuffer_flush (CoglFramebufferDriver *driver)
{
GE (cogl_framebuffer_get_context (framebuffer), glFlush ());
CoglContext *ctx = context_from_driver (driver);
GE (ctx, glFlush ());
}
void
@ -717,4 +721,6 @@ cogl_gl_framebuffer_class_init (CoglGlFramebufferClass *klass)
COGL_FRAMEBUFFER_DRIVER_CLASS (klass);
driver_class->clear = cogl_gl_framebuffer_clear;
driver_class->finish = cogl_gl_framebuffer_finish;
driver_class->flush = cogl_gl_framebuffer_flush;
}

View File

@ -571,8 +571,6 @@ _cogl_driver_gl =
_cogl_driver_update_features,
_cogl_driver_gl_create_framebuffer_driver,
_cogl_driver_gl_flush_framebuffer_state,
_cogl_framebuffer_gl_finish,
_cogl_framebuffer_gl_flush,
_cogl_framebuffer_gl_discard_buffers,
_cogl_framebuffer_gl_draw_attributes,
_cogl_framebuffer_gl_draw_indexed_attributes,

View File

@ -459,8 +459,6 @@ _cogl_driver_gles =
_cogl_driver_update_features,
_cogl_driver_gl_create_framebuffer_driver,
_cogl_driver_gl_flush_framebuffer_state,
_cogl_framebuffer_gl_finish,
_cogl_framebuffer_gl_flush,
_cogl_framebuffer_gl_discard_buffers,
_cogl_framebuffer_gl_draw_attributes,
_cogl_framebuffer_gl_draw_indexed_attributes,

View File

@ -99,8 +99,6 @@ _cogl_driver_nop =
_cogl_driver_update_features,
_cogl_driver_nop_create_framebuffer_driver,
_cogl_driver_nop_flush_framebuffer_state,
_cogl_framebuffer_nop_finish,
_cogl_framebuffer_nop_flush,
_cogl_framebuffer_nop_discard_buffers,
_cogl_framebuffer_nop_draw_attributes,
_cogl_framebuffer_nop_draw_indexed_attributes,

View File

@ -37,12 +37,6 @@
#include "cogl-types.h"
#include "cogl-context-private.h"
void
_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_nop_flush (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers);

View File

@ -35,16 +35,6 @@
#include <glib.h>
#include <string.h>
void
_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer)
{
}
void
_cogl_framebuffer_nop_flush (CoglFramebuffer *framebuffer)
{
}
void
_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers)

View File

@ -54,6 +54,16 @@ cogl_nop_framebuffer_clear (CoglFramebufferDriver *driver,
{
}
static void
cogl_nop_framebuffer_finish (CoglFramebufferDriver *driver)
{
}
static void
cogl_nop_framebuffer_flush (CoglFramebufferDriver *driver)
{
}
static void
cogl_nop_framebuffer_init (CoglNopFramebuffer *nop_framebuffer)
{
@ -67,4 +77,6 @@ cogl_nop_framebuffer_class_init (CoglNopFramebufferClass *klass)
driver_class->query_bits = cogl_nop_framebuffer_query_bits;
driver_class->clear = cogl_nop_framebuffer_clear;
driver_class->finish = cogl_nop_framebuffer_finish;
driver_class->flush = cogl_nop_framebuffer_flush;
}