Commit Graph

9 Commits

Author SHA1 Message Date
Robert Bragg
b72f255c0a Start to reduce dependence on glib
Since we've had several developers from admirable projects say they
would like to use Cogl but would really prefer not to pull in
gobject,gmodule and glib as extra dependencies we are investigating if
we can get to the point where glib is only an optional dependency.
Actually we feel like we only make minimal use of glib anyway, so it may
well be quite straightforward to achieve this.

This adds a --disable-glib configure option that can be used to disable
features that depend on glib.

Actually --disable-glib doesn't strictly disable glib at this point
because it's more helpful if cogl continues to build as we make
incremental progress towards this.

The first use of glib that this patch tackles is the use of
g_return_val_if_fail and g_return_if_fail which have been replaced with
equivalent _COGL_RETURN_VAL_IF_FAIL and _COGL_RETURN_IF_FAIL macros.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Neil Roberts
14e94647bf cogl-util: Add an internal wrapper for the ffs function
The ffs function is defined in C99 so if we want to use it in Cogl we
need to provide a fallback for MSVC. This adds a configure check for
the function and then a fallback using a while loop if it is not
available.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2491
2011-01-10 16:55:00 +00:00
Robert Bragg
046434e222 pipeline: Implements _cogl_pipeline_hash function
This allows us to get a hash for a set of state groups for a given
pipeline. This can be used for example to get a hash of the fragment
processing state of a pipeline so we can implement a cache for compiled
arbfp/glsl programs.
2010-12-07 16:00:32 +00:00
Neil Roberts
583d5cc79f cogl: Make cogl_util_next_p2 internal and fix the documentation
cogl_util_next_p2 is declared in cogl-util.h which is a private header
so it shouldn't be possible for an application to use it. It's
probably not a function we'd like to export from Cogl so it seems
better to keep it private. This patch renames it to _cogl_util_next_p2
so that it won't be exported from the shared library.

The documentation for the function is also slightly wrong because it
stated that the function returned the next power greater than
'a'. However the code would actually return 'a' if it's already a
power of two. I think the actual behaviour is more useful so this
patch changes the documentation rather than the code.
2010-09-15 15:01:43 +01:00
Neil Roberts
c3489a0a22 Move _cogl_texture_2d_is_pot to cogl-util.h
This function could be used in many places in Cogl so it makes sense
to share it in cogl-util.h as _cogl_util_is_pot().
2010-07-13 14:28:35 +01:00
Emmanuele Bassi
72f4ddf532 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Neil Roberts
1d54ecb8a1 cogl-clip-stack: Round the coords when clipping to a window rect
The size and position of the window rectangle for clipping in
try_pushing_rect_as_window_rect is calculated by projecting the
rectangle coordinates. Due to rounding errors, this can end up with
slightly off numbers like 34.999999. These were then being cast
directly to an integer so it could end up off by one.

This uses a new macro called COGL_UTIL_NEARBYINT which is a
replacement for the C99 nearbyint function.
2010-02-17 16:12:47 +00:00
Neil Roberts
f74f4bdc2b cogl: Add a fallback for when the signbit macro is missing
The signbit macro is defined in C99 so it should be available but some
versions of GCC don't appear to define it by default. If it's not
available we can use a hack to test the bit directly.
2010-02-11 15:59:53 +00:00
Robert Bragg
0bce7eac53 Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.

Currently this is the structure I'm aiming for:
cogl/
    cogl/
	<put common source here>
	winsys/
	   cogl-glx.c
	   cogl-wgl.c
	driver/
	    gl/
	    gles/
	os/ ?
    utils/
	cogl-fixed
	cogl-matrix-stack?
        cogl-journal?
        cogl-primitives?
    pango/

The new winsys component is a starting point for migrating window system
code (i.e.  x11,glx,wgl,osx,egl etc) from Clutter to Cogl.

The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.

Overview of the planned structure:

* The winsys/ API is the API that binds OpenGL to a specific window system,
  be that X11 or win32 etc.  Example are glx, wgl and egl. Much of the logic
  under clutter/{glx,osx,win32 etc} should migrate here.

* Note there is also the idea of a winsys-base that may represent a window
  system for which there are multiple winsys APIs.  An example of this is
  x11, since glx and egl may both be used with x11.  (currently only Clutter
  has the idea of a winsys-base)

* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
  representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
  GLES 1.1 (fixed funciton) and 2.0 (fully shader based)

* Everything under cogl/ should fundamentally be supporting access to the
  GPU.  Essentially Cogl's most basic requirement is to provide a nice GPU
  Graphics API and drawing a line between this and the utility functionality
  we add to support Clutter should help keep this lean and maintainable.

* Code under utils/ as suggested builds on cogl/ adding more convenient
  APIs or mechanism to optimize special cases. Broadly speaking you can
  compare cogl/ to OpenGL and utils/ to GLU.

* clutter/pango will be moved to clutter/cogl/pango

How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"

Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps

As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
2009-10-16 18:58:50 +01:00