summaryrefslogtreecommitdiff
path: root/cogl
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2020-10-20 09:42:57 +0200
committerRobert Mader <robert.mader@posteo.de>2021-01-30 09:11:46 +0000
commitb7c6865225afbd8c30861e2f840df44d24a6983e (patch)
tree6c9cd4c6c32cf2c6e132e0e28f03c496623e4ad3 /cogl
parent1b3937491c07c8c8fe41e5061d60597a7125a0b1 (diff)
downloadmutter-b7c6865225afbd8c30861e2f840df44d24a6983e.tar.gz
cogl/framebuffer: Move flush() and finish() to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
Diffstat (limited to 'cogl')
-rw-r--r--cogl/cogl/cogl-driver.h6
-rw-r--r--cogl/cogl/cogl-framebuffer-driver.c12
-rw-r--r--cogl/cogl/cogl-framebuffer-driver.h10
-rw-r--r--cogl/cogl/cogl-framebuffer.c6
-rw-r--r--cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h6
-rw-r--r--cogl/cogl/driver/gl/cogl-framebuffer-gl.c18
-rw-r--r--cogl/cogl/driver/gl/gl/cogl-driver-gl.c2
-rw-r--r--cogl/cogl/driver/gl/gles/cogl-driver-gles.c2
-rw-r--r--cogl/cogl/driver/nop/cogl-driver-nop.c2
-rw-r--r--cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h6
-rw-r--r--cogl/cogl/driver/nop/cogl-framebuffer-nop.c10
-rw-r--r--cogl/cogl/driver/nop/cogl-nop-framebuffer.c12
12 files changed, 48 insertions, 44 deletions
diff --git a/cogl/cogl/cogl-driver.h b/cogl/cogl/cogl-driver.h
index de195efc8..6d79e3a75 100644
--- a/cogl/cogl/cogl-driver.h
+++ b/cogl/cogl/cogl-driver.h
@@ -86,12 +86,6 @@ struct _CoglDriverVtable
CoglFramebufferState state);
void
- (* framebuffer_finish) (CoglFramebuffer *framebuffer);
-
- void
- (* framebuffer_flush) (CoglFramebuffer *framebuffer);
-
- void
(* framebuffer_discard_buffers) (CoglFramebuffer *framebuffer,
unsigned long buffers);
diff --git a/cogl/cogl/cogl-framebuffer-driver.c b/cogl/cogl/cogl-framebuffer-driver.c
index 9616cec8b..4e9c92707 100644
--- a/cogl/cogl/cogl-framebuffer-driver.c
+++ b/cogl/cogl/cogl-framebuffer-driver.c
@@ -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,
diff --git a/cogl/cogl/cogl-framebuffer-driver.h b/cogl/cogl/cogl-framebuffer-driver.h
index 39883f29f..416db1098 100644
--- a/cogl/cogl/cogl-framebuffer-driver.h
+++ b/cogl/cogl/cogl-framebuffer-driver.h
@@ -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 */
diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c
index 53d2cbcc5..9e0739d36 100644
--- a/cogl/cogl/cogl-framebuffer.c
+++ b/cogl/cogl/cogl-framebuffer.c
@@ -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
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h
index 02d7e86f4..9e2205cdf 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h
@@ -52,12 +52,6 @@ struct _CoglGlFramebufferClass
};
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);
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index 944547e30..d2040a5ab 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -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;
}
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 1191987cf..d4e56c4c9 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -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,
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 45b44bcb3..7a031ae41 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -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,
diff --git a/cogl/cogl/driver/nop/cogl-driver-nop.c b/cogl/cogl/driver/nop/cogl-driver-nop.c
index c8fe732c5..96afa3bd0 100644
--- a/cogl/cogl/driver/nop/cogl-driver-nop.c
+++ b/cogl/cogl/driver/nop/cogl-driver-nop.c
@@ -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,
diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h
index e31c31b68..7efe883de 100644
--- a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h
+++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h
@@ -38,12 +38,6 @@
#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);
diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c
index 9cfe0becc..757ce268c 100644
--- a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c
+++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c
@@ -36,16 +36,6 @@
#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)
{
diff --git a/cogl/cogl/driver/nop/cogl-nop-framebuffer.c b/cogl/cogl/driver/nop/cogl-nop-framebuffer.c
index f37056094..39df6833a 100644
--- a/cogl/cogl/driver/nop/cogl-nop-framebuffer.c
+++ b/cogl/cogl/driver/nop/cogl-nop-framebuffer.c
@@ -55,6 +55,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;
}