Commit Graph

6160 Commits

Author SHA1 Message Date
Robert Bragg
aa1a2cb661 Adds renderer,display,onscreen-template and swap-chain stubs
As part of the process of splitting Cogl out as a standalone graphics
API we need to introduce some API concepts that will allow us to
initialize a new CoglContext when Clutter isn't there to handle that for
us...

The new objects roughly in the order that they are (optionally) involved
in constructing a context are: CoglRenderer, CoglOnscreenTemplate,
CoglSwapChain and CoglDisplay.

Conceptually a CoglRenderer represents a means for rendering.  Cogl
supports rendering via OpenGL or OpenGL ES 1/2.0 and those APIs are
accessed through a number of different windowing APIs such as GLX, EGL,
SDL or WGL and more. Potentially in the future Cogl could render using
D3D or even by using libdrm and directly banging the hardware. All these
choices are wrapped up in the configuration of a CoglRenderer.

Conceptually a CoglDisplay represents a display pipeline for a renderer.
Although Cogl doesn't aim to provide a detailed abstraction of display
hardware, on some platforms we can give control over multiple display
planes (On TV platforms for instance video content may be on one plane
and 3D would be on another so a CoglDisplay lets you select the plane
up-front.)

Another aspect of CoglDisplay is that it lets us negotiate a display
pipeline that best supports the type of CoglOnscreen framebuffers we are
planning to create. For instance if you want transparent CoglOnscreen
framebuffers then we have to be sure the display pipeline wont discard
the alpha component of your framebuffers. Or if you want to use
double/tripple buffering that requires support from the display
pipeline.

CoglOnscreenTemplate and CoglSwapChain are how we describe our default
CoglOnscreen framebuffer configuration which can affect the
configuration of the display pipeline.

The default/simple way we expect most CoglContexts to be constructed
will be via something like:

 if (!cogl_context_new (NULL, &error))
   g_error ("Failed to construct a CoglContext: %s", error->message);

Where that NULL is for an optional "display" parameter and NULL says to
Cogl "please just try to do something sensible".

If you want some more control though you can manually construct a
CoglDisplay something like:

 display = cogl_display_new (NULL, NULL);
 cogl_gdl_display_set_plane (display, plane);
 if (!cogl_display_setup (display, &error))
   g_error ("Failed to setup a CoglDisplay: %s", error->message);

And in a similar fashion to cogl_context_new() you can optionally pass
a NULL "renderer" and/or a NULL "onscreen template" so Cogl will try to
just do something sensible.

If you need to change the CoglOnscreen defaults you can provide a
template something like:
  chain = cogl_swap_chain_new ();
  cogl_swap_chain_set_has_alpha (chain, TRUE);
  cogl_swap_chain_set_length (chain, 3);

  onscreen_template = cogl_onscreen_template_new (chain);
  cogl_onscreen_template_set_pixel_format (onscreen_template,
                                           COGL_PIXEL_FORMAT_RGB565);

  display = cogl_display_new (NULL, onscreen_template);
  if (!cogl_display_setup (display, &error))
    g_error ("Failed to setup a CoglDisplay: %s", error->message);
2011-04-11 17:54:35 +01:00
Robert Bragg
a90862929b rename winsys files to be more consistent
This tries to make the naming style of files under cogl/winsys/
consistent with other cogl source files. In particular private header
files didn't have a '-private' infix.
2011-04-11 17:54:35 +01:00
Robert Bragg
532b563439 Add temporary cogl-clutter.h to aid splitting out Cogl
This gives us a way to clearly track the internal Cogl API that Clutter
depends on. The aim is to split Cogl out from Clutter into a standalone
3D graphics API and eventually we want to get rid of any private
interfaces for Clutter so its useful to have a handle on that task.
Actually it's not as bad as I was expecting though.
2011-04-11 17:54:35 +01:00
Robert Bragg
8557bc3d26 actor: visualize culling with CLUTTER_PAINT=redraws
This extends visualization for CLUTTER_PAINT=redraws so it now also
draws outlines for actors to show how they are being culled. Actors get
a green outline if they are fully inside the clip region, blue if fully
outside and greeny-blue if only partially inside.
2011-04-11 17:54:35 +01:00
Robert Bragg
c739cb2809 stage: adds internal_get_active_framebuffer API
This adds an internal _clutter_stage_get_active_framebuffer function
that can be used to get a pointer to the current CoglFramebuffer pointer
that is in use, in association with a given stage.

The "active" infix in the function name is there because we shouldn't
assume that a stage will always correspond to only a single framebuffer
so we aren't getting a pointer to a sole framebuffer, we are getting
a pointer to the framebuffer that is currently in use/being painted.

