Commit Graph

159 Commits

Author SHA1 Message Date
Robert Bragg
eb7fafe700 tests: Adds our first white-box unit test
This adds a white-box unit test that verifies that GL_BLEND is disabled
when drawing an opaque rectangle, enabled when drawing a transparent
rectangle and then disabled again when drawing a transparent rectangle
but with a blend string that effectively disables blending.

This shares the test utilities and launcher infrastructure we are using
for conformance tests so we get consistent reporting and so unit tests
will be run against a range of different drivers.

This adds a --enable-unit-tests configure option which is enabled by
default but if disabled will make all UNIT_TESTS() into static inline
functions that we should expect the compiler to discard since they won't
be referenced by anything.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9047cce06bbf9051ec77e622be2fdbb96ed767a8)
2013-06-06 21:27:16 +01:00
Robert Bragg
0e7a632e13 Adds initial Emscripten support to Cogl
This enables basic Emscripten support in Cogl via the SDL winsys.
Assuming you have setup an emscripten toolchain you can configure Cogl
like this:

 emconfigure ./configure --enable-debug --enable-emscripten

Building the examples will build .html files that can be loaded directly
by a WebGL enabled browser.

Note: at this point the emscripten support has just barely been smoke
tested so it's expected that as we continue to build on this we will
learn about more things we need to change in Cogl to full support this
environment.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a3bc2e7539391b074e697839dfae60b69c37cf10)
2013-05-29 19:30:44 +01:00
Robert Bragg
8d6d1a4daa Bump version to 1.15.1 2013-04-24 22:23:49 +01:00
Neil Roberts
95fe636a53 Fix a warning about ‘sincos’ in examples/cogl-gles2-gears
‘sincos’ is a GNU extension. cogl-gles2-gears was using it without
defining _GNU_SOURCE so it was generating some annoying warnings. This
patch fixes it by making the example include config.h which will end
up defining _GNU_SOURCE.

In addition this patch adds a configure check for the function and
provides a fallback if it's not available.

https://bugzilla.gnome.org/show_bug.cgi?id=697330

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit eb5c92952e1882c95cfd6debc69a2c9efff096b9)
2013-04-23 18:30:54 +01:00
Emanuele Aina
b8673fbb2f build: Use LT_LIB_M to find the math library in a portable way
https://bugzilla.gnome.org/show_bug.cgi?id=697330

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a7b4930e14add7d955c22f396178b71083dfb52f)

Conflicts:
	cogl/Makefile.am
2013-04-23 18:30:50 +01:00
Neil Roberts
3ba03feb7d quartz-image: Pass -framework ApplicationServices in the linker flags
The quartz image backend is using functions from the
ApplicationServices framework and I was getting linker errors if I
didn't use this option. I'm not sure how anyone managed to build it
before without this.

https://bugzilla.gnome.org/show_bug.cgi?id=696730

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 54d9139a929560d6703428371b38b83e7d965f45)
2013-04-04 13:37:51 +01:00
Neil Roberts
69c60f6bf9 Post-release version bump to 1.14.1 2013-03-25 14:07:32 +00:00
Neil Roberts
232d8dc67c Release 1.14.0 (release) 2013-03-25 13:31:19 +00:00
Neil Roberts
13675ab440 configure: Add a minimum required version for the wayland package
Previously Cogl would accept any version of Wayland when building the
Wayland backend. Seeing as there is now a stable API we might as well
specify that we require at least version 1.0.0. This is now also
mentioned in the README. This patch also changes it to use
PKG_CHECK_MODULES instead of PKG_CHECK_EXISTS because it does need to
abort if it fails and it shouldn't be checking it silently.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit d899955b714e5ed50c6c89b9fde4b341bcf80558)
2013-03-22 00:13:36 +00:00
Neil Roberts
5334547c00 cogland: Update to the Wayland 1.0 API
This updates Cogland example compositor to use the stable Wayland 1.0
API.

• When the client attaches a new buffer to a surface it is now added
  to a struct contaning pending the state instead of immediately
  switching to the new buffer. This state is then flushed when the
  surface is committed.

