1
0
Fork 0
Commit graph

945 commits

Author SHA1 Message Date
Robert Bragg
d7bbc44235 dist: Make sure to dist cogl-winsys-egl-feature-functions.h
cogl-winsys-egl-feature-functions.h wasn't being listed as source and so
it wasn't ending up in dist tarballs.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 15:40:02 +01:00
Robert Bragg
c3b91da414 fix namespace for cogl_context_egl_get_egl_context
This renames cogl_context_egl_get_egl_context to
cogl_egl_context_get_egl_context to be consistent with other platform
specific APIs.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:02 +01:00
Robert Bragg
09e7174b1d Remove cogl_context_set_default API
For cogl 2.0 we don't want to have a default context. In the meantime
we can simply assume that calling cogl_context_new() implicitly
sets that context as the default context before returning.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:02 +01:00
Robert Bragg
38b67e2884 onscreen: make platform specific onscreen apis consistent
There were several CoglOnscreen functions named like:
cogl_onscreen_<platform>_blah instead of cogl_<platform>_onscreen_blah
so this patch updates those to be consistent with other platform
specific apis we have in cogl.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:01 +01:00
Neil Roberts
b2e735ff7f Dynamically load the GL or GLES library
The GL or GLES library is now dynamically loaded by the CoglRenderer
so that it can choose between GL, GLES1 and GLES2 at runtime. The
library is loaded by the renderer because it needs to be done before
calling eglInitialize. There is a new environment variable called
COGL_DRIVER to choose between gl, gles1 or gles2.

The #ifdefs for HAVE_COGL_GL, HAVE_COGL_GLES and HAVE_COGL_GLES2 have
been changed so that they don't assume the ifdefs are mutually
exclusive. They haven't been removed entirely so that it's possible to
compile the GLES backends without the the enums from the GL headers.

When using GLX the winsys additionally dynamically loads libGL because
that also contains the GLX API. It can't be linked in directly because
that would probably conflict with the GLES API if the EGL is
selected. When compiling with EGL support the library links directly
to libEGL because it doesn't contain any GL API so it shouldn't have
any conflicts.

When building for WGL or OSX Cogl still directly links against the GL
API so there is a #define in config.h so that Cogl won't try to dlopen
the library.

Cogl-pango previously had a #ifdef to detect when the GL backend is
used so that it can sneakily pass GL_QUADS to
cogl_vertex_buffer_draw. This is now changed so that it queries the
CoglContext for the backend. However to get this to work Cogl now
needs to export the _cogl_context_get_default symbol and cogl-pango
needs some extra -I flags to so that it can include
cogl-context-private.h
2011-07-11 12:57:38 +01:00
Neil Roberts
5f181973a6 Move the cogl texture driver functions to a vtable
The texture driver functions are now accessed through a vtable pointed
to by a struct in the CoglContext so that eventually it will be
possible to compile both the GL and GLES texture drivers into a single
binary and then select between them at runtime.
2011-07-08 15:35:51 +01:00
Neil Roberts
59f746d281 cogl-context: Remove the driver private data
Since the GL function pointers have move to the root of CoglContext,
the driver specific data for GLES became empty and the GL data had
only one varible which apparently nothing was using. It's therefore
convenient to remove the private driver data to make it easier to have
a build of Cogl which enables both GL and GLES support. If we ever
need driver private data later we might want to use
cogl_object_set_user_data instead.
2011-07-08 15:35:50 +01:00
Neil Roberts
2b119b07da Use all core GL functions through indirect pointers
cogl-ext-functions.h now contains definitions for all of the core GL
and GLES functions that we would normally link to directly. All of the
code has changed to access them through the cogl context pointer. The
GE macro now takes an extra parameter to specify the context because
the macro itself needs to make GL calls but various points in the Cogl
source use different names for the context variable.
2011-07-08 15:35:46 +01:00
Neil Roberts
dae02a99a5 Move all of the GL function pointers directly to CoglContext
Instead of storing all of the feature function pointers in the driver
specific data of the CoglContext they are now all stored directly in
CoglContext. There is a single header containing the description of
the functions which gets included by cogl-context.h. There is a single
function in cogl-feature-private.c to check for all of these
functions.