This API is now used for culling purposes where we need to check if we
are currently painting an actor to a framebuffer that is offscreen, that
doesn't correspond to the stage.
2011-04-11 15:28:53 +01:00
Robert Bragg
997ea0fdee framebuffer: expose experimental cogl_get_draw_framebuffer
This renames the two internal functions _cogl_get_draw/read_buffer
as cogl_get_draw_framebuffer and _cogl_get_read_framebuffer. The
former is now also exposed as experimental API.
2011-04-11 15:28:53 +01:00
Robert Bragg
dc5aa31429 framebuffer: track context as CoglFramebuffer member
The long term goal with the Cogl API is that we will get rid of the
default global context. As a step towards this, this patch tracks a
reference back to the context in each CoglFramebuffer so in a lot of
cases we can avoid using the _COGL_GET_CONTEXT macro.
2011-04-11 15:28:47 +01:00
Robert Bragg
8177afae05 remove unused _cogl_features_init prototype
There is no corresponding implementation of _cogl_features_init any more
so it was simply an oversight that the prototype wasn't removed when the
implementation was removed.
2011-04-11 15:26:25 +01:00
Robert Bragg
e381a159a7 Remove unused _cogl_swap_buffers_notify
Recently _cogl_swap_buffers_notify was added (in 142b229c5c) so that
Cogl would be notified when Clutter performs a swap buffers request for
a given onscreen framebuffer. It was expected this would be required for
the recent cogl_read_pixel optimization that was implemented (ref
1bdb0e6e98) but in the end it wasn't used.

Since it wasn't used in the end this patch removes the API.
2011-04-11 15:26:25 +01:00
Robert Bragg
47e93d4f7b cogl: consolidate _create_context_driver + _features_init
This moves the functionality of _cogl_create_context_driver from
driver/{gl,gles}/cogl-context-driver-{gl,gles}.c into
driver/{gl,gles}/cogl-{gl,gles}.c as a static function called
initialize_context_driver.

cogl-context-driver-{gl,gles}.[ch] have now been removed.
2011-04-11 15:26:25 +01:00
Robert Bragg
c1ab28e9ad cogl: Adds experimental cogl_context_new() API
This adds a new experimental function (you need to define
COGL_ENABLE_EXPERIMENTAL_API to access it) which takes us towards being
able to have a standalone Cogl API. This is really a minor aesthetic
change for now since all the GL context creation code still lives in
Clutter but it's a step forward none the less.

Since our current designs introduce a CoglDisplay object as something
that would be passed to the context constructor this provides a stub
cogl-display.h with CoglDisplay typedef.

_cogl_context_get_default() which Clutter uses to access the Cogl
context has been modified to use cogl_context_new() to initialize
the default context.

There is one rather nasty hack used in this patch which is that the
implementation of cogl_context_new() has to forcibly make the allocated
context become the default context because currently all the code in
Cogl assumes it can access the context using _COGL_GET_CONTEXT including
code used to initialize the context.
2011-04-11 15:26:20 +01:00
Robert Bragg
6484871c6e cogl: rename cogl-context.h cogl-context-private.h
Since we plan to add public cogl_context_* API we need to rename the
current cogl-context.h which contains private member details.
2011-04-11 15:18:12 +01:00
Robert Bragg
ec0b781466 stage: Move _clutter_do_pick to clutter-stage.c
This moves the implementation of _clutter_do_pick to clutter-stage.c and
renames it _clutter_stage_do_pick. This function can be compared to
_clutter_stage_do_update/redraw in that it prepares for and starts a
traversal of a scenegraph descending from a given stage. Since it is
desirable that this function should have access to the private state of
the stage it is awkward to maintain outside of clutter-stage.c.

Besides moving _clutter_do_pick this patch is also able to remove the
following private state accessors from clutter-stage-private.h:
_clutter_stage_set_pick_buffer_valid,
_clutter_stage_get_pick_buffer_valid,
_clutter_stage_increment_picks_per_frame_counter,
_clutter_stage_reset_picks_per_frame_counter and
_clutter_stage_get_picks_per_frame_counter.
2011-04-11 14:31:31 +01:00
Robert Bragg
114133c98c paint-volume: Fix culling bug to handle partial culls
This updates the inner loops of the cull function so now the vertices of
the polygon being culled are iterated in the inner loop instead of the
clip planes and we count how many vertices are outside the current
plane so we can bail out immediately if all the vertices are outside of
any plane and so we can correctly track partial intersections with the
clip region.