• The frame callbacks are now queued in a pending list and only added
  to the compositor's main list when the surface is committed. Both
  lists are now a wl_list instead of a GQueue because it makes it
  easier to remove the callback without knowing which list it is in.

• When the buffer is destroyed for a surface the resource for the
  buffer is now sent a release event.

• It now flushes the clients in the prepare for the for the Wayland
  event GSource. This is part of the multi-threaded API in this
  Wayland patch:

  http://cgit.freedesktop.org/wayland/wayland/commit/?id=53d24713a31d59

• Implements a dummy wl_region interface. The only interfaces that
  actually use regions (the opaque and input regions) are ignored but
  we need the interface to create a resource.

• Most the of the SHM interface is now implemented directly in
  libwayland-server except that it still needs to copy the data to the
  subregion of the texture when the damage region is committed.

• The callback list for when a resource is destroyed has been unified
  into a generic wl_signal implementation so the signature for the
  functions has been changed.

  http://cgit.freedesktop.org/wayland/wayland/commit/?h=6802eaa68af9022

• The wl_buffer struct no longer has a user_data parameter so we can't
  attach our own CoglandBuffer data to it. Instead the CoglandSurface
  now just keeps track of the wl_buffer directly.

• The Cogland example is now unconditionally built instead of checking
  the Wayland version number in the configure script. It looks like
  this check was broken anyway because it was checking the version of
  the gbm package rather than a Wayland package.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 4cbbc0f8e3de1fd44dee08b487f1c3f97dda8ede)

Conflicts:
	examples/Makefile.am
	examples/cogland.c
2013-03-22 00:13:32 +00:00
Neil Roberts
6cab431f4c Post-release version bump to 1.13.5 2013-02-21 16:07:53 +00:00
Neil Roberts
72847ad8e2 Release 1.13.4 (snapshot) 2013-02-21 15:45:24 +00:00
Owen W. Taylor
88d8bd84f2 Add CoglOutput and track for the GLX backend
The CoglOutput object represents one output such as a monitor or
laptop panel, with information about attributes of the output such as
the position of the output within the global coordinate space, and
the refresh rate.

We don't yet publically export the ability to get output information but
we track it for the GLX backend, where we'll use it to track the refresh
rate.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit d7ef9d8d71488d0e6874f1ffc6e48700d5c82a31)
2013-01-30 19:56:45 +00:00
Robert Bragg
78bea226d4 Post-release version bump to 1.13.3 2013-01-22 18:44:33 +00:00
Robert Bragg
b33b41e7ab Release 1.13.2 (snapshot) 2013-01-22 18:00:12 +00:00
Damien Lespiau
c26d3813c4 doc: Fix cross-referencing with glib and gdk-pixbuf
The libraries prefixes where never set in the configure script and
GDKPIXBUF_PREFIX had a typo.

(cherry picked from commit 5d8c0e13ed0572f806fdff2bff1d5904ed3bf69b)
2013-01-22 17:48:16 +00:00
Damien Lespiau
f51f2459ac build: Use -Wundef when possible
This allows us to catch the use of undefined macros (that default to 0)
in preprocessor conditionals.

(cherry picked from commit 53ddc20fe9cd1400d18274e521932f84a4aecc5b)
2013-01-22 17:48:11 +00:00
Damien Lespiau
3289fe03e8 build: Exclude COGL_DEFINES and COGL_GL_HEADER_INCLUDES from Makefiles
Some variables (notably multiline ones) are not really supposed to be
substituted by automake. Let's take COGL_DEFINES for instance, you get:

  COGL_DEFINES =
  #define COGL_HAS_GLIB_SUPPORT
  #define COGL_HAS_GTYPE_SUPPORT
  #define COGL_HAS_GL
  #define CLUTTER_COGL_HAS_GL
  #define COGL_HAS_GLX_SUPPORT
  #define COGL_HAS_SDL
  ...

This only works because the '#' character makes it look like a comment
and COGL_DEFINES becomes an empty variable

Automake allows to exclude variables from the list of substitutions,
let's use it for those two.

