[clutter/wip/cogl2: 1/2] Add a --enable-cogl2 configure option to build against Cogl 2.0
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/cogl2: 1/2] Add a --enable-cogl2 configure option to build against Cogl 2.0
- Date: Wed, 25 Apr 2012 17:38:30 +0000 (UTC)
commit 39fcbfe89671c050a5416e75a0b8bea040beff67
Author: Neil Roberts <neil linux intel com>
Date: Mon Apr 23 15:14:02 2012 +0100
Add a --enable-cogl2 configure option to build against Cogl 2.0
The Cogl master branch has started removing API in preparation for a
Cogl 2.0 release which will be incompatible with the current API.
Clutter is already internally mostly using the new API via
experimental features so it can more or less already compile against
2.0. However the old Cogl API is effectively part of the Clutter API
because that is what actors use for drawing so Clutter can not
silently switch to a new Cogl API. To make testing the new Cogl API
easier it is still convenient to be able to build against Cogl 2.0 for
apps that don't care about the API break.
This adds an experimental configure option to make Clutter use the
next version of Cogl. When this is enabled CLUTTER_COGL2 will be
defined from the public Cogl headers so an application can decide to
use the newer Cogl API. Clutter internally now uses this in some
places where the new API is not available as experimental API.
This patch does not update any tests which depend on the old API but
instead just skips building them when the option is enabled.
Some features of Clutter are removed when the option is enabled. These
include ClutterShaderEffect, ClutterShader and ClutterFixed.
The Cogl compatibility header has been expanded to define more
wrappers when CLUTTER_COGL2 is defined.
clutter/Makefile.am | 40 +++++++++++++++++++++++++++-------
clutter/clutter-actor.c | 6 +++++
clutter/clutter-backend.h | 5 +++-
clutter/clutter-bezier.c | 1 +
clutter/clutter-cogl-compat.c | 43 +++++++++++++++++++++++++++++++++++++
clutter/clutter-cogl-compat.h | 27 ++++++++++++++++++++++-
clutter/clutter-deprecated.h | 7 ++++-
clutter/clutter-interval.c | 7 +++++-
clutter/clutter-paint-nodes.c | 11 +++++++++
clutter/clutter-text.c | 35 +++++++++++++++++++++++++----
clutter/clutter-texture.c | 6 +++++
clutter/clutter-texture.h | 1 +
clutter/clutter.h | 8 ++++++-
configure.ac | 31 +++++++++++++++++++++++++-
tests/conform/Makefile.am | 35 ++++++++++++++++++++---------
tests/conform/test-conform-main.c | 37 +++++++++++++++++++------------
tests/interactive/Makefile.am | 25 +++++++++++++--------
17 files changed, 269 insertions(+), 56 deletions(-)
---
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 5a19556..b30d4fd 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -110,7 +110,6 @@ source_h = \
$(srcdir)/clutter-script.h \
$(srcdir)/clutter-scriptable.h \
$(srcdir)/clutter-settings.h \
- $(srcdir)/clutter-shader-effect.h \
$(srcdir)/clutter-shader-types.h \
$(srcdir)/clutter-swipe-action.h \
$(srcdir)/clutter-snap-constraint.h \
@@ -188,7 +187,6 @@ source_c = \
$(srcdir)/clutter-script-parser.c \
$(srcdir)/clutter-scriptable.c \
$(srcdir)/clutter-settings.c \
- $(srcdir)/clutter-shader-effect.c \
$(srcdir)/clutter-shader-types.c \
$(srcdir)/clutter-swipe-action.c \
$(srcdir)/clutter-snap-constraint.c \
@@ -260,7 +258,6 @@ deprecated_h = \
$(srcdir)/deprecated/clutter-box.h \
$(srcdir)/deprecated/clutter-cairo-texture.h \
$(srcdir)/deprecated/clutter-container.h \
- $(srcdir)/deprecated/clutter-fixed.h \
$(srcdir)/deprecated/clutter-frame-source.h \
$(srcdir)/deprecated/clutter-group.h \
$(srcdir)/deprecated/clutter-keysyms.h \
@@ -268,7 +265,6 @@ deprecated_h = \
$(srcdir)/deprecated/clutter-media.h \
$(srcdir)/deprecated/clutter-rectangle.h \
$(srcdir)/deprecated/clutter-score.h \
- $(srcdir)/deprecated/clutter-shader.h \
$(srcdir)/deprecated/clutter-stage-manager.h \
$(srcdir)/deprecated/clutter-stage.h \
$(srcdir)/deprecated/clutter-texture.h \
@@ -279,7 +275,6 @@ deprecated_h = \
# deprecated source code
deprecated_c = \
- $(srcdir)/deprecated/clutter-actor-deprecated.c \
$(srcdir)/deprecated/clutter-behaviour.c \
$(srcdir)/deprecated/clutter-behaviour-depth.c \
$(srcdir)/deprecated/clutter-behaviour-ellipse.c \
@@ -288,13 +283,11 @@ deprecated_c = \
$(srcdir)/deprecated/clutter-behaviour-rotate.c \
$(srcdir)/deprecated/clutter-behaviour-scale.c \
$(srcdir)/deprecated/clutter-box.c \
- $(srcdir)/deprecated/clutter-fixed.c \
$(srcdir)/deprecated/clutter-frame-source.c \
$(srcdir)/deprecated/clutter-group.c \
$(srcdir)/deprecated/clutter-media.c \
$(srcdir)/deprecated/clutter-rectangle.c \
$(srcdir)/deprecated/clutter-score.c \
- $(srcdir)/deprecated/clutter-shader.c \
$(srcdir)/deprecated/clutter-timeout-pool.c \
$(NULL)
@@ -308,6 +301,32 @@ deprecated_c_priv = \
$(srcdir)/deprecated/clutter-timeout-interval.c \
$(NULL)
+if USE_COGL2
+
+source_c += \
+ $(srcdir)/clutter-cogl-compat.c \
+ $(NULL)
+
+else
+
+deprecated_c += \
+ $(srcdir)/deprecated/clutter-actor-deprecated.c \
+ $(srcdir)/deprecated/clutter-shader.c \
+ $(srcdir)/deprecated/clutter-fixed.c \
+ $(NULL)
+deprecated_h += \
+ $(srcdir)/deprecated/clutter-shader.h \
+ $(srcdir)/deprecated/clutter-fixed.h \
+ $(NULL)
+source_c += \
+ $(srcdir)/clutter-shader-effect.c \
+ $(NULL)
+source_h += \
+ $(srcdir)/clutter-shader-effect.h \
+ $(NULL)
+
+endif
+
# built sources
built_source_c = \
clutter-enum-types.c \
@@ -943,11 +962,16 @@ Clutter_ CLUTTER_API_VERSION_AM@_gir_FILES = \
$(deprecated_c) \
$(built_source_c)
Clutter_ CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(CLUTTER_CFLAGS) $(AM_CPPFLAGS)
-Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Cogl-1.0 CoglPango-1.0 Atk-1.0 Json-1.0
+Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Atk-1.0 Json-1.0
Clutter_ CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='clutter/clutter.h' \
--pkg-export=clutter- CLUTTER_API_VERSION@
+if USE_COGL2
+Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES += Cogl-2.0 CoglPango-2.0
+else
+Clutter_ CLUTTER_API_VERSION_AM@_gir_INCLUDES += Cogl-1.0 CoglPango-1.0
+endif
INTROSPECTION_GIRS += Clutter- CLUTTER_API_VERSION@.gir
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index a05d46b..cf63f2c 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -3412,7 +3412,9 @@ clutter_actor_paint (ClutterActor *self)
ClutterActorPrivate *priv;
ClutterPickMode pick_mode;
gboolean clip_set = FALSE;
+#ifndef CLUTTER_COGL2
gboolean shader_applied = FALSE;
+#endif
CLUTTER_STATIC_COUNTER (actor_paint_counter,
"Actor real-paint counter",
@@ -3591,12 +3593,14 @@ clutter_actor_paint (ClutterActor *self)
if (priv->effects == NULL)
{
+#ifndef CLUTTER_COGL2
if (pick_mode == CLUTTER_PICK_NONE &&
actor_has_shader_data (self))
{
_clutter_actor_shader_pre_paint (self, FALSE);
shader_applied = TRUE;
}
+#endif
priv->next_effect_to_paint = NULL;
}
@@ -3606,8 +3610,10 @@ clutter_actor_paint (ClutterActor *self)
clutter_actor_continue_paint (self);
+#ifndef CLUTTER_COGL2
if (shader_applied)
_clutter_actor_shader_post_paint (self);
+#endif
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_VOLUMES &&
pick_mode == CLUTTER_PICK_NONE))
diff --git a/clutter/clutter-backend.h b/clutter/clutter-backend.h
index 8f8f7e9..7e4ce48 100644
--- a/clutter/clutter-backend.h
+++ b/clutter/clutter-backend.h
@@ -65,7 +65,10 @@ void clutter_backend_set_font_options (ClutterBa
const cairo_font_options_t *options);
const cairo_font_options_t *clutter_backend_get_font_options (ClutterBackend *backend);
-#if defined (COGL_ENABLE_EXPERIMENTAL_API) && defined (CLUTTER_ENABLE_EXPERIMENTAL_API)
+#if (defined (COGL_ENABLE_EXPERIMENTAL_API) || \
+ defined (CLUTTER_COGL2)) && \
+ (defined (CLUTTER_ENABLE_EXPERIMENTAL_API) || \
+ defined (CLUTTER_COMPILATION))
CoglContext *clutter_backend_get_cogl_context (ClutterBackend *backend);
#endif
diff --git a/clutter/clutter-bezier.c b/clutter/clutter-bezier.c
index 7b6ba3c..1a5dd05 100644
--- a/clutter/clutter-bezier.c
+++ b/clutter/clutter-bezier.c
@@ -25,6 +25,7 @@
#include <string.h>
#include "clutter-bezier.h"
#include "clutter-debug.h"
+#include "clutter-cogl-compat.h"
/*
* We have some experimental code here to allow for constant velocity
diff --git a/clutter/clutter-cogl-compat.c b/clutter/clutter-cogl-compat.c
new file mode 100644
index 0000000..a0ff666
--- /dev/null
+++ b/clutter/clutter-cogl-compat.c
@@ -0,0 +1,43 @@
+/*
+ * Clutter.
+ *
+ * An OpenGL based 'interactive canvas' library.
+ *
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Authored By: Neil Roberts <neil linux intel com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "clutter-cogl-compat.h"
+
+GType
+cogl_gtype_handle_get_type (void)
+{
+ static volatile gsize type_volatile = 0;
+ if (g_once_init_enter (&type_volatile))
+ {
+ GType type =
+ g_boxed_type_register_static (g_intern_static_string ("CoglHandle"),
+ (GBoxedCopyFunc) cogl_object_ref,
+ (GBoxedFreeFunc) cogl_object_unref);
+ g_once_init_leave (&type_volatile, type);
+ }
+ return type_volatile;
+}
diff --git a/clutter/clutter-cogl-compat.h b/clutter/clutter-cogl-compat.h
index 3e58634..40fedba 100644
--- a/clutter/clutter-cogl-compat.h
+++ b/clutter/clutter-cogl-compat.h
@@ -27,6 +27,11 @@
#error "Only <clutter/clutter.h> can be included directly."
#endif
+#include <glib-object.h>
+#include "clutter-config.h"
+#include <cogl/cogl-enum-types.h>
+#include <cogl/cogl.h>
+
G_BEGIN_DECLS
/* XXX: Some public Clutter apis depend on Cogl types that have been
@@ -40,13 +45,33 @@ G_BEGIN_DECLS
* defined.
*/
-#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
+#if defined(COGL_ENABLE_EXPERIMENTAL_2_0_API) || defined(CLUTTER_COGL2)
/* CoglMaterial has been replaced with CoglPipeline in Cogl 2.0 */
typedef struct _CoglMaterial CoglMaterial;
#endif
+#ifdef CLUTTER_COGL2
+
+#include <math.h>
+
+/* CoglHandle has been removed */
+typedef void *CoglHandle;
+#define COGL_INVALID_HANDLE NULL
+
+#define cogl_handle_unref cogl_object_unref
+#define cogl_handle_ref cogl_object_ref
+
+#define COGL_TYPE_HANDLE (cogl_gtype_handle_get_type ())
+
+GType cogl_gtype_handle_get_type (void);
+
+/* cogl_sqrti has been removed */
+#define cogl_sqrti(x) ((int) sqrtf (x))
+
+#endif /* CLUTTER_COGL2 */
+
G_END_DECLS
#endif /* __CLUTTER_COGL_COMPAT_H__ */
diff --git a/clutter/clutter-deprecated.h b/clutter/clutter-deprecated.h
index 8a15ec3..10f2f63 100644
--- a/clutter/clutter-deprecated.h
+++ b/clutter/clutter-deprecated.h
@@ -17,7 +17,6 @@
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h"
#include "deprecated/clutter-container.h"
-#include "deprecated/clutter-fixed.h"
#include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h"
@@ -25,7 +24,6 @@
#include "deprecated/clutter-media.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-score.h"
-#include "deprecated/clutter-shader.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-texture.h"
@@ -33,6 +31,11 @@
#include "deprecated/clutter-timeout-pool.h"
#include "deprecated/clutter-util.h"
+#ifndef CLUTTER_COGL2
+#include "deprecated/clutter-shader.h"
+#include "deprecated/clutter-fixed.h"
+#endif /* CLUTTER_COGL2 */
+
#undef __CLUTTER_DEPRECATED_H_INSIDE__
#endif /* __CLUTTER_DEPRECATED_H__ */
diff --git a/clutter/clutter-interval.c b/clutter/clutter-interval.c
index 5f4f6d7..e2e5ccf 100644
--- a/clutter/clutter-interval.c
+++ b/clutter/clutter-interval.c
@@ -58,11 +58,14 @@
#include <gobject/gvaluecollector.h>
#include "clutter-color.h"
-#include "clutter-fixed.h"
#include "clutter-interval.h"
#include "clutter-private.h"
#include "clutter-units.h"
+#ifndef CLUTTER_COGL2
+#include "clutter-fixed.h"
+#endif
+
enum
{
PROP_0,
@@ -100,6 +103,7 @@ clutter_interval_real_validate (ClutterInterval *interval,
{
GType pspec_gtype = G_PARAM_SPEC_VALUE_TYPE (pspec);
+#ifndef CLUTTER_COGL2
/* check the GTypes we provide first */
if (pspec_gtype == COGL_TYPE_FIXED)
{
@@ -114,6 +118,7 @@ clutter_interval_real_validate (ClutterInterval *interval,
else
return FALSE;
}
+#endif /* CLUTTER_COGL2 */
/* then check the fundamental types */
switch (G_TYPE_FUNDAMENTAL (pspec_gtype))
diff --git a/clutter/clutter-paint-nodes.c b/clutter/clutter-paint-nodes.c
index e78199c..affa444 100644
--- a/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter-paint-nodes.c
@@ -407,7 +407,14 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
break;
case PAINT_OP_PATH:
+#ifdef CLUTTER_COGL2
+ {
+ CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
+ cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
+ }
+#else
cogl_path_fill (op->op.path);
+#endif
break;
case PAINT_OP_PRIMITIVE:
@@ -1145,9 +1152,13 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
break;
case PAINT_OP_PATH:
+#ifdef CLUTTER_COGL2
+ cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
+#else
cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);
cogl_pop_source ();
+#endif
break;
case PAINT_OP_PRIMITIVE:
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index ed03947..6a27c3e 100644
--- a/clutter/clutter-text.c
+++ b/clutter/clutter-text.c
@@ -61,6 +61,7 @@
#include "clutter-units.h"
#include "clutter-paint-volume-private.h"
#include "clutter-scriptable.h"
+#include "clutter-backend.h"
/* cursor width in pixels */
#define DEFAULT_CURSOR_SIZE 2
@@ -1588,8 +1589,18 @@ selection_paint (ClutterText *self)
{
/* Paint selection background first */
PangoLayout *layout = clutter_text_get_layout (self);
- CoglPath *selection_path = cogl_path_new ();
+ CoglPath *selection_path;
CoglColor cogl_color = { 0, };
+#ifdef CLUTTER_COGL2
+ CoglContext *context =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
+#endif
+
+#ifdef CLUTTER_COGL2
+ selection_path = cogl_path_new (context);
+#else /* CLUTTER_COGL2 */
+ selection_path = cogl_path_new ();
+#endif /* CLUTTER_COGL2 */
/* Paint selection background */
if (priv->selection_color_set)
@@ -1599,16 +1610,30 @@ selection_paint (ClutterText *self)
else
color = &priv->text_color;
+ clutter_text_foreach_selection_rectangle (self,
+ add_selection_rectangle_to_path,
+ selection_path);
+
+#ifdef CLUTTER_COGL2
+ {
+ CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
+ CoglPipeline *pipeline = cogl_pipeline_new (context);
+ cogl_pipeline_set_color4ub (pipeline,
+ color->red,
+ color->green,
+ color->blue,
+ 255);
+ cogl_framebuffer_fill_path (fb, pipeline, selection_path);
+ cogl_object_unref (pipeline);
+ }
+#else
cogl_set_source_color4ub (color->red,
color->green,
color->blue,
paint_opacity * color->alpha / 255);
- clutter_text_foreach_selection_rectangle (self,
- add_selection_rectangle_to_path,
- selection_path);
-
cogl_path_fill (selection_path);
+#endif
/* Paint selected text */
cogl_framebuffer_push_path_clip (cogl_get_draw_framebuffer (),
diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c
index d9b2305..3961f07 100644
--- a/clutter/clutter-texture.c
+++ b/clutter/clutter-texture.c
@@ -488,12 +488,15 @@ update_fbo (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv;
+#ifndef CLUTTER_COGL2
ClutterActor *head;
ClutterShader *shader = NULL;
+#endif
ClutterActor *stage = NULL;
CoglMatrix projection;
CoglColor transparent_col;
+#ifndef CLUTTER_COGL2
head = _clutter_context_peek_shader_stack ();
if (head != NULL)
shader = clutter_actor_get_shader (head);
@@ -503,6 +506,7 @@ update_fbo (ClutterActor *self)
*/
if (shader != NULL)
clutter_shader_set_is_enabled (shader, FALSE);
+#endif
/* Redirect drawing to the fbo */
cogl_push_framebuffer (priv->fbo_handle);
@@ -563,9 +567,11 @@ update_fbo (ClutterActor *self)
/* Restore drawing to the previous framebuffer */
cogl_pop_framebuffer ();
+#ifndef CLUTTER_COGL2
/* If there is a shader on top of the shader stack, turn it back on. */
if (shader != NULL)
clutter_shader_set_is_enabled (shader, TRUE);
+#endif
}
static void
diff --git a/clutter/clutter-texture.h b/clutter/clutter-texture.h
index 690a8c1..4c722ef 100644
--- a/clutter/clutter-texture.h
+++ b/clutter/clutter-texture.h
@@ -30,6 +30,7 @@
#include <cogl/cogl.h>
#include <clutter/clutter-actor.h>
+#include <clutter/clutter-cogl-compat.h>
G_BEGIN_DECLS
diff --git a/clutter/clutter.h b/clutter/clutter.h
index 1419df9..87c8344 100644
--- a/clutter/clutter.h
+++ b/clutter/clutter.h
@@ -90,7 +90,6 @@
#include "clutter-scriptable.h"
#include "clutter-script.h"
#include "clutter-settings.h"
-#include "clutter-shader-effect.h"
#include "clutter-shader-types.h"
#include "clutter-swipe-action.h"
#include "clutter-snap-constraint.h"
@@ -109,6 +108,13 @@
#include "clutter-deprecated.h"
+#ifndef CLUTTER_COGL2
+/* ClutterShaderEffect is currently using CoglProgram so it can't work
+ * with Cogl 2.0. We could eventually change it to use CoglSnippets
+ * and bring it back */
+#include "clutter-shader-effect.h"
+#endif /* CLUTTER_COGL2 */
+
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_H__ */
diff --git a/configure.ac b/configure.ac
index abd8079..07ffef1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ AC_HEADER_STDC
# required versions for dependencies
m4_define([glib_req_version], [2.31.19])
m4_define([cogl_req_version], [1.9.6])
+m4_define([cogl2_req_version], [1.99.1])
m4_define([json_glib_req_version], [0.12.0])
m4_define([atk_req_version], [2.1.5])
m4_define([cairo_req_version], [1.10])
@@ -150,6 +151,7 @@ m4_define([gdk_req_version], [3.3.18])
AC_SUBST([GLIB_REQ_VERSION], [glib_req_version])
AC_SUBST([COGL_REQ_VERSION], [cogl_req_version])
+AC_SUBST([COGL2_REQ_VERSION], [cogl2_req_version])
AC_SUBST([JSON_GLIB_REQ_VERSION], [json_glib_req_version])
AC_SUBST([ATK_REQ_VERSION], [atk_req_version])
AC_SUBST([CAIRO_REQ_VERSION], [cairo_req_version])
@@ -204,8 +206,19 @@ CLUTTER_CONFIG_DEFINES=
experimental_backend=no
experimental_input_backend=no
+# Should Cogl 2.0 be used? This will break ABI/API
+AC_ARG_ENABLE([cogl2],
+ [AS_HELP_STRING([--enable-cogl2],
+ [Use Cogl 2.0 instead of 1.0. This will effectively be an API break])],
+ [enable_cogl2=$enableval],
+ [enable_cogl2=no])
+
+AS_IF([test "x$enable_cogl2" = "xyes"],
+ [COGL_PC_FILE="cogl2 >= $COGL2_REQ_VERSION cogl-pango2"],
+ [COGL_PC_FILE="cogl-1.0 >= $COGL_REQ_VERSION cogl-pango-1.0"])
+
# base dependencies for core
-CLUTTER_BASE_PC_FILES="cogl-1.0 >= $COGL_REQ_VERSION cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION cogl-pango-1.0 json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
+CLUTTER_BASE_PC_FILES="$COGL_PC_FILE cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
# private base dependencies
CLUTTER_BASE_PC_FILES_PRIVATE=""
@@ -483,6 +496,7 @@ AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_CEX100" = "x1"])
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])
AM_CONDITIONAL(USE_COGL, [test "x$SUPPORT_COGL" = "x1"])
+AM_CONDITIONAL(USE_COGL2, [test "x$enable_cogl2" = "xyes"])
AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
AM_CONDITIONAL(USE_GLD, [test "x$have_gdl" = "xyes"])
@@ -550,6 +564,11 @@ AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_INPUT_NULL \"null\""
+# whether to use Cogl 2.0
+AS_IF([test "x$enable_cogl2" = "xyes"],
+ [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
+#define CLUTTER_COGL2 1"])
+
AC_SUBST([CLUTTER_CONFIG_DEFINES])
dnl === Clutter substitutions kept for backwards compatibility ================
@@ -1205,10 +1224,18 @@ echo ""
echo " - Wayland compositor support enabled (WARNING: Experimental)"
fi
+if test "x$enable_cogl2" = "xyes"; then
+echo ""
+echo " - Cogl 2.0 support enabled (WARNING: Experimental)"
+echo " ***This will make the build API incompatible with other builds***"
+fi
+
echo ""
# General warning about experimental features
-if test "x$experimental_backend" = "xyes"; then
+if test "x$experimental_backend" = "xyes" -o \
+ "x$experimental_input_backend" = "xyes" -o \
+ "x$enable_cogl2" = "xyes"; then
echo ""
echo "âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ"
echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 5d5cf3b..7a6b21b 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -27,23 +27,29 @@ units_sources += \
# cogl tests
units_sources += \
- test-cogl-fixed.c \
- test-cogl-materials.c \
test-cogl-viewport.c \
- test-cogl-multitexture.c \
test-cogl-npot-texture.c \
- test-cogl-object.c \
- test-cogl-premult.c \
test-cogl-readpixels.c \
test-cogl-texture-get-set-data.c \
+ test-cogl-atlas-migration.c \
+ $(NULL)
+
+# These tests need some work to compile when --enable-cogl2 is enabled
+if !USE_COGL2
+units_sources += \
+ test-cogl-fixed.c \
+ test-cogl-materials.c \
+ test-cogl-multitexture.c \
+ test-cogl-object.c \
+ test-cogl-premult.c \
test-cogl-texture-mipmaps.c \
- test-cogl-texture-pixmap-x11.c \
test-cogl-texture-rectangle.c \
- test-cogl-atlas-migration.c \
- test-cogl-vertex-buffer-contiguous.c \
+ test-cogl-texture-pixmap-x11.c \
test-cogl-vertex-buffer-interleved.c \
+ test-cogl-vertex-buffer-contiguous.c \
test-cogl-vertex-buffer-mutability.c \
$(NULL)
+endif
# actors tests
units_sources += \
@@ -55,20 +61,26 @@ units_sources += \
actor-layout.c \
actor-offscreen-redirect.c \
actor-paint-opacity.c \
- actor-pick.c \
- actor-shader-effect.c \
actor-size.c \
binding-pool.c \
cairo-texture.c \
group.c \
path.c \
rectangle.c \
- texture-fbo.c \
texture.c \
text-cache.c \
text.c \
$(NULL)
+# These tests need some work to compile when --enable-cogl2 is enabled
+if !USE_COGL2
+units_sources += \
+ actor-pick.c \
+ actor-shader-effect.c \
+ texture-fbo.c \
+ $(NULL)
+endif
+
# objects tests
units_sources += \
color.c \
@@ -101,6 +113,7 @@ stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c
@mkdir -p wrappers
@sed -n \
-e 's/^ \{1,\}TEST_CONFORM_SIMPLE *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
+ -e 's/^ \{1,\}TEST_CONFORM_COGL1 *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
-e 's/^ \{1,\}TEST_CONFORM_SKIP *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
-e 's/^ \{1,\}TEST_CONFORM_TODO *(.*"\([^",]\{1,\}\)", *\([a-zA-Z0-9_]\{1,\}\).*/\/conform\1\/\2/p' \
$(srcdir)/test-conform-main.c > unit-tests
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 04536ae..137de9c 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -60,6 +60,15 @@ static TestConformSharedState *shared_state = NULL;
FUNC, \
test_conform_simple_fixture_teardown); } G_STMT_END
+/* These tests require Cogl 1.x */
+#if CLUTTER_COGL2
+#define TEST_CONFORM_COGL1(NAMESPACE, FUNC) \
+ G_STMT_START { } G_STMT_END
+#else /* CLUTTER_COGL2 */
+#define TEST_CONFORM_COGL1(NAMESPACE, FUNC) \
+ TEST_CONFORM_SIMPLE(NAMESPACE, FUNC)
+#endif /* CLUTTER_COGL2 */
+
/* this is a macro that conditionally executes a test if CONDITION
* evaluates to TRUE; otherwise, it will put the test under the
* "/skipped" namespace and execute a dummy function that will always
@@ -139,13 +148,13 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/actor", actor_container_signals);
TEST_CONFORM_SIMPLE ("/actor", actor_destruction);
TEST_CONFORM_SIMPLE ("/actor", actor_anchors);
- TEST_CONFORM_SIMPLE ("/actor", actor_pick);
+ TEST_CONFORM_COGL1 ("/actor", actor_pick);
TEST_CONFORM_SIMPLE ("/actor", actor_fixed_size);
TEST_CONFORM_SIMPLE ("/actor", actor_preferred_size);
TEST_CONFORM_SIMPLE ("/actor", actor_basic_layout);
TEST_CONFORM_SIMPLE ("/actor", actor_margin_layout);
TEST_CONFORM_SIMPLE ("/actor", actor_offscreen_redirect);
- TEST_CONFORM_SIMPLE ("/actor", actor_shader_effect);
+ TEST_CONFORM_COGL1 ("/actor", actor_shader_effect);
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_children);
TEST_CONFORM_SIMPLE ("/actor/iter", actor_iter_traverse_remove);
@@ -185,7 +194,7 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/rectangle", rectangle_set_color);
TEST_CONFORM_SIMPLE ("/texture", texture_pick_with_alpha);
- TEST_CONFORM_SIMPLE ("/texture", texture_fbo);
+ TEST_CONFORM_COGL1 ("/texture", texture_fbo);
TEST_CONFORM_SIMPLE ("/texture/cairo", texture_cairo);
TEST_CONFORM_SIMPLE ("/path", path_base);
@@ -234,23 +243,23 @@ main (int argc, char **argv)
/* FIXME - see bug https://bugzilla.gnome.org/show_bug.cgi?id=655588 */
TEST_CONFORM_TODO ("/cally", cally_text);
- TEST_CONFORM_SIMPLE ("/cogl", test_cogl_object);
- TEST_CONFORM_SIMPLE ("/cogl", test_cogl_fixed);
- TEST_CONFORM_SIMPLE ("/cogl", test_cogl_materials);
- TEST_CONFORM_SIMPLE ("/cogl", test_cogl_premult);
+ TEST_CONFORM_COGL1 ("/cogl", test_cogl_object);
+ TEST_CONFORM_COGL1 ("/cogl", test_cogl_fixed);
+ TEST_CONFORM_COGL1 ("/cogl", test_cogl_materials);
+ TEST_CONFORM_COGL1 ("/cogl", test_cogl_premult);
TEST_CONFORM_SIMPLE ("/cogl", test_cogl_readpixels);
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_npot_texture);
- TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_multitexture);
- TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_mipmaps);
- TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_rectangle);
- TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_pixmap_x11);
+ TEST_CONFORM_COGL1 ("/cogl/texture", test_cogl_multitexture);
+ TEST_CONFORM_COGL1 ("/cogl/texture", test_cogl_texture_mipmaps);
+ TEST_CONFORM_COGL1 ("/cogl/texture", test_cogl_texture_rectangle);
+ TEST_CONFORM_COGL1 ("/cogl/texture", test_cogl_texture_pixmap_x11);
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_texture_get_set_data);
TEST_CONFORM_SIMPLE ("/cogl/texture", test_cogl_atlas_migration);
- TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_contiguous);
- TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
- TEST_CONFORM_SIMPLE ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
+ TEST_CONFORM_COGL1 ("/cogl/vertex-buffer", test_cogl_vertex_buffer_contiguous);
+ TEST_CONFORM_COGL1 ("/cogl/vertex-buffer", test_cogl_vertex_buffer_interleved);
+ TEST_CONFORM_COGL1 ("/cogl/vertex-buffer", test_cogl_vertex_buffer_mutability);
/* left to the end because they aren't currently very orthogonal and tend to
* break subsequent tests! */
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
index 2c38e30..402ac2c 100644
--- a/tests/interactive/Makefile.am
+++ b/tests/interactive/Makefile.am
@@ -12,23 +12,16 @@ UNIT_TESTS = \
test-threads.c \
test-script.c \
test-grab.c \
- test-cogl-shader-arbfp.c \
- test-cogl-shader-glsl.c \
test-animator.c \
test-state.c \
test-state-animator.c \
test-fbo.c \
test-multistage.c \
- test-cogl-primitives.c \
test-cogl-tex-tile.c \
test-cogl-tex-convert.c \
test-cogl-tex-foreign.c \
test-cogl-tex-getset.c \
- test-cogl-offscreen.c \
- test-cogl-tex-polygon.c \
- test-cogl-multitexture.c \
test-stage-read-pixels.c \
- test-clip.c \
test-paint-wrapper.c \
test-texture-quality.c \
test-layout.c \
@@ -39,16 +32,13 @@ UNIT_TESTS = \
test-text-field.c \
test-cairo-clock.c \
test-cairo-flowers.c \
- test-cogl-vertex-buffer.c \
test-bin-layout.c \
test-flow-layout.c \
test-box-layout.c \
test-stage-sizing.c \
test-drag.c \
- test-constraints.c \
test-scrolling.c \
test-swipe-action.c \
- test-cogl-point-sprites.c \
test-table-layout.c \
test-path-constraint.c \
test-snap-constraint.c \
@@ -60,6 +50,21 @@ UNIT_TESTS = \
test-content.c \
test-canvas.c
+# These tests need some work to compile when --enable-cogl2 is enabled
+if !USE_COGL2
+UNIT_TESTS += \
+ test-cogl-primitives.c \
+ test-cogl-shader-arbfp.c \
+ test-cogl-shader-glsl.c \
+ test-cogl-offscreen.c \
+ test-cogl-tex-polygon.c \
+ test-cogl-multitexture.c \
+ test-clip.c \
+ test-constraints.c \
+ test-cogl-vertex-buffer.c \
+ test-cogl-point-sprites.c
+endif
+
if X11_TESTS
UNIT_TESTS += test-pixmap.c
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]