The name of the function pointer variables have been changed from
ctx->drv.pf_glWhatever to just ctx->glWhatever.

The feature flags that get set when an extension is available are now
separated from the table of extensions. This is necessary because
different extensions can mean different things on GLES and GL. For
example, having access to glMapBuffer implies read and write support
on GL but only write support on GLES. The flags are instead set in the
driver specific init function by checking whether the function
pointers were successfully resolved.

_cogl_feature_check has been changed to assume the feature is
supported if any of the listed extensions are available instead of
requiring all of them. This makes it more convenient to specify
alternate names for the extension. Nothing else had previously listed
more than one name for an extension so this shouldn't cause any
problems.
2011-07-07 02:05:42 +01:00
Neil Roberts
17a558a386 cogl-pipeline: Fix reference counting on promoting weak parents
When a copy is made of a weak pipeline it tries to promote the weak
parent by taking a reference on that weak pipeline's parent. However
promote_weak_ancestors was instead always taking a reference on the
first parent, regardless of whether it was weak. The corresponding
revert_weak_ancestors function which is supposed to undo the effect of
promote_weak_ancestors only unref'd the parent if was weak. This meant
that any non-weak pipeline copy would end up leaking a reference on
its parent.

This patch changes both functions to have a similar loop. It loops
through all of the parents of the pipeline until it finds one that is
not weak and refs or unrefs the *parent* of that pipeline instead of
the pipeline itself.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2011-07-06 16:52:46 +01:00
Robert Bragg
2f0a20cdb5 cogl-internal: remove COGL_PRIVATE_FEATURE_EGL flags
This removes the unused COGL_PRIVATE_FEATURE_EGL flags since
check_egl_extensions doesn't refer to these flags it uses the
COGL_EGL_WINSYS_FEATURE flags.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-05 14:14:02 +01:00
Robert Bragg
6940114b6e egl: look for EGL_IMAGE_FROM_X11_PIXMAP as winsys feature
instead of looking at the ctx->private_feature_flags to determine if
Cogl supports creating an EGLImage from a X Pixmap we now check the
renderer private features instead since these are what get setup in
check_egl_extensions. The conflicting flags defined in cogl-internal.h
should be removed since they are un-used.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-05 14:10:31 +01:00
Robert Bragg
ffe3788b85 egl: fix tracking of priv features in check_egl_extensions
check_egl_extensions was mistakenly always ORing in the priv flags of
the first feature_data entry instead of referencing the i variable to
index into the array of feature data after determining that an extension
is available.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-05 14:03:48 +01:00
Robert Bragg
a3fa7f5d96 docs: Adds missing cogl_framebuffer syms to reference
This adds a description for the cogl-framebuffer section and adds lots
of missing symbols to the 2.0 reference manual.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
dcb033489e framebuffer: Add _get_XYZ_bits() functions
This exposes the previously internal only
_cogl_framebuffer_get_red/green/blue/alpha_bits() functions as 2.0
experimental API.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
d74cf9de81 matrix: Adds cogl_matrix_is_identity API
This adds a function called cogl_matrix_is_identity that can determine
if a given matrix is an identity matrix or not.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
8bfde524f8 matrix: Flatten cogl-matrix-mesa.[ch] into cogl-matrix.[ch]
It has been overly cumbersome to work with the matrix code ever since we
pulled in the mesa code because we initially kept the mesa and the
original cogl code separate. We have made several updates to the mesa
code since integrating, and the coding style has changed a lot compared
to the original mesa code, so there's little point in keeping the two
files separate any longer.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
ee237be285 matrix-mesa: move to _cogl_matrix namespace
Instead of having everything in cogl-matrix-mesa.[ch] be in the
_math namespace this now puts them in the _cogl_matrix namespace
instead, in preparation for flattening cogl-matrix-mesa.[ch] into
cogl-matrix.[ch].

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
7b747cff01 matrix-mesa: remove unused macros functions and cruft
The aim is to flatten cogl-matrix-mesa.[ch] code back into
cogl-matrix.[ch] and removing cruft first makes sense. This removes
several un-used macros and vector related functions and also replaces
the use of doxygen style comment markup with the gtk-doc style we use
throughout the reset of cogl.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Neil Roberts
b9b41723c1 cogl-pipeline: Use BSD lists for the list of pipeline children
Instead of having a separate GList for the children we can use the
linked list code from FreeBSD and store the list node directly in the
struct. That way we can avoid having a separate slice allocation for
the list node. It also means that we effectively have a pointer to the
list node given a pointer to the pipeline node. That means we can
unparent a pipeline without having to walk the entire list of
children. With this change there is no need to have the optimisation
to fast track a pipeline that only has one child which simplifies the
code somewhat.