(cherry picked from commit e0a9d8d775c90c60b6e63b52771e896da3641a40)
2013-01-22 17:48:11 +00:00
Neil Roberts
4f6fe6f0e2 Fixes for --disable-glib
This fixes some problems which were stopping --disable-glib from
working properly:

• A lot of the public headers were including glib.h. This shouldn't be
  necessary because the API doesn't expose any glib types. Otherwise
  any apps would require glib in order to get the header.

• The public headers were using G_BEGIN_DECLS. There is now a
  replacement macro called COGL_BEGIN_DECLS which is defined in
  cogl-types.h.

• A similar fix has been done for G_GNUC_NULL_TERMINATED and
  G_GNUC_DEPRECATED.

• The CFLAGS were not including $(builddir)/deps/glib which was
  preventing it finding the generated glibconfig.h when building out
  of tree.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 4138b3141c2f39cddaea3d72bfc04342ed5092d0)
2013-01-22 17:48:05 +00:00
Neil Roberts
5c8eebb3d9 configure: Don't allow --enable-gdk-pixbuf with --disable-glib
The GDK pixbuf support requires being able to propagate errors from
GDKPixbuf as GErrors. This won't work if we are using the builtin
version of GLib because any attempt to call g_error_free from within
Cogl will use the internal version which will free the error using the
wrong slice allocator. It probably doesn't make much sense to build
without glib but with gdk-pixbuf so there's not much point in trying
to work around this situation.

Previously if you specified --enable-gdk-pixbuf but gdk-pixbuf was not
available it would silently disable it. This pach also fixes it so
that it will report an error in that case.

If --enable-gdk-pixbuf is not specified it will now default to
enabling it only if both glib is enabled and gdk-pixbuf is available.

This patch looks slightly longer than it ought to be because it moves
the check for glib up to above the descisions about the image backend.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8b1eabdc08da89a57792f9eb666e893a6cbb4e26)
2013-01-22 17:48:05 +00:00
Damien Lespiau
1c0c1a126a build: Create the libtool file early as it's used by AS_GLIBCONFIG
glib's configure.ac uses libtool to determine the extension of shared
libraries. So let's generate the libtool file early in configure.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ae457e0e2463bcec4f5891778e8ada9924f91be7)
2013-01-22 17:47:58 +00:00
Damien Lespiau
41f443971c Build: Add a --enable-standalone option
This option will generate a libcogl2 DSO that depends on the least
possible external libraries.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 6357960e1b91081546adf1bb110067d7db4d7400)
2013-01-22 17:47:58 +00:00
Damien Lespiau
d2c41502a4 build: Allow to build cogl without an external glib dependency
This commit pushes --disable-glib to the extreme of embedding the par of
glib cogl depends on in tree to be able to generate a DSO that does not
depend on an external glib.

To do so, it:
  - keeps a lot of glib's configure.ac in as-glibconfig.m4
  - pulls the code cogl depends on and the necessary dependencies

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-01-22 17:47:58 +00:00
Damien Lespiau
6a126f2af3 build: Use the correct variable to indicate of cogl-gles2 will be built
Instead of using the variable to use in Makefile.ams.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 016f2276823a8a8cde33d3e7062c61469921a9f1)
2013-01-22 17:47:24 +00:00
Damien Lespiau
21cf79db9c build: Indicate if cogl is build with i18n support
--disable-nls can be used to compile cogl without i18n support. Let's
indicate the i18n enabling status so curious people can deduce it can be
compiled out.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 1ccaafa31dbc0c9b9184d61079b2deff913d8e25)
2013-01-22 17:47:24 +00:00
Damien Lespiau
a229a06fb8 build: Move the compiler checks and libtool initialization up
It seems logical to first look for the compiler and then run the rest of
configure script (which will use the compiler with small snippets).

Same goes for the libtool initializaton, you might as well do it not too
far from the automake one.

