Adds cogl_wayland_texture_set_region_from_shm_buffer which is a
convenience wrapper around cogl_texture_set_region but it uses the
correct format to copy the data from a Wayland SHM buffer. This will
typically be used by compositors to update the texture for a surface
when an SHM buffer is attached. The ordering of the arguments is based
on cogl_texture_set_region_from_bitmap.
Based on a patch by Jasper St. Pierre.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit c76c1d136d2cac7f3d1331a4d1dc0dd0f06e812c)
Conflicts:
examples/cogland.c
This declares the interface types CoglFramebuffer, CoglBuffer,
CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when
including the public cogl.h header so that users don't have to use lots
of C type casts between instance types and interface types.
This also removes all of the COGL_XYZ() type cast macros since they do
nothing more than compile time type casting but it's less readable if
you haven't seen that coding pattern before.
Unlike with gobject based apis that use per-type macros for casting and
performing runtime type checking we instead prefer to do our runtime
type checking internally within the front-end public apis when objects
are passed into Cogl. This greatly reduces the verbosity for users of
the api and may help reduce the chance of excessive runtime type
checking that can sometimes be a problem.
(cherry picked from commit 248a76f5eac7e5ae4fb45208577f9a55360812a7)
Since we can't break the 1.x api this version of the patch actually
defines compatible NOP macros within deprecated/cogl-type-casts.h
This updates the old point sprites interactive test from Clutter to be
a standalone Cogl example using the 2.0 API.
(cherry picked from commit e7ede458fde7207896e507d64b52b77777b3c872)
This renames cogl_offscreen_new_to_texture to
cogl_offscreen_new_with_texture. The intention is to then cherry-pick
this back to the cogl-1.16 branch so we can maintain a parallel
cogl_offscreen_new_to_texture() function which keeps the synchronous
allocation semantics that some clutter applications are currently
relying on.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit ecc6d2f64481626992b2fe6cdfa7b999270b28f5)
Note: Since we can't break the 1.x api on this branch this keeps a
thin shim around cogl_offscreen_new_with_texture to implement
cogl_offscreen_new_to_texture with its synchronous allocation
semantics.
When splitting out the CoglPath api we saw that we would be left with
inconsistent drawing apis if the drawing apis in core Cogl were lumped
into the cogl_framebuffer_ api considering other Cogl sub-libraries or
that others will want to create higher level drawing apis outside of
Cogl but can't use the same namespace.
So that we can aim for a more consistent style this adds a
cogl_primitive_draw() api, comparable to cogl_path_fill() or
cogl_pango_show_layout() that's intended to replace
cogl_framebuffer_draw_primitive()
Note: the attribute and rectangle drawing apis are still in the
cogl_framebuffer_ namespace and this might potentially change but in
these cases there is no single object representing the thing being drawn
so it seems a more reasonable they they live in the framebuffer
namespace for now.
Note: the cogl_framebuffer_draw_primitive() api isn't removed by this
patch so it can more conveniently be cherry picked to the 1.16 branch so
we can mark it deprecated for a short while. Even though it's marked as
experimental api we know that there are people using the api so we'd
like to give them a chance to switch to the new api.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 418912b93ff81a47f9b38114d05335ab76277c48)
Conflicts:
cogl-pango/cogl-pango-display-list.c
cogl/Makefile.am
cogl/cogl-framebuffer.c
cogl/cogl-pipeline-layer-state.h
cogl/cogl2-path.c
cogl/driver/gl/cogl-clip-stack-gl.c
Instead of using cogl_texture_new_from_file/with_size in the example we
now use the cogl_texture_2d_ equivalents. This is in preparation for
removing the cogl-auto-texture apis.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 815a1c80db4132fff6ccf97fc08396e61fc31ebb)
Conflicts:
examples/cogl-crate.c
examples/cogl-gles2-context.c
examples/cogl-msaa.c
wl_resource may become an opaque type in future so we should probably
be using the accessors instead of directly prodding into the struct.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8ab07725734b8b2151470cc44bb3f88798ac5538)
wl_client_add_resource has been deprecated in the Wayland API in
favour of wl_client_add_object which returns a pointer to a
wl_resource which it allocates instead of the compositor having to
embed it in a larger struct. As far as I understand the idea is to
eventually make wl_resource completely opaque. This patch changes
Cogland accordingly.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit adb971954757dffb9ddecf8c9091b96756424800)
The Wayland server API has changed so that wl_shm_buffer is no longer
a type of wl_buffer and it instead must be retrieved directly from the
resource.
cogl_wayland_texture_2d_new_from_buffer now takes a resource pointer
instead of directly taking a wl_buffer and it will do different things
depending on whether it can get a wl_shm_buffer out of the resource
instead of trying to query the buffer type.
Cogland has also been updated so that it tracks a resource for buffers
of surfaces instead of directly tracking a wl_buffer. This are pointed
to by a new CoglandBuffer struct which can be referenced by a
CoglandBufferReference. The WL_BUFFER_RELEASE event will be posted
when the last reference to the buffer is removed instead of directly
whenever a new buffer is attached. This is similar to how Weston
works.
https://bugzilla.gnome.org/show_bug.cgi?id=702999
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 9b35e1651ad0e46ed489893b60563e2c25457701)
Conflicts:
examples/cogland.c
This adds several utility apis that aim to make it as easy as possible
for an application to determine what size a video should be drawn at.
The important detail here is that these apis take into account the
pixel-aspect-ratio in addition to the video's own aspect ratio.
This patch updates the cogl-basic-video-player example to use the
cogl_gst_video_sink_fit_size() api to perform letterboxing.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit d26f17c97ff6b9f6d6211e0527d5965a85305a56)
CoglGst is a GStreamer integration library that facilitates
video playback using the Cogl API. It works by retrieving
each video frame from the GStreamer pipeline and attaching
it to a Cogl pipeline in the form of a Cogl texture along
with possible color model conversion shaders. The pipeline
is then retrieved by the user during each draw. An example
use of the CoglGst API is included in the examples directory.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit dfb94cf4b0b6b42d6465df362a0c0af780596890)
This adds a new function to enable per-vertex point size on a
pipeline. This can be set with
cogl_pipeline_set_per_vertex_point_size(). Once enabled the point size
can be set either by drawing with an attribute named
'cogl_point_size_in' or by writing to the 'cogl_point_size_out'
builtin from a snippet.
There is a feature flag which must be checked for before using
per-vertex point sizes. This will only be set on GL >= 2.0 or on GLES
2.0. GL will only let you set a per-vertex point size from GLSL by
writing to gl_PointSize. This is only available in GL2 and not in the
older GLSL extensions.
The per-vertex point size has its own pipeline state flag so that it
can be part of the state that affects vertex shader generation.
Having to enable the per vertex point size with a separate function is
a bit awkward. Ideally it would work like the color attribute where
you can just set it for every vertex in your primitive with
cogl_pipeline_set_color or set it per-vertex by just using the
attribute. This is harder to get working with the point size because
we need to generate a different vertex shader depending on what
attributes are bound. I think if we wanted to make this work
transparently we would still want to internally have a pipeline
property describing whether the shader was generated with per-vertex
support so that it would work with the shader cache correctly.
Potentially we could make the per-vertex property internal and
automatically make a weak pipeline whenever the attribute is bound.
However we would then also need to automatically detect when an
application is writing to cogl_point_size_out from a snippet.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8495d9c1c15ce389885a9356d965eabd97758115)
Conflicts:
cogl/cogl-context.c
cogl/cogl-pipeline-private.h
cogl/cogl-pipeline.c
cogl/cogl-private.h
cogl/driver/gl/cogl-pipeline-progend-fixed.c
cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c
This updates Cogland and the three hello examples to use the dirty
callback. For Cogland, this removes the manual handling of X events
and for the other examples it removes the need to redraw continously.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 108e3c548b7866190845f163c84a05212718bd70)
Instead of simply relying on the emscripten mainloop api to wake us up
periodically so that we can poll for SDL events we now pause the
emscripten mainloop whenever no redraw is queued and instead hook an
input event listener into the real browser mainloop to resume the
emscripten mainloop whenever input is received. This way the example
can go to sleep while there's no input to handle.
This provides a simple example of binding custom javascript into native
code.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit a8b1e2eda491dc7c44c84cd47e160c7b8ba0f792)
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)
Since 906e1b5eb535a86 Cogland no longer redraws constantly but instead
only draws once at startup and then again whenever a client attaches a
new buffer. Sometimes however it seems that the first paint will get
lost perhaps because it is sent before the window is fully mapped. As
it was previously not handling expose events it would not paint again
until the first client is connected so there would be a blank window
which looks broken.
This patch makes it handle Expose events when it detects that Cogl is
using an X backend. On other backends it will resort to queuing a
redraw every 16ms as it did before.
Although this is probably a bit overkill for such a small example, it
seems like a good idea to only redraw when we think it's necessary so
that we can be sure that the mechanism works. Handling the expose
events means we can have at least one platform where we can test this.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 99cf15b285302243395873d78f05a5895c173eef)
Previously if a client sent a commit message without attaching a new
buffer then it would end up detaching the existing buffer because
surface->pending.buffer would be NULL. This patch makes it explicitly
track when an attach is sent for a commit and so that it can avoid
making any changes otherwise. This fixes cases where GTK apps would
send a damage event without a new buffer.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit aa412b9c709120bd8d88a014010c448f3b9fcfb7)
This updates the cogl_poll_ apis to allow dispatching events before we
have a CoglContext and to also enables pollfd state to be changed in a
more add-hoc way by different Cogl components by replacing the
winsys->get_poll_info with _cogl_poll_renderer_add/remove_fd functions
and a winsys->get_dispatch_timeout vfunc.
One of the intentions here is that applications should be able to run
their mainloop before creating a CoglContext to potentially get events
relating to CoglOutputs.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 667e58c9cb2662aef5f44e580a9eda42dc8d0176)
When adding the frame callback API in 70040166 we decided on a common
idiom for adding callbacks which would return an opaque pointer
representing the closure for the callback. This pointer can then be
used to later remove the callback. The closure can also contain an
optional callback to invoke when the user data parameter is destroyed.
The resize callback didn't work this way and instead had an integer
handle to identify the closure. This patch changes it to work the same
way as the frame callback.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 33164c4b04d253ebe0ff41b12c1e90232c519274)
This adds compiler symbol deprecation declarations for old Cogl APIs so
that users can easily see via compiler warning when they are using these
symbols, and also see a hint for what the apis should be replaced with.
So that users of Cogl can manage when to show these warnings this
introduces a scheme borrowed from glib whereby you can declare what
version of the Cogl api you are using:
COGL_VERSION_MIN_REQUIRED can be defined to indicate the oldest Cogl api
that the application wants to use. Cogl will only warn about
deprecations for symbols that were deprecated earlier than this required
version. If this is left undefined then by default Cogl will warn about
all deprecations.
COGL_VERSION_MAX_ALLOWED can be defined to indicate the newest api
that the application uses. If the application uses symbols newer than
this then Cogl will give a warning about that.
This patch removes the need to maintain the COGL_DISABLE_DEPRECATED
guards around deprecated symbols.
This patch fixes a few uses of deprecated symbols in the examples/
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Some of the examples and tests are using functions from -lm. With some
linkers, if we don't expicitly link against it an error will be
reported. This patch adds the library to all of the examples even
though not all of them use math functions because I don't think it
will do any harm and it will save us having to remember to add it if
an example later starts using some math functions.
https://bugzilla.gnome.org/show_bug.cgi?id=697330
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 66a1aeaee1f7cdcdd505f5745277723a43d714b6)
Conflicts:
examples/Makefile.am
tests/conform/Makefile.am
tests/micro-perf/Makefile.am
‘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)
The first vertex in the triangle vertices used in the cogl-hello
example (which were copied into a few other examples) for some reason
has a semi-transparent alpha component. However the colour needs to be
pre-multiplied and the red component was still 0xff so the colour is
effectively invalid and the transparency isn't shown. This patch just
sets the alpha component to 0xff to make it less confusing.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 461879986ec012556b4e680b73e36d440927faaa)
Cogland works a lot better with an EGL context because then Mesa will
automatically set up the wl_drm object and it can accept DRM buffers.
However Cogland is still useful with GLX because it can gracefully
fallback to accepting only SHM buffers. This patch therefore makes it
first try creating and connecting a renderer with the EGL constraint,
but if that doesn't work it will try again without it.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 05ddc7d75e77538b5de22d4336d4a444d122063b)
When a Wayland compositor gets a commit it only needs to redraw the
region specified by the pending damage event. Previously Cogland was
ignoring damage events for non-shm buffers and just always queuing a
redraw after a commit event. This patch changes it to queue a redraw
only in response to a damage event. In practice this doesn't really
make much difference because Cogland doesn't do anything clever to
handle updating a sub-region of the screen, but it more costly matches
the model a compositor should use.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 15f00609e41f689234ee8d5b2f9e95fb74612d12)
If the shell surface is requested twice then Cogland will hit an error
path but it would end up leaking the CoglandShellSurface struct it
allocated.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 622d41b04c2689a8e4fb6e1769aaf887a04242e8)
The handler for the destroy signal on the pending buffer was not
correctly being removed if the same buffer is committed twice to the
surface. It was also not being cleared if the surface is destroyed
before the pending buffer is committed.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 11683476a7a62cd14a10d84fd52f2cb4b47e33a0)
The clients should be flushed before going idle, not after so the call
to wl_display_flush_clients was in the wrong place.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit a191366fbababd5b551140ef9297a9c6e3852c59)
Instead of always drawing at 60FPS without ever going idle, Cogland
now only redraws when a client commits a frame or a surface is
destroyed. This is acheived using an idle handler on the glib main
loop.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 906e1b5eb535a86a849bed7a363f800ad71ab9bc)
Conflicts:
examples/cogland.c
The previous display size of 640x480 was a bit small to test with.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 835626e220137765df5acf7419036218e3fc7c97)
Previously Cogland would always split the desktop into four outputs.
Although this is quite neat to demonstrate that it's possible, it's
quite annoying in practice while testing. This patch turns it into a
command line option which defaults to off.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 5570bf892268c8d2ea36bc26473aeb607c0e2c1d)
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
This updates the examples and test-journal which now use the _FRAME_SYNC
events to throttle rendering so that they don't install a redundant idle
handler to paint when they get a FRAME_SYNC event and instead they now
directly paint when the event is received.
(cherry picked from commit 579eb75e6ac6f50d7a9cfe5093435126158b3c96)
This updates cogl-gles2-gears to use the new
cogl_onscreen_add_frame_callback() api to use _SYNC events for
throttling.
(cherry picked from commit 4fdb8b966ad3501842bbdff3d96b0c4e098e2646)
This updates cogl-gles2-context to use the new
cogl_onscreen_add_frame_callback() api to use _SYNC events for
throttling.
(cherry picked from commit 2063306645e32ceb3252ebcd2eebd33c879d7fbe)
The two SDL examples now throttle their rendering to the
COGL_FRAME_EVENT_SYNC event. Previously the examples would redraw
whenever a mouse motion event is received but now they additionally
wait for the sync event which means that if another mouse event comes
immediately after rendering the last frame it theoretically could
avoid blocking waiting for the last frame to complete. In practice
however the SDL winsys doesn't support swap events so it will get the
sync event immediately anyway, but it's nice to have the code as an
example and a test.
This patch also changes the mainloop a bit to do the equivalent steps
without the outer main loop which I think makes it a bit easier to
follow.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 97cdd832dded2ebfaa42ee4bc43319cb8648d01b)
This updates cogl-crate to use the new
cogl_onscreen_add_frame_callback() api to use _SYNC events for
throttling.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 47ea52774025b620258e00a32cb873674d0fc721)
This updates cogl-hello to use the new
cogl_onscreen_add_frame_callback() api to use _SYNC events for
throttling.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 06d3cb0d99944e0150e30d553d248feb5f049000)
This adds a cogl_renderer_foreach_output() function that can be used to
iterate the display outputs for a particular renderer.
This also updates cogl-info to use this new api so it can dump out all
the output information.
Reviewed-by: Owen W. Taylor <otaylor@fishsoup.net>
(cherry picked from commit a2abf4c4c1fd5aeafd761f965d07a0fe9a362afc)
This make autogen.sh look for automake-1.13 and also updates all
Makefile.am files to no longer use the INCLUDES variable which automake
1.13 warns is deprecated by AM_CPPFLAGS.
https://bugzilla.gnome.org/show_bug.cgi?id=690891
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5de5569e960102afe979a5f2f0403e1defebca62)
The SDL2 winsys will now set the SDL_WINDOW_RESIZABLE flag on the
window before creating it if the resizable property is set on the
onscreen. Note that there doesn't appear to be a way in SDL to change
the flag later so unlike the other winsyses it will only take affect
if it is set before allocating the framebuffer.
The winsys now registers a callback for SDL events so that it can
report window size changes back to the application.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 0dea9aeb897faf029828379b120970477df3c7d5)
If we're using the system glib library then we need to make sure not to
include headers under deps/glib otherwise we end up with with
incompatible typedefs that break the build.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5d5fc97b59951ec56a4193b7ee7909ebd3cfbb94)
This SDL example were unnecessarily including <glib.h> but they don't
actually depend on glib so now they are built even if Cogl is being
built with --disable-glib.
(cherry picked from commit 1d3bce7f68b0a6885c10a29cd9836a3541a1b653)
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>
Although we use GLib internally in Cogl we would rather not leak GLib
api through Cogl's own api, except through explicitly namespaced
cogl_glib_ / cogl_gtype_ feature apis.
One of the benefits we see to not leaking GLib through Cogl's public API
is that documentation for Cogl won't need to first introduce the Glib
API to newcomers, thus hopefully lowering the barrier to learning Cogl.
This patch provides a Cogl specific typedef for reporting runtime errors
which by no coincidence matches the typedef for GError exactly. If Cogl
is built with --enable-glib (default) then developers can even safely
assume that a CoglError is a GError under the hood.
This patch also enforces a consistent policy for when NULL is passed as
an error argument and an error is thrown. In this case we log the error
and abort the application, instead of silently ignoring it. In common
cases where nothing has been implemented to handle a particular error
and/or where applications are just printing the error and aborting
themselves then this saves some typing. This also seems more consistent
with language based exceptions which usually cause a program to abort if
they are not explicitly caught (which passing a non-NULL error signifies
in this case)
Since this policy for NULL error pointers is stricter than the standard
GError convention, there is a clear note in the documentation to warn
developers that are used to using the GError api.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit b068d5ea09ab32c37e8c965fc8582c85d1b2db46)
Note: Since we can't change the Cogl 1.x api the patch was changed to
not rename _error_quark() functions to be _error_domain() functions and
although it's a bit ugly, instead of providing our own CoglError type
that's compatible with GError we simply #define CoglError to GError
unless Cogl is built with glib disabled.
Note: this patch does technically introduce an API break since it drops
the cogl_error_get_type() symbol generated by glib-mkenum (Since the
CoglError enum was replaced by a CoglSystemError enum) but for now we
are assuming that this will not affect anyone currently using the Cogl
API. If this does turn out to be a problem in practice then we would be
able to fix this my manually copying an implementation of
cogl_error_get_type() generated by glib-mkenum into a compatibility
source file and we could also define the original COGL_ERROR_ enums for
compatibility too.
Note: another minor concern with cherry-picking this patch to the 1.14
branch is that an api scanner would be lead to believe that some APIs
have changed, and for example the gobject-introspection parser which
understands the semantics of GError will not understand the semantics of
CoglError. We expect most people that have tried to use
gobject-introspection with Cogl already understand though that it is not
well suited to generating bindings of the Cogl api anyway and we aren't
aware or anyone depending on such bindings for apis involving GErrors.
(GnomeShell only makes very-very minimal use of Cogl via the gjs
bindings for the cogl_rectangle and cogl_color apis.)
The main reason we have cherry-picked this patch to the 1.14 branch
even given the above concerns is that without it it would become very
awkward for us to cherry-pick other beneficial patches from master.
This commit introduces some new framebuffer api to be able to
enable texture based depth buffers for a framebuffer (currently
only supported for offscreen framebuffers) and once allocated
to be able to retrieve the depth buffer as a texture for further
usage, say, to implement shadow mapping.
The API works as follow:
* Before the framebuffer is allocated, you can request that a depth
texture is created with
cogl_framebuffer_set_depth_texture_enabled()
* cogl_framebuffer_get_depth_texture() can then be used to grab a
CoglTexture once the framebuffer has been allocated.
This adds api to be able to request that the window system allows a
given onscreen framebuffer to be resizable, and api to add and remove
resize handlers to be called whenever the framebuffer does actually
change size.
The new functions are:
cogl_onscreen_{get,set}_resizable()
cogl_onscreen_{add,remove}_resize_handler()
The examples cogl-hello and cogl-x11-foreign have been updated to use
the new api. To smoke test how Cogl updates the viewport automatically
in response to window resizes the cogl-hello test doesn't explicitly
respond to resize events by setting the viewport and cogl-x11-foreign
responds by setting a viewport that is offset by a quarter of the
window's width/height and half the width and height of the window.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit a1a8cc00bfa2cecaf1007aec5f3dd95dc07b1786)