The previous approach could catch some partial intersections but for
example a rectangle that was larger than the clip region centred over
the clip region with all corners outside would be reported as outside,
not as a partial intersection.
2011-04-11 14:31:31 +01:00
Marek Černocký
151b80a837 Czech translation 2011-04-07 18:28:06 +02:00
Emmanuele Bassi
161e64aae7 build: Fix typo in the docs URI variable name 2011-04-07 15:09:15 +01:00
Daniel Mustieles
b6fda77e58 Updated Spanish translation 2011-04-06 19:49:41 +02:00
Neil Roberts
b36dde6193 cogl-pango-glyph-cache: Fix the flags passed to cogl_atlas_new
In 047227fb cogl_atlas_new was changed so that it can take a flags
parameter to specify whether to clear the new atlases and whether to
copy images to the new atlas after reorganisation. This was done so
that the atlas code could be shared with the glyph cache. At some
point during the development of this patch the flag was just a single
boolean instead and this is accidentally how it is used from the glyph
cache. The glyph cache therefore passes 'TRUE' as the set of flags
which means it will only get the 'clear' flag and not the
'disable-migration' flag. When the glyph cache gets full it will
therefore try to copy the texture to the new atlas as well as
redrawing them with cairo. This causes problems because the glyph
cache needs to work in situations where there is no FBO support.
2011-04-06 17:36:00 +01:00
Christian Kirbach
9b4a4e3f98 [l10n] Updated German translation 2011-04-05 21:17:03 +02:00
Neil Roberts
36528d3af0 cogl-pipeline: Be careful not to take ownership of root layer
In _cogl_pipeline_prune_empty_layer_difference if the layer's parent
has no owner then it just takes ownership of it. However this could
theoretically end up taking ownership of the root layer because
according to the comment above in the same function that should never
have an owner. This patch just adds an extra check to ensure that the
unowned layer has a parent.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2588
2011-04-05 18:24:09 +01:00
Robert Bragg
e625be6c96 pipeline: reclaim ownership if reverting to layer ancestor
In _cogl_pipeline_prune_empty_layer_difference if we are reverting to
the immediate parent of an empty/redundant layer then it is not enough
to simply add a reference to the pipeline's ->layer_differences list
without also updating parent_layer->owner to point back to its new
owner.

This oversight was leading us to break the invariable that all layers
referenced in layer_differences have an owner and was also causing us to
break another invariable whereby after calling
_cogl_pipeline_layer_pre_change_notify the returned layer must always be
owned by the given 'required_owner'.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2588
2011-04-05 18:24:09 +01:00
Emmanuele Bassi
280165333d build: Cosmetic fixes for release targets
• Use $(SED) and $(GREP) consistently
• Do not point to the template README.in
• Eliminate the '===' separator in the NEWS extractor
• List all download URIs for the tarballs
2011-04-05 11:24:03 +01:00
Emmanuele Bassi
144aa4d9ba build: Fix remote docs URI in the release-message 2011-04-04 23:16:46 +01:00
Emmanuele Bassi
b8047b5471 build: Generate the release announcement
Update the release-message target to generate the full release
announcement out of the standard blurb and the NEWS file. We use
a pretty evil sed incantation, courtesy of Neil Roberts.
2011-04-04 22:34:10 +01:00
Emmanuele Bassi
42508e6091 build: Look for sed
Use AC_PROG_SED to find sed in a portable way.
2011-04-04 22:33:31 +01:00
Emmanuele Bassi
c2176c778a doap: Update the project information
Update the location for repository and bugzilla, and redistribute the
blame^Wmaintainership.
2011-04-04 15:33:24 +01:00
Emmanuele Bassi
6aa0919ba6 build: Fix typo in Makefile.am.release 2011-04-04 15:11:20 +01:00
Emmanuele Bassi
02d14ec15c offscreen: Plug a leak in an error path
When creating a CoglOffscreen we take a reference on the texture handle,
but in case of error we never release it.

We should take that reference only on success.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2620
2011-04-04 14:42:36 +01:00
Emmanuele Bassi
28c0a4d6be osx: Do not unrealize on hide
Calling unrealize on ClutterStage::hide will cause an assertion
failure and other badness when we destroy the stage.
2011-04-02 22:36:38 +01:00
Robert Bragg
130c79ac03 glx: throttle clipped redraws
When we come to presenting the result of a clipped redraw to the front
buffer with a blit we need to ensure that all the rendering is done,
otherwise redraw operations that are slower than the framerate can queue
up in the pipeline during a heavy animation, causing a larger and larger
backlog of rendering visible as lag to the user.

