Emmanuele Bassi [Tue, 21 Jul 2009 13:11:28 +0000 (14:11 +0100)]
[build] Use per-target flags and libraries
AM_LDFLAGS is ignored by the LDFLAGS target, and it's also not the right
place to put the libraries used by the linker.
Thanks to Vincent Untz for spotting this.
Emmanuele Bassi [Tue, 21 Jul 2009 10:51:20 +0000 (11:51 +0100)]
[docs] Update the "creating new behaviours" chapter
The signature of the ::alpha_notify virtual function has been
changed with the switch to float ClutterAlpha.
Emmanuele Bassi [Tue, 21 Jul 2009 10:50:08 +0000 (11:50 +0100)]
[docs] Update the building instructions
New configure script command line switches have been added since
the last time we updated the documentation.
Emmanuele Bassi [Tue, 21 Jul 2009 10:29:52 +0000 (11:29 +0100)]
[docs] Update the animations tutorial
Bring the Animation framework introduction/tutorial up to the 1.0
API for timelines and animations.
Emmanuele Bassi [Tue, 21 Jul 2009 08:22:34 +0000 (09:22 +0100)]
Fix copy-and-paste errors in the deprecation macros
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1704
Emmanuele Bassi [Tue, 21 Jul 2009 08:20:09 +0000 (09:20 +0100)]
[docs] Fix typo in the effects migration guide
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1706
Emmanuele Bassi [Mon, 20 Jul 2009 19:59:18 +0000 (20:59 +0100)]
[docs] Improve the Units to and from string conversion
Make sure to document the conversion to and from strings for ClutterUnits,
with negative examples and with the behaviour for fractionary bits.
Emmanuele Bassi [Mon, 20 Jul 2009 11:49:35 +0000 (12:49 +0100)]
[doc] Miscellaneous documentation fixes
Remove private symbols, and add missing public ones.
Emmanuele Bassi [Mon, 20 Jul 2009 11:47:53 +0000 (12:47 +0100)]
[cogl] Make the blend string error domain public
The error domain and codes must present in a publicly installed header
otherwise they won't be usable to match a GError.
Emmanuele Bassi [Mon, 20 Jul 2009 10:45:47 +0000 (11:45 +0100)]
[gitignore] Add test-materials
Emmanuele Bassi [Tue, 14 Jul 2009 12:47:35 +0000 (13:47 +0100)]
Allow disabling motion event throttling
It might be desirable for some applications and/or platforms to get
every motion event that was delivered to Clutter from the windowing
backend. By adding a per-stage flag we can bypass the throttling
done when processing the events.
http://bugzilla.openedhand.com/show_bug.cgi?id=1665
Emmanuele Bassi [Sat, 18 Jul 2009 18:40:29 +0000 (19:40 +0100)]
[docs] Move the releasing process to a separate file
The documentation on how to release Clutter should be in a separate
file from the documentation on how to hack on Clutter.
Robert Bragg [Sun, 19 Jul 2009 09:08:32 +0000 (10:08 +0100)]
[doc] Remove references to cogl_vertex_buffer_delete_indices
These referencese were left over from before indices got CoglHandles to
uniquely identify them. cogl_handle_unref can be used to delete indices
now.
Emmanuele Bassi [Sat, 18 Jul 2009 15:59:54 +0000 (16:59 +0100)]
[cogl/gles] Fix missing symbols in CoglContext
Keep the CoglContext in sync between GL and GLES backends. We ought
to find a way to have a generic context, though, and have backend
specific sections.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1698
Owen W. Taylor [Fri, 17 Jul 2009 19:15:03 +0000 (15:15 -0400)]
Fix parallel build of introspection
We need to explicitly force order so that ClutterJson.gir and Cogl.gir
are present in the parent directory before we try to build Clutter.typelib.
http://bugzilla.openedhand.com/show_bug.cgi?id=1700
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Owen W. Taylor [Fri, 17 Jul 2009 19:10:06 +0000 (15:10 -0400)]
Fix building introspection when dolt is not in use
On some platforms (anything but Linux, and on obscure Linux
architectures) dolt isn't used, so $(top_builddir)/doltlibtool
won't exist. $(top_builddir)/libtool will always be generated
even if dolt is used, so just use that unconditionally. We don't
need the extra speed when linking the single program for
introspection.
http://bugzilla.openedhand.com/show_bug.cgi?id=1699
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Fri, 17 Jul 2009 16:51:26 +0000 (17:51 +0100)]
Post-release bump to 0.9.9
Emmanuele Bassi [Fri, 17 Jul 2009 16:32:45 +0000 (17:32 +0100)]
[release] 0.9.8
Emmanuele Bassi [Fri, 17 Jul 2009 16:32:20 +0000 (17:32 +0100)]
Update NEWS file
Emmanuele Bassi [Mon, 13 Jul 2009 16:27:01 +0000 (17:27 +0100)]
Fix comments inside configure.ac
Neil Roberts [Fri, 17 Jul 2009 11:43:52 +0000 (12:43 +0100)]
[stage] Force an allocation before showing the stage
A lot of applications change the size of the stage from the default
before the stage is initially shown. The size change won't take affect
until the first allocation run. However we want the window to be at
the correct size when we first map it so we should force an allocation
run before showing the stage.
There was an explicit call to XResizeWindow in
clutter_stage_x11_show. This is not needed anymore because
XResizeWindow will already have been called by the allocate method.
Marcos [Mon, 13 Jul 2009 16:04:05 +0000 (17:04 +0100)]
[win32] Compilation fixes
Remove the usage of the old CLUTTER_UNITS_* macros and put back a
missing ';'.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 13 Jul 2009 15:56:47 +0000 (16:56 +0100)]
[osx] Enable motion event dispatch
By default NSWindow does not listen to mousemoved events and hence the
default behaviour for Actors using the "motion-event" signal differs
from backend to backend.
Using setAcceptsMouseMovedEvents seems to fix it; unfortunately, I
cannot verify it, but since nobody is currently working on the Quartz
backend I guess it cannot get more broken than how currently is.
Thanks to: Michael <michael@f3k.org>
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1687
Emmanuele Bassi [Mon, 13 Jul 2009 15:53:06 +0000 (16:53 +0100)]
[osx] Remove old units macros
Remove the usage of CLUTTER_UNITS_* macros and at least get the
chance to make the OSX backend compile.
Hopefully, since I can't currently test it.
Emmanuele Bassi [Mon, 13 Jul 2009 15:18:27 +0000 (16:18 +0100)]
[actor] Allow querying whether we are painted by a Clone
It would be useful inside a custom actor's paint function to be able to
tell if this is a primary paint call, or if we are in fact painting on
behalf of a clone.
In Mutter we have an optimization not to paint occluded windows; this is
desirable for the windows per se, to conserve bandwith to the card, but
if something like an application switcher is using clones of these windows,
they will not get painted either; currently we have no way of
differentiating between the two.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1685
Emmanuele Bassi [Mon, 13 Jul 2009 15:16:38 +0000 (16:16 +0100)]
Remove unused TEXTURE_IN_CLONE_PAINT private flag
The CLUTTER_TEXTURE_IN_CLONE_PAINT was used with the old CloneTexture
actor; now that we have ClutterClone nothing sets the private flag
anymore, and the flag itself is not needed.
Xu Li [Mon, 13 Jul 2009 08:06:13 +0000 (16:06 +0800)]
[x11] update_wm_hints after unsetting WITHDRAWN
Updating the WM hints on the stage window shortcircuits if the stage
is in WITHDRAWN state, so we need to move the update_wm_hints() call
after the flag has been unset.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 13 Jul 2009 14:31:38 +0000 (15:31 +0100)]
[glx] Make the wait_for_vblank function private
Nobody should be using the function to wait for the vblank outside
of the GLX backend.
Owen W. Taylor [Sat, 6 Jun 2009 19:47:57 +0000 (15:47 -0400)]
Call glFinish() before manually waiting for VBLANK
If we manually wait for the VBLANK with:
- SGI_video_sync
- Direct usage of the DRM ioctl
Then we should call glFinish() first, or otherwise the swap-buffers
may be delayed by pending drawing and cause a tear.
http://bugzilla.openedhand.com/show_bug.cgi?id=1636
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Sun, 12 Jul 2009 00:43:41 +0000 (01:43 +0100)]
[tests] Remove test-perspective
The perspective test was used essentially to determine whether the
perspective set up in COGL worked correctly. The perspective code
has been changed a lot since Clutter 0.3: we rely on client-side
matrices and we use floating point; so, all the conditions the test
was supposed to verify do not exist anymore.
Evan Martin [Sun, 12 Jul 2009 00:38:40 +0000 (01:38 +0100)]
[docs] Fix typos and remove mentions of SVN
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Jakub Higersberger [Fri, 3 Jul 2009 12:51:17 +0000 (14:51 +0200)]
Use correct signal detail
The Animation should connect to the notify::alpha signal, not to
the non-existing notify::value signal.
Fixes bugs:
http://bugzilla.openedhand.com/show_bug.cgi?id=1674
http://bugzilla.openedhand.com/show_bug.cgi?id=1688
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Sun, 12 Jul 2009 00:27:31 +0000 (01:27 +0100)]
Small code clean up
Make ClutterTexture slightly more similar to the rest of the code base.
Robert Bragg [Tue, 7 Jul 2009 15:16:56 +0000 (16:16 +0100)]
[cogl] Fix more brokeness with _cogl_material_equal
commit
e2c4a2a9f83 fixed one thing but broke many others things :-/
hopfully this fixes that.
It turned out that the journal was mistakenly setting the OVERRIDE_LAYER0
flush option for all entries, but some other logic errors were also
uncovered in _cogl_material_equal.
pippin [Thu, 9 Jul 2009 19:45:08 +0000 (15:45 -0400)]
serialize upload of asyncronously loaded textures
Rate limit the uploading of textures to stop if it uses more than 5ms
during one master clock iteration.
Robert Bragg [Thu, 9 Jul 2009 19:03:01 +0000 (20:03 +0100)]
ensure next iteration
Added an internal clutter function, _clutter_master_clock_ensure_next_iteration
that ensures another iteration of the master clock, can be called from repaint
functions as well as other threads.
Robert Bragg [Fri, 3 Jul 2009 23:15:49 +0000 (00:15 +0100)]
[cogl] Fix drawing with sliced textures using material layer0 overrides
To help us handle sliced textures; When flushing materials there is an
override option that can be given to replace the texture name for layer0
so we may iterate the slices without needing to modify the material
in use.
Since improving the journal's ability to batch state changes we added a
_cogl_material_equals function that is used by the journal to compare
materials and identify when a state change is required, but this wasn't
correctly considering the layer0 override resulting in false positives that
meant the journal wouldn't update the GL state and the first texture name
was used for all slices.
Robert Bragg [Thu, 2 Jul 2009 23:34:10 +0000 (00:34 +0100)]
[cogl matrix stack] Create a client side matrix stack for the projection matrix
The cost of glGetFloatv with Mesa is still representing a majority of our
time in OpenGL for some applications, and the last thing left using this is
the current-matrix API when getting the projection matrix.
This adds a matrix stack for the projection matrix, so all getting, setting
and modification of the projection matrix is now managed by Cogl and it's only
when we come to draw that we flush changes to the matrix to OpenGL.
This also brings us closer to being able to drop internal use of the
deprecated OpenGL matrix functions, re: commit
54159f5a1d02
Emmanuele Bassi [Thu, 2 Jul 2009 13:21:16 +0000 (14:21 +0100)]
Add more (allow-none) annotations
Colin Walters [Thu, 2 Jul 2009 12:15:42 +0000 (13:15 +0100)]
Use the (allow-none) annotation for clutter_init*
We accept NULL for some parameters in the initialization functions.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Wed, 1 Jul 2009 14:59:13 +0000 (15:59 +0100)]
Post-release bump to 0.9.7
Emmanuele Bassi [Wed, 1 Jul 2009 14:28:33 +0000 (15:28 +0100)]
[release] 0.9.6
Emmanuele Bassi [Wed, 1 Jul 2009 13:56:13 +0000 (14:56 +0100)]
[docs] Update the NEWS and README files
Emmanuele Bassi [Wed, 1 Jul 2009 14:15:52 +0000 (15:15 +0100)]
[actor] Remove the unused get_allocation_coords()
The clutter_actor_get_allocation_coords() is not used, and since
the switch to floats in the Actor's API, it returns exactly what
the get_allocation_box() returns.
Emmanuele Bassi [Wed, 1 Jul 2009 12:59:13 +0000 (13:59 +0100)]
[actor] Allow changing the transformations matrix
Currently, the transformation matrix for an actor is constructed
from scenegraph-related accessors. An actor, though, can call COGL
API to add new transformations inside the paint() implementation,
for instance:
static void
my_foo_paint (ClutterActor *a)
{
...
cogl_translate (-scroll_x, -scroll_y, 0);
...
}
Unfortunately these transformations will be completely ignored by
the scenegraph machinery; for instance, getting the actor-relative
coordinates from event coordinates is going to break badly because
of this.
In order to make the scenegraph aware of the potential of additional
transformations, we need a ::apply_transform() virtual function. This
vfunc will pass a CoglMatrix which can be used to apply additional
operations:
static void
my_foo_apply_transform (ClutterActor *a, CoglMatrix *m)
{
CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m);
...
cogl_matrix_translate (m, -scroll_x, -scroll_y, 0);
...
}
The ::paint() implementation will be called with the actor already
using the newly applied transformation matrix, as expected:
static void
my_foo_paint (ClutterActor *a)
{
...
}
The ::apply_transform() implementations *must* chain up, so that the
various transformations of each class are preserved. The default
implementation inside ClutterActor applies all the transformations
defined by the scenegraph-related accessors.
Actors performing transformations inside the paint() function will
continue to work as previously.
Emmanuele Bassi [Wed, 1 Jul 2009 11:34:54 +0000 (12:34 +0100)]
Split the typdef to avoid confusing scanners
Scanners like gtk-doc and g-ir-scanner get confused by:
typedef struct _Foo {
...
} Foo;
And expect instead:
typedef struct _Foo Foo;
struct _Foo {
...
};
CoglMatrix definition should be changed to avoid the former type.
Emmanuele Bassi [Thu, 25 Jun 2009 13:41:25 +0000 (14:41 +0100)]
[x11] Fix the race between resize and glViewport calls
The race we were experiencing in the X11 backends is apparently
back after the fix in commit
00a3c698.
This time, just delaying the setting of the SYNC_MATRICES flag
is not enough, so we can resume the use of a STAGE_IN_RESIZE
private flag.
This should also fix bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1668
Emmanuele Bassi [Thu, 25 Jun 2009 13:39:57 +0000 (14:39 +0100)]
Add debug notes for calls to glViewport()
In order to validate the sequence of:
XResizeWindow
ConfigureNotify
glViewport
that should happen on X11 we need to add debug annotations to the
calls to glViewport() done through COGL.
Robert Bragg [Wed, 1 Jul 2009 11:57:30 +0000 (12:57 +0100)]
[cogl] cache the viewport width and height
This avoids some calls to glGetFloatv, which have at least proven to be very
in-efficient in mesa at this point in time, since it always updates all derived
state even when it may not relate to the state being requested.
Robert Bragg [Fri, 19 Jun 2009 11:15:12 +0000 (12:15 +0100)]
[cogl] Ensure well defined semantics for COGL_INVALID_HANDLE material layers
Fixes and adds a unit test for creating and drawing using materials with
COGL_INVALID_HANDLE texture layers.
This may be valid if for example the user has set a texture combine string
that only references a constant color.
_cogl_material_flush_layers_gl_state will bind the fallback texture for any
COGL_INVALID_HANDLE layer, later though we could explicitly check when the
current blend mode does't actually reference a texture source in which case
binding the fallback texture is redundant.
This tests drawing using cogl_rectangle, cogl_polygon and
cogl_vertex_buffer_draw.
Robert Bragg [Tue, 30 Jun 2009 16:17:30 +0000 (17:17 +0100)]
Merge branch 'cogl-journal-batching'
[cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
[cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Revert "[rectangle] Avoid modifying materials mid scene"
Revert "[actor] Avoid modifying materials mid-scene to improve journal batching"
[cogl-vertex-buffer] Disable unused client tex coord arrays
[cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer
[cogl] flush matrices in _cogl_add_path_to_stencil_buffer
[journal] Don't resize a singlton VBO; create and destroy a VBO each flush
[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer
[pango-display-list] Use the Cogl journal for short runs of text
[material] _cogl_material_equal: catch the simplest case of matching handles
[material] avoid flushing the journal when just changing the color
[cogl journal] Perform software modelview transform on logged quads.
[Cogl journal] use G_UNLIKLEY around runtime debugging conditions
[cogl journal] Adds a --cogl-debug=batching option to trace batching
[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
[cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos
[cogl] Force Cogl to always use the client side matrix stack
[cogl-debug] Adds a "client-side-matrices" Cogl debug option
[cogl-color] Adds a cogl_color_equal() function
[cogl material] optimize logging of material colors in the journal
[rectangle] Avoid modifying materials mid scene
[actor] Avoid modifying materials mid-scene to improve journal batching
[journal] Always pad our vertex data as if at least 2 layers are enabled
[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
The Cogl journal is a mechanism Cogl uses to batch geometry resulting from
any of the cogl_rectangle* functions before sending it to OpenGL. This aims
to improve the Cogl journal so that it can reduce the number of state
changes and draw calls we issue to the OpenGL driver and hopfully improve
performance.
Previously each call to any of the cogl_rectangle* functions would imply an
immediate GL draw call, as well as a corresponding modelview change;
material state changes and gl{Vertex,Color,TexCoord}Pointer calls. Now
though we have tried to open the scope for batching up as much as possible
so we only have to flush the geometry either before calling glXSwapBuffers,
or when we change state that isn't tracked by the journal.
As a basic example, it's now possible for us to batch typical picking
renders into a single draw call for the whole scene.
Some key points about this change:
- We now perform transformations of quads in software (except for long runs of
text which continue to use VBOs)
* It might seem surprising at first, but when you consider that so many
Clutter actors are little more than textured quads and each actor
typically implies a modelview matrix change; the costs involved in
setting up the GPU with the new modelview can easily out weigh the cost
of simply transforming 4 vertices.
- We always use Cogl's own client side matrix API now.
* We found the performance of querying the OpenGL driver for matrix state
was often worse than using the client matrix code, and also - discussing
with Mesa developers - agreed that since khronos has essentially
deprecated the GL matrix API (by removing it from OpenGL 3 and
OpenGL-ES 2) it was appropriate to take full responsibility for all our
matrix manipulation.
- Developers should avoid modifying materials mid-scene.
* With the exception of material color changes, if you try and modify a
material that is referenced in the journal we will currently force a
journal flush. Note: you can assume that re-setting the same value for
a material property won't require a flush though.
- Several new --cogl-debug options have been added
* "disable-batching" can be used to identify bugs in the way that the
journal does its batching; of could this shouldn't ever be needed :-)
* "disable-vbos" can be used to test the VBO fallback paths where we
simply use malloc()'d buffers instead.
* "batching" lets you get an overview of how the journal is batching
your geometry and may help you identify ways to improve your
application performance.
* "journal" lets you trace all the geometry as it gets logged in the
journal, and all the geometry as its flushed from the journal.
Obviously an inconsistency can identify a bug, but the numbers may
help you verify application logic too.
* "disable-software-transform" as implied will instead use the driver
/GPU to transform quads by the modelview matrix.
Although committed separately a --clutter-debug=nop-picking option was
also added that lets you remove picking from the equation, which can
sometimes help make problem analysis more deterministic.
Robert Bragg [Mon, 29 Jun 2009 21:32:05 +0000 (22:32 +0100)]
[cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Although we wouldn't recommend developers try and interleve OpenGL drawing
with Cogl drawing - we would prefer patches that improve Cogl to avoid this
if possible - we are providing a simple mechanism that will at least give
developers a fighting chance if they find it necissary.
Note: we aren't helping developers change OpenGL state to modify the
behaviour of Cogl drawing functions - it's unlikley that can ever be
reliably supported - but if they are trying to do something like:
- setup some OpenGL state.
- draw using OpenGL (e.g. glDrawArrays() )
- reset modified OpenGL state.
- continue using Cogl to draw
They should surround their blocks of raw OpenGL with cogl_begin_gl() and
cogl_end_gl():
cogl_begin_gl ();
- setup some OpenGL state.
- draw using OpenGL (e.g. glDrawArrays() )
- reset modified OpenGL state.
cogl_end_gl ();
- continue using Cogl to draw
Again; we aren't supporting code like this:
- setup some OpenGL state.
- use Cogl to draw
- reset modified OpenGL state.
When the internals of Cogl evolves, this is very liable to break.
cogl_begin_gl() will flush all internally batched Cogl primitives, and emit
all internal Cogl state to OpenGL as if it were going to draw something
itself.
The result is that the OpenGL modelview matrix will be setup; the state
corresponding to the current source material will be setup and other world
state such as backface culling, depth and fogging enabledness will be also
be sent to OpenGL.
Note: no special material state is flushed, so if developers want Cogl to setup
a simplified material state it is the their responsibility to set a simple
source material before calling cogl_begin_gl. E.g. by calling
cogl_set_source_color4ub().
Note: It is the developers responsibility to restore any OpenGL state that they
modify to how it was after calling cogl_begin_gl() if they don't do this then
the result of further Cogl calls is undefined.
Robert Bragg [Mon, 29 Jun 2009 16:10:34 +0000 (17:10 +0100)]
Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.
As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.
cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives. It provides no guarantees about
when the driver will complete the rendering.
This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.
If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals. For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.
This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.
Robert Bragg [Wed, 24 Jun 2009 17:34:06 +0000 (18:34 +0100)]
[cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Previously we would call _cogl_material_pre_change_notify unconditionally, but
now we wait until we really know we are removing a layer before notifying the
change, which will require a journal flush.
Since the convenience functions cogl_set_source_color4ub and
cogl_set_source_texture share a single material, cogl_set_source_color4ub
always calls cogl_material_remove_layer. Often this is a NOP though and
shouldn't require a journal flush.
This gets performance back to where it was before reverting the per-actor
material commits.
Robert Bragg [Wed, 24 Jun 2009 17:24:58 +0000 (18:24 +0100)]
Revert "[rectangle] Avoid modifying materials mid scene"
This reverts commit
8cf42ea8ac5c05f6b443c453f9c6c2a3cd75acfa.
Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes which
means using cogl_set_source_color4ub is no longer a concern.
Robert Bragg [Wed, 24 Jun 2009 17:20:45 +0000 (18:20 +0100)]
Revert "[actor] Avoid modifying materials mid-scene to improve journal batching"
This reverts commit
85243da382025bd516937c76a61b8381f6e74689.
Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes
which means using cogl_set_source_color4ub is no longer a concern.
Robert Bragg [Wed, 24 Jun 2009 17:10:50 +0000 (18:10 +0100)]
[cogl-vertex-buffer] Disable unused client tex coord arrays
Before any cogl vertex buffer drawing we call
enable_state_for_drawing_buffer which sets up the GL state, but we weren't
disabling unsed client texture coord arrays.
Robert Bragg [Mon, 22 Jun 2009 00:29:39 +0000 (01:29 +0100)]
[cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer
After flushing the journal an unknown number of client side texture arrays
may be left enabled. Disable them all before using glDrawArrays.
Robert Bragg [Sun, 21 Jun 2009 23:49:20 +0000 (00:49 +0100)]
[cogl] flush matrices in _cogl_add_path_to_stencil_buffer
Before calling glRectf we need to ensure we flush the modelview and
projection matrices.
Robert Bragg [Sun, 21 Jun 2009 23:11:41 +0000 (00:11 +0100)]
[journal] Don't resize a singlton VBO; create and destroy a VBO each flush
This simplifies the vertex data uploading in the journal, and could improve
performance. Modifying a VBO mid-scene could reqire synchronizing with the
GPU or some form of shadowing/copying to avoid modifying data that the GPU
is currently processing; the buffer was also being marked as GL_STATIC_DRAW
which could have made things worse.
Now we simply create a GL_STATIC_DRAW VBO for each flush and and delete it
when we are finished.
Robert Bragg [Sun, 21 Jun 2009 23:05:02 +0000 (00:05 +0100)]
[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer
Using cogl_rectangle (and thus the journal) in
_cogl_add_path_to_stencil_buffer means we have to consider all the state
that the journal may change in case it may interfer with the direct GL calls
used. This has proven to be error prone and in this case the journal is an
unnecissary overhead. We now simply call glRectf instead of using
cogl_rectangle.
Robert Bragg [Wed, 17 Jun 2009 22:35:49 +0000 (23:35 +0100)]
[pango-display-list] Use the Cogl journal for short runs of text
For small runs of text like icon labels, we can get better performance
going through the Cogl journal since text may then be batched together
with other geometry.
For larger runs of text though we still use VBOs since the cost of logging
the quads becomes too expensive, including the software transform which
isn't at all optimized at this point. VBOs also have the further advantage
of avoiding repeated validation of vertices by the driver and repeated
mapping of data into the GPU so long as the text doesn't change.
Currently the threshold is 100 vertices/25 quads. This number was plucked
out of thin air and should be tuned later.
With this change I see ~180% fps improvment for test-text. (x61s + i965 +
Mesa 7.6-devel)
Robert Bragg [Wed, 17 Jun 2009 22:31:40 +0000 (23:31 +0100)]
[material] _cogl_material_equal: catch the simplest case of matching handles
We were missing the simplest test of all: are the two CoglHandles equal and
are the flush option flags for each material equal? This should improve
batching for some common cases.
Robert Bragg [Wed, 17 Jun 2009 22:31:11 +0000 (23:31 +0100)]
[material] avoid flushing the journal when just changing the color
Whenever we modify a material we call _cogl_material_pre_change_notify which
checks to see if the material is referenced by the journal and if so flushes
if before we modify the material.
Since the journal logs material colors directly into a vertex array (to
avoid us repeatedly calling glColor) then we know we never need to flush
the journal when material colors change.
Robert Bragg [Wed, 17 Jun 2009 00:31:36 +0000 (01:31 +0100)]
[cogl journal] Perform software modelview transform on logged quads.
Since most Clutter actors aren't much more than textured quads; flushing the
journal typically involves lots of 'change modelview; draw quad' sequences.
The amount of overhead involved in uploading a new modelview and queuing
that primitive is huge in comparison to simply transforming 4 vertices by
the current modelview when logging quads. (Note if your GPU supports HW
vertex transform, then it still does the projective and viewport transforms)
At the same time a --cogl-debug=disable-software-transform option has been
added for comparison and debugging.
This change allows typical pick scenes to be batched into a single draw call
and I'm seeing test-pick run over 200% faster with this. (i965 + Mesa
7.6-devel)
Robert Bragg [Wed, 17 Jun 2009 00:30:24 +0000 (01:30 +0100)]
[Cogl journal] use G_UNLIKLEY around runtime debugging conditions
May as well improve the branch prediction around runtime debugging code.
Robert Bragg [Thu, 11 Jun 2009 10:54:01 +0000 (11:54 +0100)]
[cogl journal] Adds a --cogl-debug=batching option to trace batching
Enabling this option makes Cogl trace how the journal is managing to batch
your rectangles. The journal staggers how it emmits state to the GL driver
and the batches will normally get smaller for each stage, but ideally you
don't want to be in a situation where Cogl is only able to draw one quad per
modelview change and draw call.
E.g. this is a fairly ideal example:
BATCHING: journal len = 101
BATCHING: vbo offset batch len = 101
BATCHING: material batch len = 101
BATCHING: modelview batch len = 101
This isn't:
BATCHING: journal len = 1
BATCHING: vbo offset batch len = 1
BATCHING: material batch len = 1
BATCHING: modelview batch len = 1
BATCHING: journal len = 1
BATCHING: vbo offset batch len = 1
BATCHING: material batch len = 1
BATCHING: modelview batch len = 1
<repeat>
Robert Bragg [Wed, 17 Jun 2009 00:59:28 +0000 (01:59 +0100)]
[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
When this option is used Cogl will print a trace of all quads that get
logged into the journal, and a trace of quads as they get flushed.
If you are seeing a bug with the geometry being drawn by Cogl this may give
some clues by letting you sanity check the numbers being logged vs the
numbers being emitted.
Robert Bragg [Wed, 17 Jun 2009 00:46:06 +0000 (01:46 +0100)]
[cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos
For testing the VBO fallback paths it helps to be able to disable the
COGL_FEATURE_VBOS feature flag. When VBOs aren't available Cogl should use
client side malloc()'d buffers instead.
Robert Bragg [Wed, 17 Jun 2009 00:37:39 +0000 (01:37 +0100)]
[cogl] Force Cogl to always use the client side matrix stack
Previously we only used the Cogl matrix stack API for indirect contexts, but
it's too costly to keep on requesting modelview matrices from GL (for
logging in the journal) even for direct rendering.
I also experimented with a patch for mesa to improve performance and
discussed this with upstream, but we agreed to consider the GL matrix API
essentially deprecated. (For reference the GLES 2 and GL 3 specs have
removed the matrix APIs)
Robert Bragg [Fri, 5 Jun 2009 12:50:00 +0000 (13:50 +0100)]
[cogl-debug] Adds a "client-side-matrices" Cogl debug option
This allows us to force Cogl to use the client side matrix stack even when
direct rendering.
Robert Bragg [Fri, 5 Jun 2009 11:58:31 +0000 (12:58 +0100)]
[cogl-color] Adds a cogl_color_equal() function
CoglColors shouldn't be compared using memcmp since they may contain
uninitialized padding bytes.
The prototype is also suitable for passing to g_hash_table_new as the
key_equal_func.
_cogl_pango_display_list_add_texture now uses this instead of memcmp.
Robert Bragg [Thu, 4 Jun 2009 13:23:16 +0000 (14:23 +0100)]
[cogl material] optimize logging of material colors in the journal
We now put the color of materials into the vertex array used by the journal
instead of calling glColor() but the number of requests for the material
color were quite expensive so we have changed the material color to
internally be byte components instead of floats to avoid repeat conversions
and added _cogl_material_get_colorubv as a fast-path for the journal to
copy data into the vertex array.
Robert Bragg [Fri, 5 Jun 2009 12:03:14 +0000 (13:03 +0100)]
[rectangle] Avoid modifying materials mid scene
To improve batching of geometry in the Cogl journal we need to avoid modifying
materials midscene.
Currently cogl_set_source_color and cogl_set_source_texture simply modify a
single shared material. In the future we can improve this so they use a pool
of materials that gets recycled as the journal is flushed, but for now we
give all ClutterRectangles their own private materials for painting with.
Robert Bragg [Wed, 17 Jun 2009 17:36:27 +0000 (18:36 +0100)]
[actor] Avoid modifying materials mid-scene to improve journal batching
Currently cogl_set_source_color uses a single shared material which means
each actor that uses it causes the journal to flush if the color changes.
Until we improve cogl_set_source_color to use a pool of materials that can
be recycled as the journal is flushed we avoid mid-scene material changes by
giving all actors a private material instead.
Robert Bragg [Wed, 10 Jun 2009 12:59:45 +0000 (13:59 +0100)]
[journal] Always pad our vertex data as if at least 2 layers are enabled
The number of material layers enabled when logging a quad in the journal
determines the stride of the corresponding vertex data (since we need a set
of texture coordinates for each layer.) By padding data in the case where we
have only one layer we can avoid a change in stride if we are mixing single
and double layer primitives in a scene (e.g. relevent for a composite
manager that may use 2 layers for all shaped windows) Avoiding stride
changes means we can minimize calls to gl{Vertex,Color}Pointer when flushing
the journal.
Since we need to update the texcoord pointers when the actual number of
layers changes, this adds another batch_and_call() stage to deal with
glTexCoordPointer and enabling/disabling the client arrays.
Robert Bragg [Wed, 17 Jun 2009 17:46:42 +0000 (18:46 +0100)]
[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e. the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry. In ideal circumstances we will only flush once per scene.
In summary the journal works like this:
When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal. A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix. Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:
- modifying materials mid-scene
This is because each quad in the journal has an associated material
reference (i.e. not copy), so if you try and modify a material that is
already referenced in the journal we force a flush first)
NOTE: For now this means you should avoid using cogl_set_source_color()
since that currently uses a single shared material. Later we
should change it to use a pool of materials that is recycled
when the journal is flushed.
- modifying any state that isn't currently logged, such as depth, fog and
backface culling enables.
The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.
We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together. This is
currently broken up into 3 levels so we can stagger the state changes:
1) we break the journal up according to changes in the number of material layers
associated with logged quads. The number of layers in a material determines
the stride of the associated vertices, so we have to update our vertex
array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
we update the modelview matrix and actually emit the actual draw command.
This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.
Øyvind Kolås [Tue, 30 Jun 2009 15:48:53 +0000 (16:48 +0100)]
[texture] fix load-async and load-data-async properties.
Removed the G_PARAM_CONSTRUCT from the property registration of
"load-async" and "load-data-async". It made it impossible to use only
load-data-async, as the async loading state would be unset when
load-async got set it's default FALSE value.
Robert Bragg [Sun, 21 Jun 2009 23:58:32 +0000 (00:58 +0100)]
[clip-stack] Use signed integers while combining window space clip rectangles
Use signed integers while combining window space clip rectangles, so we avoid
arithmatic errors later resulting in glScissor getting negative width and
height arguments.
Robert Bragg [Sun, 21 Jun 2009 23:00:04 +0000 (00:00 +0100)]
[cogl] Remove unused ctx->polygon_vertices array
This array used to be used by cogl_polygon but was changed to use
ctx->logged_vertices some time ago.
Robert Bragg [Tue, 23 Jun 2009 14:24:42 +0000 (15:24 +0100)]
[cogl] Give the default (fallback) texture a format of RGBA_8888_PRE
Previously this was RGBA_8888. It souldn't really make a difference but for
consistency we expect almost all textures in use to have an internaly
premultiplied pixel format.
Robert Bragg [Fri, 19 Jun 2009 15:39:37 +0000 (16:39 +0100)]
[cogl-texture] use the right format when downloading sliced textures from GL
_cogl_texture_download_from_gl needs to create transient CoglBitmaps when
downloading sliced textures from GL, and then copies these as subregions
into the final target_bitmap. _cogl_texture_download_from_gl also supports
target_bitmaps with a different format to the source CoglTexture being
downloaded.
The problem was that in the case of slice textures we were always looking
at the format of the CoglTexture, not of the target_bitmap when setting
up the transient slice bitmap.
Robert Bragg [Wed, 17 Jun 2009 13:30:44 +0000 (14:30 +0100)]
[cogl] Adds cogl_read_pixels to replace direct use of glReadPixels
To allow for flushing of batched geometry within Cogl we can't support users
directly calling glReadPixels. glReadPixels is also awkward, not least
because it returns upside down image data.
All the unit tests have been swithed over and clutter_stage_read_pixels now
sits on top of this too.
Robert Bragg [Wed, 17 Jun 2009 01:08:31 +0000 (02:08 +0100)]
[cogl matrix] Adds ability to dirty state cached by the client matrix apis
To be able to load matrices to GL manually within Cogl we need a way to
dirty the state cached by the client matrix stack API.
Robert Bragg [Wed, 10 Jun 2009 23:34:00 +0000 (00:34 +0100)]
[debug] Adds a "nop-picking" clutter debug option to NOP _clutter_do_pick()
I've found this is something I do quite often when debugging rendering
problems since its a simple way to wipe out lots of geometry and removes a
lot of unpredictable noise when logging geometry passing through the Cogl
journal.
Robert Bragg [Tue, 16 Jun 2009 21:48:21 +0000 (22:48 +0100)]
[cogl_polygon] fixes a buffer overrun and color format bug
We were calculating our vertex stride and allocating our vertex array
differently depending on whether the user passed TRUE for use_color or not.
The problem was that we were always writting color data to the array
regardless of use_color.
There was also a bug with _cogl_texture_sliced_polygon in that it was
writing byte color components but we were expecting float components. We
now use byte components in _cogl_multitexture_unsliced_polygon too and pass
GL_UNSIGNED_BYTE to glColorPointer.
Robert Bragg [Mon, 15 Jun 2009 23:45:44 +0000 (00:45 +0100)]
[test-cogl-tex-getset] Assume a premultiplied pixel format
test-cogl-tex-getset was assuming it was dealing with
COGL_PIXEL_FORMAT_RGBA_8888 but since merging the premultiplcation branch
the pixel format is actually COGL_PIXEL_FORMAT_RGBA_8888_PRE
Robert Bragg [Wed, 17 Jun 2009 14:03:33 +0000 (15:03 +0100)]
[vertex-buffer] Add cogl_vertex_buffer_indices_get_type API
cogl_vertex_buffer_indices lets you query back the data type used for the
given indices handle.
Robert Bragg [Wed, 17 Jun 2009 14:02:56 +0000 (15:02 +0100)]
[vertex-buffer] Remove the COGL_INDICES_TYPE_UNSIGNED_INT indicies type
Since some embedded GPUs may not support 32bit integer indices we wont
include it until there is a particular need.
Damien Lespiau [Thu, 25 Jun 2009 14:06:41 +0000 (16:06 +0200)]
[cogl] Add COGL_HAS_GL and COGL_HAS_GLES
Cogl already add similar defines but with the CLUTTER namespace
(CLUTTER_COGL_HAS_GL and CLUTTER_COGL_HAS_GLES). Let's just add two
similar defines with the COGL namespace. Removing the CLUTTER_COGL ones
could break applications silently for no real good reason.
Damien Lespiau [Thu, 25 Jun 2009 13:59:11 +0000 (15:59 +0200)]
[misc] Update headers #endif comments
While grepping through the public headers looking for invalid use of
private HAVE_* defines, I stumbled upon two out of sync comments. Yes
it's a very minor trivial change.
Emmanuele Bassi [Mon, 29 Jun 2009 15:34:49 +0000 (16:34 +0100)]
[actor] Remove unused clutter_actor_pick()
The clutter_actor_pick() function just emits the ::pick signal
on the actor. Nobody should be using it, since the paint() method
is already context sensitive and will result in a ::pick emission
by itself. The clutter_actor_pick() is just confusing things.
Emmanuele Bassi [Mon, 29 Jun 2009 15:33:07 +0000 (16:33 +0100)]
Add more debug notes inside the master clock
Emmanuele Bassi [Tue, 23 Jun 2009 14:45:42 +0000 (15:45 +0100)]
[docs] Update after the Input API changes
Emmanuele Bassi [Tue, 23 Jun 2009 14:25:16 +0000 (15:25 +0100)]
[docs] Add an initial porting guide
The Clutter API reference should have a section on how to port
applications from older version of Clutter to the new API.
The first guide deals on how to port animations created with
ClutterEffect to clutter_actor_animate().
Emmanuele Bassi [Tue, 23 Jun 2009 14:23:53 +0000 (15:23 +0100)]
[docs] Fix the ActorBox annotations
The ClutterActorBox API is incorrectly annotated and gtk-doc is unable
to pick it up.
Neil Roberts [Wed, 24 Jun 2009 11:04:55 +0000 (12:04 +0100)]
[test-shader] Fix some of the shaders to use premultiplied colors
Texture data is now in premultiplied format and the shader should
output a premultiplied color if the default blend mode is being
used. Shaders that directly manipulate the rgb values now
unpremultiply and premultiply again afterwards.
Tim Horton [Fri, 19 Jun 2009 02:46:48 +0000 (22:46 -0400)]
Add element-type annotations for animate*v functions
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1653
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Ole André Vadla Ravnås [Thu, 18 Jun 2009 21:53:46 +0000 (23:53 +0200)]
[master clock] Fix MT safety issues
Fix MT issues when enabling threading in Clutter.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1655
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 22 Jun 2009 11:07:08 +0000 (12:07 +0100)]
[texture] Revert to integer parameters in ::size-change
In the int-to-float switch for actor properties, the ::size-change signal
was moved to use floats instead of integers. Sub-pixel precision for image
size is meaningless, though, so we should revert it back to ints.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1659