This also happens to be preparatory work to compile cogl with an in-tree
copy of some glib files as the glib's configure script needs those
checks early.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit ba452ea4a48e48324ee7382b7ccb9065c255f55a)
2013-01-22 17:47:24 +00:00
Damien Lespiau
0fdfde51f3 build: Bump the glib dependency to 2.32
As far as I can tell the --symbol-prefix option wasn't there before
glib 2.32's glib-mkenums. So cogl effectively depends on glib 2.32.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4e952532a29b2566caf658705f815b7aec732265)
2013-01-18 17:28:25 +00:00
Robert Bragg
58bbf8499a Bump version to 1.13.1 2013-01-18 10:53:29 +00:00
Robert Bragg
015a47b77a Post-release version bump to 1.12.3 2013-01-04 17:37:21 +00:00
Robert Bragg
0f2ce5e77c Release 1.12.2 (release) 2013-01-04 17:23:45 +00:00
Robert Bragg
ab00855967 build: only build cogland with wayland-server 0.85
This ensures we only try to build cogland if we have wayland-server
0.85.x since the api is incompatible with later versions.
2013-01-04 17:23:45 +00:00
Robert Bragg
a8fa6c7c4d Post-release version bump to 1.12.1 2012-09-24 14:19:41 +01:00
Robert Bragg
b1aafcc15f Release 1.12.0 (release) 2012-09-24 13:46:40 +01:00
Robert Bragg
f904f2099a Post-release version bump to 1.11.7 2012-09-17 23:47:25 +01:00
Robert Bragg
3aa7bdaf49 Release 1.11.6 (snapshot) 2012-09-17 23:11:34 +01:00
Robert Bragg
6bcee6e9f3 Post-release version bump to 1.11.5 2012-09-03 19:18:17 +01:00
Robert Bragg
32801ad0a4 Release 1.11.4 (snapshot) 2012-09-03 15:55:15 +01:00
Sjoerd Simons
cde0eb3e76 Make the default driver selectable at configure time
When building COGL with multiple backends it can be useful to force a
default driver to be selected. For example while for Debian we do want to
build the GL renderer on ARM, GLESv2 is much more suitable as the
default renderer on that platform.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8a43aa7167b56784f7b50c557391b990861d594f)
2012-09-03 15:51:45 +01:00
Robert Bragg
74d749eca4 kms: Update to latest gbm api
gbm_bo_get_pitch was renamed to gbm_bo_get_stride to be consistent with
how the terms pitch and stride are used throughout mesa. This updates
the Cogl backend to use the new gbm_bo_get_stride name.

For compatibility with previous version of libgbm we now explicitly
check the version of libgbm in configure.ac and expose
COGL_GBM_{MAJOR,MINOR,MICRO} defines to the code so we can conditionally
use the older gbm_bo_get_pitch() name with older versions.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 47c6247095e2f1f8725c4eb08d38c9de15e283cd)
2012-09-03 15:51:44 +01:00
Patrick Welche
4589c6f158 test(1) uses '=' to test if strings are identical
https://bugzilla.gnome.org/show_bug.cgi?id=682340

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5cd15e7781466307a27c31e6e3f1e7f5ade5cfee)
2012-08-28 11:28:23 +01:00
Robert Bragg
002671bd3e Post-release version bump to 1.11.3 2012-08-15 17:56:30 +01:00
Robert Bragg
bc305b1150 Release 1.11.2 (snapshot) 2012-08-15 17:32:22 +01:00
Antoine Jacoutot
601abeadca build: remove unneeded check for libdrm
Since fallback for vblank wait via manual drm ioctl was removed in
commit 3bc70687ac there is no need to
check for libdrm anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=678316

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit b84047a578b7746e421cd553e781788925cff90f)
2012-08-15 17:29:16 +01:00
Robert Bragg
470273db7e configure: use AC_GNU_SOURCE
This adds the AC_GNU_SOURCE macro to configure.ac to ensure _GNU_SOURCE
is defined while compiling Cogl. This is required to use memmem for
example.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 1ed717dc12fc4d2cb49010232de93ff46684aa6a)
2012-08-15 14:09:53 +01:00
Neil Roberts
0c66431df3 Add a wrapper for 'memmem'
memmem is a GNU libc extension that works like strstr except that the
size of the needle and the haystack are passed into the function
instead of using null-terminated strings.

