The surfaceless context extension can be used to bind a context
without a surface. We can use this to avoid creating a dummy surface
when the CoglContext is first created. Otherwise we have to have the
dummy surface so that we can bind it before the first onscreen is
created.
The main awkward part of this patch is that theoretically according to
the GL and GLES spec if you first bind a context without a surface
then the default state for glDrawBuffers is GL_NONE instead of
GL_BACK. In practice Mesa doesn't seem to do this but we need to be
robust against a GL implementation that does. Therefore we track when
the CoglContext is first used with a CoglOnscreen and force the
glDrawBuffers state to be GL_BACK.
There is a further awkward part in that GLES2 doesn't actually have a
glDrawBuffers state but GLES3 does. GLES3 also defaults to GL_NONE in
this case so if GLES3 is available then we have to be sure to set the
state to GL_BACK. As far as I can tell that actually makes GLES3
incompatible with GLES2 because in theory if the application is not
aware of GLES3 then it should be able to assume the draw buffer is
always GL_BACK.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit e5f28f1e75db9bdc4f2688f420a74f908f96cf76)
Conflicts:
cogl/winsys/cogl-winsys-egl-kms.c
cogl/winsys/cogl-winsys-egl-x11.c
Some features that were previously available as an extension in GLES2
are now in core in GLES3 so we should be able to specify that with the
gles_availability mask of COGL_EXT_BEGIN so that GL implementations
advertising GLES3 don't have to additionally advertise the extension
for us to take advantage of it.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit 4d892cd97558da61ba526f947ac0555ebab632d2)
Currently, due to the way that Visual Studio 2010+ projects are handled,
the "install" project does not re-build upon changes to the sources, as it
does not believe that its dependencies have changed, although the changed
sources are automatically recompiled. This means that if a part or more
of the solution does not build, or if the sources need some other fixes
or enhancements, the up-to-date build is not copied automatically, which
can be misleading.
Improve on the situation by forcing the "install" project to trigger its
rebuild, so that the updated binaries can be copied. This does trigger an
MSBuild warning, but having that warning is way better than not having an
up-to-date build, especially during testing and development.
When a new CoglAtlasTexture tries to fit into an existing CoglAtlas
it should make sure the atlas stays valid while it expands.
https://bugzilla.gnome.org/show_bug.cgi?id=728064
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 2eec9758f67e9073371c2edd63379324849373c4)
This can happen when we dpms off the output or when login1 takes away
drm master status from our drm fd. In either case, we need to call
the swap notify handler so that the compositor dosn't get stuck waiting
for that notification. The compositor should stop repainting shortly in
both cases, as it's either going into dpms off mode or vt switching away.
https://bugzilla.gnome.org/show_bug.cgi?id=728979
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This environment variable predates the reliable platform detection in mesa
and typically just causes crashes when the specified platform doesn't
match what's passed in. Aside from being unecessary and problematic
it also leaks into the GNOME session, preventing clients from
automatically detecting the wayland platform.
https://bugzilla.gnome.org/show_bug.cgi?id=728978
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Prevent Cogl function names from being mangled when a C++ compiler is
being used by adding some missing COGL_{BEGIN,END}_DECLS guards.
https://bugzilla.gnome.org/show_bug.cgi?id=728628
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Commit 1b2dd815 (Registers gtypes for all public objects and structs)
introduced GCCism's in its use of varargs, which broke the build of Cogl
on other non-GCC compilers, such as Visual Studio.
Define the COGL_GTYPE_DEFINE_BASE_CLASS and COGL_GTYPE_DEFINE_CLASS macros
using ISO-style varargs so that the build of Cogl can be fixed on non-GCC
compilers.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Cogl, when built with the SDL winsys, includes the SDL headers in its
headers, which causes main() to be defined to SDL's main() wrapper on
Windows, which means that SDL2.lib and SDL2main.lib need to be linked to
every single program that links to Cogl with the SDL winsys.
Avoid this behavior by defining SDL_MAIN_HANDLED in the CFLAGS of the
sample and test programs, and let people know that this is the case.
Remove #pragma directives that causes any applications that use Cogl to
link to the SDL libraries when Cogl was built with the SDL winsys. This is
mainly due to the availability of both SDL-1.x and SDL-2.x support in the
SDL winsys, where different libraries are linked for SDL-1.x and SDL-2.x.
To avoid having to link to the SDL/SDL2 libraries when the application code
is not directly using SDL/SDL2, define SDL_MAIN_HANDLED in the CFLAGS so
that SDL's wrapper main() implementation will not be used when the
application is being built.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit c3035912833eabe1f6dadbea23c78e595aac79dc)
In Lionel's work for supporting introspection better for Cogl, a number of
public symbols were added for Cogl and Cogl-Path, so add these symbols to
cogl.symbols and cogl-path.symbols so that they can be exported, which will
fix the build of the Cogl conformance test and the introspection files
for the Windows-based builds.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Let people know that for Visual Studio builds GLib is a hard requirement,
and let the people also know that SDL-2.x is now used for builds supporting
the SDL winsys. Also let people know that current situation regarding
building and linking Cogl applications with the SDL winsys built in.
On 64-bit fedora the 32-bit MinGW compiler is called
i686-w64-mingw32-gcc which wasn't being picked up by the
mingw-fetch-depdencies script.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit f5f0342315e524523c50549e91eb9ff1683ab558)
This macro is internal to gobject so using it risks breaking Cogl if
glib changes its API. Instead we just use its expansion. Note that
glib provides two expansions for this depending on the glib version
but this only uses the one for older versions.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
cogl_gst_video_sink_get_natural_size was using g_return_val_if_fail
but its return type is void. For some reason GCC doesn't complain
about this but it causes a compile error on clang.
The pkg-config file might not necessarily be installed yet so I don't
think it makes sense to try and include it when running g-ir-scanner.
Presumably it should pick up the headers from source directory instead
of the installed directory. It seems to build without this patch so
let's just revert it.
This reverts commit d9c8570f14.
This adds much more comprehensive support for gobject-introspection
based bindings by registering all objects as fundamental types that
inherit from CoglObject, and all structs as boxed types.
Co-Author: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
The private header is needed as the cogl_texture_get_format API was made
private, so that C4013 (implicit declaration of ...) warnings/errors can
be avoided
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Remove the symbols that are now in cogl-path (where cogl-path.symbols
already include), and add the symbols that were added to the Cogl API.
Also add internal symbols as required by cogl-path and cogl-pango.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
The DriverCallback is a function that is defined by the Windows SDK 8.0+
headers, which was initially used for device driver development. The use
of DriverCallback would cause a clash, causing things to break when built
with newer Windows SDKs, so rename DriverCallback to CoglDriverCallback to
avoid this problem.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
In commit 1b83ef938f the license in the plugin description was changed
from “LGPL” to “MIT”. GStreamer strictly whitelists the names of the
licenses and the correct name for the MIT license is “MIT/X11” so it
was rejecting the plugin.
Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit ceec0bddb858588c1f04c50dd6cbda9eb044c4cc)
To help facilitate integration with third party frameworks this exposes
the EGL context and display to applications as well as the GLX context.
(Note that the GLX display is already available via
cogl_xlib_renderer_get_display())
This adds a new top-level <cogl/cogl-glx.h> header that needs to be
included explicitly to access the glx specific api.
Anyone using these apis will be responsible for checking that Cogl
is indeed using EGL or GLX by calling cogl_renderer_get_winsys_id()
This will enable GStreamer, for example, to be able to create a GL
context that shares resources with Cogl's context.
https://bugzilla.gnome.org/show_bug.cgi?id=724992
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This splits out the GLeglImageOES define in cogl-egl.h into a private
cogl-egl-private.h header and updates the guards in cogl-egl.h to be
consistent with other top-level headers where we need to be careful
about how __COGL_H_INSIDE__ is defined and undefined, esp when the
gobject introspection scanner is running.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This ensures we use EGLNativeWindowType and EGLNativeDisplayType
everywhere instead. The previous names come from EGL 1.2 but it seems
reasonable to require more recent EGL versions. If someone wanted to add
compatibility for EGL 1.2 later it would be straightforward to define
the new names to the old.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
SDL2 supports selecting between full OpenGL or OpenGL ES 1/2 but our
selection code was written before SDL 2.0 was officially released and
since then a new SDL_GL_CONTEXT_PROFILE_MASK attribute was added and
we have to explicitly set the SDL_GL_CONTEXT_MINOR_VERSION attribute.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds api for querying a "natural" width and height for a video
which has the correct aspect ratio for displaying on square, 1:1 pixels.
The natural size is the minimum size where downscaling is not required.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Since we don't generate a mipmap chain for uploaded video frames this
avoids setting the min filter to COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR.
Since COGL_PIPELINE_FILTER_LINEAR is the default and since it is also
dubious that cogl-basic-video-player is directly manipulating layers
that are conceptually internal to cogl-gst this removes the loop that
updates the filtering for cogl-gst layers.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This makes sure video textures being uploaded via
video_texture_new_from_data are allocated before the function returns.
This function create a CoglBitmap to wrap the data from gstreamer and by
allowing cogl to allocate the texture lazily it's possible that the data
being pointed to by the bitmap won't remain valid until we actually come
to allocate the texture.
Note: we don't simply use cogl_texture_2d_[sliced_]new_from_data() here
because we need to be able to call cogl_texture_set_premultiplied()
before allocating the texture.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds a new COGL_FEATURE_ID_BUFFER_AGE feature id that can be used
to determine if cogl_onscreen_get_buffer_age() will ever return an age
other than 0. This should be used instead of querying the winsys feature
via cogl_clutter_winsys_has_feature().
Reviewed-by: Neil Roberts <neil@linux.intel.com>
We have an #ifdef EGL_WL_bind_wayland_display guard in
cogl-winsys-egl-feature-functions.h to avoid referencing wayland types
when the EGL header doesn't know about them, but somehow this guard also
ended up around the KHR_create_context and EXT_buffer age features too
even though they aren't wayland specific.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This winsys feature flag is exposed via the deprecated
cogl_clutter_winsys_has_feature function and Clutter is curently
relying on it. Previously the EGL winsys was only setting the internal
COGL_EGL_WINSYS_FEATURE_BUFFER_AGE flag and there was no mapping to
the public flag. Therefore the feature would only be used on GLX. This
patch just adds the mapping.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 8418e98b2b1b25515a961ad1bb9f0c4770d6eb1d)
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7bc7ea4cb5e8134a3aeed9615477f4152b558509)
Conflicts:
cogl/winsys/cogl-winsys-egl-kms.c
Instead of spinning forever, do a roundtrip, which guarantees that the
global messages have been sent by the time we read the sync message.
If the proper globals aren't initialized yet, error out immediately. This
does mean that users can't use CoglOnscreen with foreign custom surface
types without xdg_shell, but when a use case comes for this, we'll
investigate then...
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit af9057d35f331e2c9509958fb40627917c477b80)
This adds a PlatformToolset tag in order to make upgrading the projects to
Visual Studio 2012/2013 formats easier, especially when done with a script.
The script, for example, can change the value inside these tags
apporpriately to do the upgrade job quite easily.