With this patch we are removing a pointer and a gboolean from the
CoglPipeline struct and adding two pointers. On 32-bit architectures
this should end up exactly the same size because a gboolean is the
same size as a pointer. On 64-bit architectures I think it should end
up 4 bytes smaller because it also ends up removing two cases where a
pointer follows a gboolean which presumably would mean the compiler
would have to insert 4 bytes of padding to keep the pointer aligned to
8 bytes.

https://bugzilla.gnome.org/show_bug.cgi?id=652514
2011-07-01 17:58:59 +01:00
Neil Roberts
7b50c38cc8 cogl-queue: Make suitable for use in Cogl source code
This modifies cogl-queue.h so that:-

- Everything is in a COGL_* namespace

- It assumes there is a typedef for all of the types instead of
  requiring the code to use struct WhateverType.

- It doesn't contain any tabs

https://bugzilla.gnome.org/show_bug.cgi?id=652514
2011-07-01 17:52:55 +01:00
Neil Roberts
17c9cb8d49 Add the code from FreeBSD for their linked-list/queue implementation
This directly copies in the header from the FreeBSD kernel for their
linked-list implementation. A later patch will modify it but this
patch is here so we can have a clear patch to show what the
changes are.

Using the list implementation from this header is beneficial as
opposed to using GList because it's possible to embed the list
pointers directly into another struct. This saves a separate
allocation and it also makes it possible to remove an item from the
list without having to iterate the entire list to find its list
node. The header provides four different list types: single and
doubley linked lists and each of them can either have a header with
pointers to the beginning and end or just to the beginning. Glib
effectively only provides single and doubley linked lists with a
pointer to the beginning or a doubley-linked list with a pointer to
both (GQueue).

https://bugzilla.gnome.org/show_bug.cgi?id=652514
2011-07-01 17:52:55 +01:00
Neil Roberts
a517242087 gles: Fix the name of the GLeglImageOES type
The function declarations for the GL_OES_EGL_image extension were
using the wrong name for the GLeglImageOES type so it was getting
build errors when compiling for GLES.
2011-07-01 14:30:59 +01:00
Robert Bragg
f0366907d3 build: egl fix typo introduced by 3b64a439f0
The XEvent argument for event_filter_cb was named "event" but the rest
of the function is expecting a variable named "xevent".
2011-06-30 15:00:58 +01:00
Robert Bragg
5dff6f6aa1 renderer: split win32 api out into separate header
This adds a cogl-win32-renderer.h for the win32 specific cogl-renderer
API instead of having #ifdef guards in cogl-renderer.h

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:46 +01:00
Robert Bragg
cd6e1d183d Updates wayland symbol names to be consistent
This updates the public wayland symbols to follow the pattern
cogl_wayland_blah instead of cogl_blah_wayland.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:46 +01:00
Robert Bragg
89562dda73 work towards consistent platform file/symbol naming
we've got into a bit of a mess with how we name platform specific
symbols and files, so this is a first pass at trying to tidy that up.

All platform specific symbols should be named like
cogl_<platform>_symbol_name and similarly files should be named like
cogl-<platform>-filename.c