This patch adds a wrapper function called 'cogl_util_memmem' so that
we can use this function. There is a configure check and if the
function is not available then a fallback implementation will be used.
Otherwise cogl_util_memmem is just defined to memmem.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 1dd1b0a67f6238e13f7f9253fb03addada0541b7)
2012-08-14 18:55:42 +01:00
Tomeu Vizoso
bb258c1d42 Avoid including the EGL headers from the public Cogl headers
Otherwise, X11 identifiers may leak and cause havoc in big applications

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ed0cdca0eca815543619fe72fbd42d662d53f92d)
2012-08-06 18:51:32 +01:00
Neil Roberts
17c818a9a7 Add an SDL2 winsys
This adds an alternate version of the SDL winsys using the SDL 2 API.
The two versions are mutually exclusive and share the same
CoglWinsysID. Version 2 of SDL fits a little bit better with Cogl
because it supports multiple windows and the video subsystem can be
initialised entirely independently of the rest of the subsystems.

The SDL2 winsys creates an invisible dummy window in order to bind the
GL context after creating the Cogl display. This is similar to how the
X11 winsys's work.

SDL2 seems to support compiling with support for both GL and GLES.
However there doesn't seem to be a way to select between the two
backends outside of SDL. In fact if you do compile them both in it
seems to break down because it will always try to use the window
system functions from the GLES backend because those are filled in
second in the vtable. However when creating the window it will always
prefer to use the GL function to choose a visual. This function gets
confused because the GL backend has not been initialised at that
point. The Cogl backend therefore just leaves it up to SDL to pick a
sensible backend. It will then verify that it picked a GL library
which matches the Cogl driver by checking the string from
glGetString(GL_VERSION).

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 6cb5ab41355e7bfe28f367cf4afa39a7afcfeec2)
2012-08-06 14:27:44 +01:00
Neil Roberts
b977d75059 Fix disabling debugging
When --disable-debug is passed to the configure script it was actually
still defining COGL_ENABLE_DEBUG so very little would end up being
disabled. If COGL_ENABLE_DEBUG actually got defined it would also fail
to compile because _cogl_debug_instances and COGL_DEBUG_N_LONGS from
cogl-debug.h were only defined if debugging is enabled but they are
used regardless.

This patch also makes it so that the _COGL_RETURN_IF_FAIL family of
macros that are used when glib support is disabled are now disabled if
debugging is disabled. When the glib macros are used they are already
disabled because we additionally define G_DISABLE_CHECKS.

'COGL_HANDLE_DEBUG' has been removed from the list of defines passed
when debugging is enabled because CoglHandle has already been removed
and it is not used anywhere in the code.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 9811a0101c9cbb4ab95c55a2b41fd10ff4c77d9f)
2012-08-06 14:27:43 +01:00
Robert Bragg
10340a5495 Adds libcogl-gles2 frontend GLES2 api
This adds a library that can be used instead of libGLESv2.so to provide
symbols for the GLES 2.0 api. This can be used for convenience when
using the cogl_gles2_context_ api since you don't need to manually go
through a CoglGLES2Vtable when calling the gles2 api so it should be
easier to port existing gles2 code to integrate with Cogl.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 80d7599a2acefca7d01d8d7de9df524278ef72c5)
2012-08-06 14:27:42 +01:00
Chun-wei Fan
23becf67a7 Fix Visual C++ build
-Create a pre-defined cogl/cogl-gl-header.h(.win32) that is to be used on
 any Windows builds, and adapt the MSVC build process to set up and use
 that file.
-Fix up glib-mkenums code generation .bat file that is generated during
 "make"/"make dist", like the autotools-based builds.
-Since cogl/cogl-defines.h now contain versionioning info, and it no longer
 directly includes the GL headers, update the pre-configured
 cogl-defines.h[.win32|.win32_SDL] and use autotools to fill in the
 versioning info during "make"/"make dist".
-Fix up cogl/cogl-pango.rc.in so that they reflect the cogl-2.x versioning
 stuff correctly and versioning info can be filled in correctly during
 "make"/"make dist"

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 7ff42bb1c5280b0f53370f8d94ef5f10c9f39e2f)
2012-08-06 14:27:42 +01:00