Note: Since calling glFinish() and sycnrhonizing the CPU with the GPU is
far from ideal, we hope that this is only a short term solution.

One idea is to using sync objects to track render completion so we can
throttle the backlog (ideally with an additional extension that lets us
get notifications in our mainloop instead of having to busy wait for the
completion.)

Another option is to support clipped redraws by reusing the contents of
old back buffers such that we can flip instead of using a blit and then
we can use GLX_INTEL_swap_events to throttle. For this though we would
still probably want an additional extension so we can report the limited
region of the window damage to X/compositors.

Thanks to Owen Taylor and Alexander Larsson for reporting the problem.
2011-04-01 18:50:55 +01:00
Andrej Žnidaršič
ca6e7f8afa Updated Slovenian translation 2011-04-01 18:57:01 +02:00
Andrej Žnidaršič
53368d127a Updated Slovenian translation 2011-04-01 18:50:58 +02:00
Samuel Degrande
4594d1bafe Removes the addition of the .exe extension to unit-test scripts, on win32.
On win32, test scripts are created with a .exe extension.
Under mingw, a .exe script is launched in 16 bit compatibility mode (through
ntvdm), and so it just does not run.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2619
2011-04-01 17:08:25 +01:00
Emmanuele Bassi
564765c45c build: Update the release rules 2011-04-01 16:31:49 +01:00
Emmanuele Bassi
e368538ae0 align-constraint: Fix typo in the vertical align
We're clamping the x1 coordinate to the nearest pixel, instead of doing
so for the y1 coordinate.
2011-04-01 15:36:22 +01:00
Emmanuele Bassi
524eb23eb7 paint-volume: Zero-sized actors don't have paint volume
If an actor has an allocated dimension equal to 0 then it has no paint
volume.
2011-04-01 11:43:34 +01:00
Emmanuele Bassi
7e6bf1612b texture: Add some safeguards for paint volumes of empty textures
If the Texture has no material, and the image size is 0x0 then the actor
doesn't have any paint volume.
2011-04-01 11:42:41 +01:00
Emmanuele Bassi
7ffeaef0e9 po: Update the PO files 2011-03-31 17:12:27 +01:00
Emmanuele Bassi
5e8b491d28 po: Track Clutter's POT file in Git
If no POT file is found, gettext will automatically create it; this, in
turn, will cause msgmerge to be run, and that will cause the PO files to
be touched and changed at the very first call for `make`.

Having the PO files with unstaged changes will ultimately lead to merge
issues will pulling from the remote repository between releases - unless
`git checkout -f` is called prior to `git pull -r`.

I think intltool only has some rule to avoid that from happening unless
on dist, but I have no intention of dragging intltool into the build of
a library that barely has localized messages.
2011-03-31 17:12:27 +01:00
Matej Urbančič
e471ad5802 Added Slovenian translation 2011-03-30 18:36:42 +02:00
Piotr Drąg
82b31ba444 Imported translations from Transifex.net 2011-03-29 17:40:50 +02:00
Piotr Drąg
1bcec53d06 Updated Polish translation 2011-03-29 17:25:11 +02:00
Piotr Drąg
7cb0465797 Updated POTFILES.in and removed clutter-1.0.pot 2011-03-29 15:11:30 +02:00
Emmanuele Bassi
620727689f moduleset: Some modules have been moved to gnome.org
So we need to update the moduleset.
2011-03-28 18:36:33 +01:00
Emmanuele Bassi
a4d29ca2e1 build: Fix previous commit
The previous commit broke the backend-specific required pkg-config
packages.
2011-03-24 14:13:59 +00:00
Emmanuele Bassi
0eee5788df build: Remove bash-isms 2011-03-22 17:18:07 +00:00
Emmanuele Bassi
a5c87c74a6 build: Use AC_CANONICAL_HOST
Since we're checking the value of the $host variable, it's a good idea
to use the canonicalization support in autoconf.
2011-03-22 17:10:49 +00:00
Emmanuele Bassi
1de13713ae doap: Fix the categories 2011-03-22 14:46:35 +00:00
Emmanuele Bassi
a76e0041af drag-action: Fix a compiler warning
Use arguments of the right signedness when passing pointers.
2011-03-21 12:41:40 +00:00
Emmanuele Bassi
a51c4cff72 Merge remote-tracking branch 'elliot/cookbook-effects-basic'
* elliot/cookbook-effects-basic:
  docs: Remove checks for whether an effect is disabled
  docs: Add recipe about implementing a ClutterEffect
  docs: Add example of setting background color with ClutterEffect
  docs: Add example of a border added through ClutterEffect
2011-03-21 12:34:41 +00:00