This patch tackles the X11 specific renderer/display APIs as a start.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:34:33 +01:00
Robert Bragg
3b64a439f0 replace public native_event APIs with typesafe APIs
This adds Xlib and Win32 typesafe replacements for
cogl_renderer_handle_native_event, cogl_renderer_add_native_filter,
cogl_renderer_remove_native_filter. The old functions are kept as an
implementation detail so we can share code.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:13 +01:00
Robert Bragg
f0a28f4287 attribute: cleanup some sentinel array left over logic
It used to be that we passed around NULL terminated arrays of
attributes, but since 3c1e83c7f we now explicitly pass an n_attributes
count instead. There were some leftovers of the old approach in the
cogl_vdraw_[indexed]_attributes functions and also there was an
off-by-one error with the n_attributes values passed on which was
causing crashes.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:13 +01:00
Robert Bragg
098a193802 pipeline: Avoid reseting texture target for NULL textures
When setting a NULL texture on a CoglPipeline we would also reset the
texture target to a dummy value of 0. Reseting the target also had the
effect of making fragends discard any associated program. In cases where
the NULL texture was only transient until a replacement texture could be
set we were re-running lots of redundant codegen and shader
compilations.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:13 +01:00
Robert Bragg
256274bfcc pipeline: fix layer change notify mutex rule
There is a documented rule that layer changes should only be notified to
the fragend once; either as a pipeline change or as a layer change. When
the number of layers associated with a material changes then that should
get notified against the pipeline. All other layer changes get notified
against the layer.

There was a mistake in the _cogl_pipeline_add/remove_layer_difference
functions, in that we weren't using the 'inc/dec_n_layers' boolean to
determine if the fragend should be notified of the change.

It was also noticed that the logic of _cogl_pipeline_prune_to_n_layers
would also break this rule, by failing to notify some changes at all.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:13 +01:00
Robert Bragg
b9d7181f03 buffer: Improve the CoglBuffer API description
This improves the gtk-doc overview for the CoglBuffer interface.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:12 +01:00
Robert Bragg
b3a105c576 renderer: Expose winsys ID setter/getters
This adds API to let you override the choice of Cogl's winsys backend.
Previously it was only possible to override the winsys using the
COGL_RENDERER environment variable, but it's useful for something like
Clutter to be able to control the winsys via API without needing
environment variable tricks. This also adds API to query back the
winsys chosen by Cogl, in case you don't set an explicit override.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:11 +01:00
Robert Bragg
c4eb869bd7 framebuffer: expose viewport getters/setters
This exposes experimental cogl_framebuffer APIs for getting and setting
a viewport without having to refer to the implicit CoglContext. It adds
the following experimental API:

  cogl_framebuffer_set_viewport
  cogl_framebuffer_get_viewport4fv
  cogl_framebuffer_get_viewport_x
  cogl_framebuffer_get_viewport_y
  cogl_framebuffer_get_viewport_width
  cogl_framebuffer_get_viewport_height

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:11 +01:00
Robert Bragg
a1234ee8d1 Add internal _cogl_init() function
This adds a _cogl_init function for Cogl that we expect to be the first
thing called before anything else is done with Cogl. It's not a public
API so it's expected that all entry points for Cogl that might be the
first function used should call _cogl_init().

We currently call _cogl_init() in these functions:
  cogl_renderer_new
  cogl_display_new
  cogl_context_new
  cogl_android_set_native_window

_cogl_init() can be called multiple times, and only the first call has
any affect.

For example _cogl_init() gives us a place check and parse the COGL_DEBUG
environment variable.

Since we don't have any need to parse command line arguments (we can
always get user configuration options from the environment) our init
function doesn't require argc/argv pointers.

By saying up front that we aren't interested in command line arguments
that means we can avoid the mess that is GOption based library
initialization which is extremely fragile due to its lack of dependency
tracking between modules.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:11 +01:00
Adam Jackson
5496a6464d Typo fix in cogl-framebuffer
Signed-off-by: Adam Jackson <ajax@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=652672
2011-06-16 00:27:13 +01:00
Robert Bragg
57d76e315f Fixes for make distcheck 2011-06-14 17:09:55 +01:00
Robert Bragg
036c5bf572 include required cogl-context.h in cogl-texture-2d.h 2011-06-14 17:09:55 +01:00
Robert Bragg
7a0a4de691 Fix some gtk-doc annotations in cogl-depth-state.h 2011-06-14 17:09:55 +01:00
Robert Bragg
800f5e6d6e profile: Adds a --enable-profile option
This adds a --enable-profile option which enables uprof based profiling.
It was also necessary to fixup a CLUTTER_ENABLE_PROFILING #ifdef in
cogl-context.c to renamed COGL_ENABLE_PROFILING instead. By default Cogl
doesn't output uprof reports directly, instead it assumes a higher level
toolkit will output a report. If you want a report from Cogl you can
export COGL_PROFILE_OUTPUT_REPORT=1 before running your app.

