1
0
Fork 0
Commit graph

12 commits

Author SHA1 Message Date
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
Emmanuele Bassi
34b5352bb5 [cogl] Generate enumeration GTypes
COGL is starting to have more enumerations than I can handle
by hand. Let's use glib-mkenums and be done with it.
2009-05-29 12:31:47 +01:00
Emmanuele Bassi
c56d5b1468 [cogl] Remove max_waste argument from Texture ctors
The CoglTexture constructors expose the "max-waste" argument for
controlling the maximum amount of wasted areas for slicing or,
if set to -1, disables slicing.

Slicing is really relevant only for large images that are never
repeated, so it's a useful feature only in controlled use cases.
Specifying the amount of wasted area is, on the other hand, just
a way to mess up this feature; 99% the times, you either pull this
number out of thin air, hoping it's right, or you try to do the
right thing and you choose the wrong number anyway.

Instead, we can use the CoglTextureFlags to control whether the
texture should not be sliced (useful for Clutter-GST and for the
texture-from-pixmap actors) and provide a reasonable value for
enabling the slicing ourself. At some point, we might even
provide a way to change the default at compile time or at run time,
for particular platforms.

Since max_waste is gone, the :tile-waste property of ClutterTexture
becomes read-only, and it proxies the cogl_texture_get_max_waste()
function.

Inside Clutter, the only cases where the max_waste argument was
not set to -1 are in the Pango glyph cache (which is a POT texture
anyway) and inside the test cases where we want to force slicing;
for the latter we can create larger textures that will be bigger than
the threshold we set.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-05-23 19:35:19 +01:00
Robert Bragg
869a2b4167 [cogl-offscreen] Cleans up the cogl offscreen API and adds documentation
There were several functions I believe no one is currently using that were
only implemented in the GL backend (cogl_offscreen_blit_region and
cogl_offscreen_blit) that have simply been removed so we have a chance to
think about design later with a real use case.

There was one nonsense function (cogl_offscreen_new_multisample) that
sounded exciting but in all cases it just returned COGL_INVALID_HANDLE
(though at least for GL it checked for multisampling support first!?)
it has also been removed.

The MASK draw buffer type has been removed. If we want to expose color
masking later then I think it at least would be nicer to have the mask be a
property that can be set on any draw buffer.

The cogl_draw_buffer and cogl_{push,pop}_draw_buffer function prototypes
have been moved up into cogl.h since they are for managing global Cogl state
and not for modifying or creating the actual offscreen buffers.

This also documents the API so for example desiphering the semantics of
cogl_offscreen_new_to_texture() should be a bit easier now.
2009-05-02 04:12:26 +01:00
Robert Bragg
7e9685294e [cogl] Updates all file headers and removes lots of trailing white space
Adds missing notices, and ensures all the notices are consistent. The Cogl
blurb also now reads:

 * Cogl
 *
 * An object oriented GL/GLES Abstraction/Utility Layer
2009-05-02 04:12:25 +01:00
Robert Bragg
ed272213f0 [cogl-handle] Optimize how we define cogl handles
The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.

This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.

Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.

Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.
2009-04-02 11:58:43 +01:00
Emmanuele Bassi
d176e16b4b Remove usage of the grave accent as quotation mark
See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.
2009-03-17 14:13:31 +00:00
Havoc Pennington
11349b6c74 Virtualize GL matrix operations and use a client-side matrix when GL is indirect
This is useful because sometimes we need to get the current matrix, which
is too expensive when indirect rendering.

In addition, this virtualization makes it easier to clean up the API in
the future.
2009-03-12 18:32:45 +00:00
Emmanuele Bassi
84229fa13c [cogl-fixed] Implement the CoglFixed fundamental GType
The type machinery for CoglFixed should be implemented by COGL
itself, now that COGL exports the GType of its types.

This allows moving most of what ClutterFixed did directly to
CoglFixed where it belongs.
2009-03-10 12:38:03 +00:00
Jonathan Matthew
ee3647f84d Declare the EnumValues for PixelFormat static
Bug 1473 - CoglPixelFormat enum data must be declared static

When registering an enumeration GType, the GEnumValue or GFlagsValue
arrays must be declared static; otherwise, you get a segmentation
fault when calling the function again.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-02-24 09:29:08 +00:00
Emmanuele Bassi
1d79e173bb [cogl] Provide GTypes for COGL types
COGL types should be registered inside the GType system, for
bindings and type checking inside properties and signals.

CoglHandle is a boxed type with a ref+unref semantics; slightly evil
from a bindings perspective (we cannot associate custom data to it),
but better than nothing.

The rest of the exposed types are enumerations or bitmasks.
2009-02-19 12:02:42 +00:00
Neil Roberts
eff57a1cb0 Merged clutter-ivan branch into trunk.
svn merge \
 https://svn.o-hand.com/repos/clutter/trunk/clutter@2509 \
 https://svn.o-hand.com/repos/clutter/branches/clutter-ivan@HEAD
2008-04-25 13:37:36 +00:00