The latest version of uprof can be fetched from:
git://github.com/rib/UProf.git
2011-06-14 17:09:55 +01:00
Robert Bragg
3729bf2769 Make it clearer that the 2.0 API is experimental
This explicitly renames the cogl-2.0 reference manual to
cogl-2.0-experimental and renames the cogl-2.0 pkg-config file to
cogl-2.0-experimental.pc. Hopefully this should avoid
miss-understandings.
2011-06-14 17:09:55 +01:00
Neil Roberts
e86543cd7d Revert "Do not use "near" and "far" variables"
This reverts commit 3d2564df8f.

Since 01e1260aa the 'near' and 'far' defines are now undef'd on
Windows so we no longer have to remember not to use them in Cogl code.
2011-06-14 14:40:27 +01:00
Lionel Landwerlin
5dc42284a5 cogl-debug: add instrumentation to track the number of objects
This allows to track the number of objects allocated by Cogl. The
results are displayed on the standard output by calling :

cogl_debug_print_instances ();

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-14 12:14:02 +01:00
Robert Bragg
c603dc67ca cogl-vertex-buffer: make sure to unref weak pipelines
When validating a user pipeline before drawing with a CoglVertexBuffer
we sometimes find we have to make some overrides and we handle that by
creating a pipeline which is a weak copy of the user pipeline. The weak
pipeline gets associated with the original pipeline so if that pipeline
is used multiple times then we can re-use the same override pipeline and
skip validation. Because it's a weak pipeline we get notified when the
original material is destroyed or changed so we know our weak pipeline
is now invalid.

When we get notified that the weak material is invalid we should unref
it, but instead we were just discarding our reference to it. This was
resulting in leaking weak materials and in some cases those materials
referenced textures which would then also be leaked.
2011-06-13 17:48:23 +01:00
Emmanuele Bassi
3d2564df8f Do not use "near" and "far" variables
They collide with existing symbols when compiling on Windows.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2667
2011-06-13 12:05:41 +01:00
Neil Roberts
6d1371e0e9 cogl-texture-pixmap-x11: Fix the can_hardware_repeat wrapper
The wrapper for the can_hardware_repeat had a cut and paste error so
it would call the wrong function on the child texture.

Many thanks to Owen Taylor for finding this bug.
2011-06-10 18:43:56 +01:00
Emmanuele Bassi
552761f3a8 Remove G_CONST_RETURN
It is going to be deprecated by GLib, see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-06-09 16:21:15 +01:00
Neil Roberts
c3c0804819 Implement COGL_DEBUG=disable-texturing for ARBFp and GLSL fragends
The COGL_DEBUG=disable-texturing debug variable disables texturing in
the fixed function fragend by not bothering to enable the texture
targets. This wasn't working for the programmable fragends because the
texture targets don't need to be enabled to use them. This patch
modifies the two programmable backends to generate a constant value
for the texture lookups in the shader when the debug variable is
given.
2011-06-08 18:03:58 +01:00
Robert Bragg
bbfe8b8ec4 gir: pass dep cflags to gobject introspection scanner
The gobject introspection scanner was failing to find EGL headers so we
now pass the COGL_DEP_CFLAGS to Cogl_1_0_gir_CFLAGS.
2011-06-01 20:44:43 +01:00
Robert Bragg
5022ec54d2 replace _xlib_add_filter use with _cogl_renderer API
Instead of using _cogl_xlib_add/remove_filter we now use
_cogl_renderer_add/remove_native_filter. The _cogl_xlib_add_filter API
was only required as a stop gap while EGL support was still in Clutter
because in that case we were using the stub winsys and didn't have a
CoglRenderer.
2011-06-01 20:44:42 +01:00