Commit Graph

3596 Commits

Author SHA1 Message Date
Robert Bragg
d1b4495f7f offscreen-effect: Update handling of transforms
In line with the changes made in f5f066df9c to clean up how Clutter
deals with transformations of actors this patch updates the code in
clutter-offscreen-effect.c. We now query the projection matrix from the
stage instead of the perspective and instead of duplicating the logic to
setup the stage view transform we now use
_clutter_actor_apply_modelview_transform for the stage instead.
2010-09-16 13:27:59 +01:00
Emmanuele Bassi
037a1b82cc build: Add cogl-debug-options.h 2010-09-15 16:12:56 +01:00
Emmanuele Bassi
7d2706e8ba docs: Fix the name of the parameters 2010-09-15 16:12:56 +01:00
Neil Roberts
7338541452 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
42dacf97f8 cogl-vertex-buffer: Don't always set COGL_MATERIAL_FLUSH_FALLBACK_MASK
Previously CoglVertexBuffer would always set the flush options flags
to at least contain COGL_MATERIAL_FLUSH_FALLBACK_MASK. The code then
later checks whether any flags are set before deciding whether to copy
the material to implement the overrides. This means that it would
always end up copying the material even if there are no fallback
layers. This patch changes it so that it only sets
COGL_MATERIAL_FLUSH_FALLBACK_MASK if fallback_layers != 0.
2010-09-15 14:28:44 +01:00
Robert Bragg
8cfb158f63 material-arbfp: fix updating params if sharing progs
If a single arbfp program is being shared between multiple CoglMaterials
then we need to make sure we update all program.local params when
switching between materials. Previously we had a dirty flag to track
when combine_constant params were changed but didn't take in to account
that different materials sharing the same program may have different
combine constants.
2010-09-15 14:07:50 +01:00
Robert Bragg
d87522596d material-arbfp: Another pass at simplifying the code
Previously the backend private state was used to either link to an
authority material or provide authoritative program state. The mechanism
seemed overly complex and felt very fragile. I made a recent comment
which added a lot of documentation to make it easier to understand but
still it didn't feel very elegant.

This patch takes a slightly different approach; we now have a
ref-counted ArbfpProgramState object which encapsulates a single ARBfp
program and the backend private state now just has a single member which
is a pointer to one of these arbfp_program_state objects. We no longer
need to cache pointers to our arbfp-authority and so we can get rid of
a lot of awkward code that ensured these pointers were
updated/invalidated at the right times. The program state objects are
not tightly bound to a material so it will also allow us to later
implement a cache mechanism that lets us share state outside a materials
ancestry. This may help to optimize code not following the
recommendations of deriving materials from templates, avoiding one-shot
materials and not repeatedly modifying materials because even if a
material's ancestry doesn't naturally lead us to shareable state we can
fallback to searching for shareable state using central hash tables.
2010-09-15 14:07:50 +01:00
Robert Bragg
f6dc3ddcba material: Adds experimental cogl_material_foreach_layer API
This adds a way to iterate the layer indices of the given material since
cogl_material_get_layers has been deprecated. The user provides a
callback to be called once for each layer.

Because modification of layers in the callback may potentially
invalidate any number of the internal CoglMaterialLayer structures and
invalidate the material's layer cache this should be more robust than
cogl_material_get_layers() which used to return a const GList *
pointing directly to internal state.
2010-09-15 14:07:50 +01:00
Robert Bragg
d5eebedaa3 material: don't declare backend vtables in headers
This fixes the material backends to declare their constant vtable in the
c file with a corresponding extern declaration in the header. This
should fix complaints about duplicate symbols seen on OSX.
2010-09-15 14:07:50 +01:00
Robert Bragg
5583d9c12e material-arbfp: don't recompile for constant changes
Instead of lazily incorporating combine constants as arbfp PARAM
constants in the source directly we now use program.local parameters
instead so we can avoid repeating codegen if a material's combine
constant is updated. This should be a big win for applications animating
a constant used for example in an animated interpolation, such as
gnome-shell.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2280
2010-09-15 14:07:50 +01:00
Robert Bragg
2815cf4719 material-arbfp: don't redo codegen for texture changes
This makes it so we don't consider LAYER_STATE_TEXTURE changes to affect
the arbfp code. This should avoid a lot of unneeded passes of
code generation for applications modifying the texture for a layer.
2010-09-15 14:07:49 +01:00
Robert Bragg
3adeef6604 material: make layer/material_pre_changes mutually exclusive
This makes it so we only notify backends of either a single material
change or a single layer change. Previously all material STATE_LAYERS
changes would be followed by a more detailed layer change.

For backends that perform code generation for fragment processing they
typically need to understand the details of how layers get changed to
determine if they need to repeat codegen. It doesn't help them to report
a material STATE_LAYERS change for all layer changes since it's so
broad, they really need to wait for the layer change to be notified.

What does help though is to report a STATE_LAYERS change for a change in
material->n_layers because they typically do need to repeat codegen in
that case.
2010-09-15 14:07:49 +01:00
Robert Bragg
16e9794318 material-arbfp: fixes for how we track private state
This fixes a number of issues relating to how we track the arbfp private
state associated with CoglMaterials. At the same time it adds much more
extensive code documentation to try and make it a bit more approachable.
2010-09-15 14:07:49 +01:00
Robert Bragg
a114843f74 material: pass material owner for layer pre changes
When notifying a backend about a layer being modified we now pass the
layers current owner for reference. NB: Although a layer can indirectly
be referenced by multiple layers, a layer is considered immutable once
it has dependants, so there is only ever one material associated with a
layer being modified. Passing the material pointer to the backends
layer_pre_change callback can be useful for backends that associate
their private state with materials and may need to update that state in
response to layer changes.
2010-09-15 14:07:49 +01:00
Robert Bragg
d9a32f979c arbfp: rename get_arbfp_authority clarifying semantics
This renames the get_arbfp_authority function to
get_arbfp_authority_no_check to clarify that the function doesn't
validate that the authority cache is still valid by looking at the age
of the referenced material. The function should only be used when we
*know* the cache has already been checked.
2010-09-15 14:07:49 +01:00
Robert Bragg
ed1123a06b material: track if material change is layer change
We now pass a boolean to _cogl_material_pre_change_notify to know when
a material change is as a result of a layer change. We plan to use this
information to avoid notifying the backends about material changes if
they are as a result of layer changes. This will simplify the handling
of state changes in the backends because they can assume that layer and
material changes are mutually exclusive.
2010-09-15 14:07:49 +01:00
Robert Bragg
53acf4d1b0 material: Adds _get_layer_combine_constant API
This adds an internal _cogl_material_get_layer_combine_constant function
so we can query the current layer combine constant back. We should
probably make this a public property getter, but for now we just need
this so we can read the constant in the arbfp backend.
2010-09-15 14:07:49 +01:00
Robert Bragg
7f95015c6d material: track unit state with arbfp private state
We are going to start tracking more per-texture unit state with arbfp
private state so this adds an internal UnitState type and we allocate an
array of these when setting up a new private state structure. The first
thing that has been moved into this is the sampled boolean to know when
a particular texture unit gets sampled from in the generated arbfp code.
2010-09-15 14:07:49 +01:00
Emmanuele Bassi
98516061c3 Enumeration value should be on the same line
The glib-mkenums script is not clever enough to deal with

  FLAGS_VALUE = FLAGS_A |
                FLAGS_B

And since this breaks the enumeration GType and the introspection data,
we cannot really wait for it to be fixed.

See: https://bugzilla.gnome.org/show_bug.cgi?id=629741

http://bugzilla.clutter-project.org/show_bug.cgi?id=2238
2010-09-15 11:56:59 +01:00
Robert Bragg
d45c1671d1 cogl-framebuffer: fix leak when popping framebuffer
We were using g_slist_remove_link instead of g_slist_delete_link
resulting in a memory leak. Thanks to Simon Lanzmich for
reporting this bug.
2010-09-14 14:19:39 +01:00
Robert Bragg
88023d438d Initialize the cogl uprof state in cogl_create_context
This avoids the use of of gcc constructor and destructor attributes to
initialize the cogl uprof context and optionally print a cogl uprof
report at app exit. We now initialize the uprof context in
cogl_context_create instead.
2010-09-14 12:43:17 +01:00
Robert Bragg
d9ee3be835 journal: provide more detailed uprof instrumentation
This adds more timing around key stages of the journal flushing process.
2010-09-14 12:43:17 +01:00
Robert Bragg
fb7bf9ce02 profile: Update to uprof-0.3 dep for --enable-profile
When building with --enable-profile we now depend on the uprof-0.3
developer release which brings a few improvements:

» It lets us "fix" how we initialize uprof so that instead of using a shared
object constructor/destructor (which was a hack used when first adding
uprof support to Clutter) we can now initialize as part of clutter's
normal initialization code. As a side note though, I found that the way
Clutter initializes has some quite serious problems whenever it
involves GOptionGroups. It is not able to guarantee the initialization
of dependencies like uprof and Cogl. For this reason we still use the
contructor/destructor approach to initialize uprof in Cogl.

» uprof-0.3 provides a better API for adding custom columns when reporting
timer and counter statistics which lets us remove quite a lot of manual
report generation code in clutter-profile.c.

» uprof-0.3 provides a shared context for tracking mainloop timer
statistics. This means any mainloop based library following the same
"Mainloop" timer naming convention can use the shared context and no
matter who ends up owning the final mainloop the statistics will always
be in the same place. This allows profiling of Clutter with an
external mainloop such as with the Mutter compositor.

» uprof-0.3 can export statistics over dbus and comes with an ncurses
based ui to vizualize timer and counter stats live.

The latest version of uprof can be cloned from:
git://github.com/rib/UProf.git
2010-09-14 12:43:16 +01:00
Neil Roberts
a45f67bbdc cogl-framebuffer: Clear the renderbuffer list on failure
When try_creating_fbo fails it deletes any intermediate render buffers
that were created. However it doesn't clear the list so I think if it
failed a second time it would try to delete the render buffers
again. This could potentially cause problems if a subsequent fbo is
created because the destructor for the original might delete the
renderbuffers of the new fbo.
2010-09-13 18:54:02 +01:00
Robert Bragg
570fa3f044 clone: scale src with apply_transform not cogl_scale
Since a ClutterClone may be allocated a different size than its source
actor we need to apply a scale factor before painting the source actor.
We were manually using cogl_scale to do this in clutter_clone_paint but
really this kind of thing is best handled in an implementation of the
apply_transform virtual so Clutter can be aware of the transform for
other purposes, such as input transformations. Also we want to provide
an implementation of the get_paint_volume virtual where Clutter will
also expect to be able to use the apply_transform virtual to transform
the volume into its parent's coordinate space.
2010-09-13 18:18:35 +01:00
Robert Bragg
ad398d583b glx: Mark stage clip initialized even for NULL user clip
If a NULL clip is passed to clutter_stage_glx_add_redraw_clip then we
update the redraw clip to have width of 0, but we weren't setting
stage_glx->initialized_redraw_clip = TRUE. This could result in a full,
unclipped stage redraw being reduced to a clipped redraw.
2010-09-13 18:18:35 +01:00
Robert Bragg
8d2a3d6088 actor: warn if allocating actor not descending from stage
This adds a verbose warning that will be displayed if
clutter_actor_allocate is passed an actor that isn't a descendent of a
ClutterStage. Layouting should always bubble up from a stage so this
condition is likely to indicate a buggy container that allocating a
child that it has already unparented.
2010-09-13 18:18:34 +01:00
Robert Bragg
ff4c24f0a4 geometry: Adds a clutter_geometry_intersects API
This adds a public function named clutter_geometry_intersects which
determines if two geometries intersect or not returning TRUE if so else
FALSE.
2010-09-13 18:18:34 +01:00
Emmanuele Bassi
8a2e164354 actor-box: Correctly clamp to pixel
Use ceilf() to round up the right side of the actor's box, and floorf()
to round down the left side.
2010-09-13 18:18:34 +01:00
Robert Bragg
f5f066df9c Try to clean up how we handle actor transformations
When building actor relative transforms, instead of using the matrix
stack to combine transformations and making assumptions about what is
currently on the stack we now just explicitly initialize an identity
matrix and apply transforms to that.

This removes the full_vertex_t typedef for internal transformation code
and we just use ClutterVertex.

ClutterStage now implements apply_transform like any other actor now
and the code we had in _cogl_setup_viewport has been moved to the
stage's apply_transform instead.

ClutterStage now tracks an explicit projection matrix and viewport
geometry. The projection matrix is derived from the perspective whenever
that changes, and the viewport is updated when the stage gets a new
allocation. The SYNC_MATRICES mechanism has been removed in favour of
_clutter_stage_dirty_viewport/projection() APIs that get used when
switching between multiple stages to ensure cogl has the latest
information about the onscreen framebuffer.
2010-09-13 18:18:34 +01:00
Robert Bragg
ab008948cf actor: Add _get_stage_internal to clutter-private.h
This adds _clutter_actor_get_stage_internal to clutter-private.h since
we plan to use it in clutter-offscreen-effect when preparing to
redirect an actor offscreen.
2010-09-13 18:18:34 +01:00
Murray Cumming
28f28c0309 Remove trailin enum commas, avoiding C++ warnings.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2314
2010-09-13 15:45:55 +01:00
Alejandro Piñeiro
209bef6f8a cally: fixing public headers
Cally headers were including specific clutter object headers.

This caused a problem including cally.h on a external program.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2234
2010-09-13 12:19:54 +01:00
Emmanuele Bassi
dec0863f58 build: Add tesselator to the include paths 2010-09-13 11:31:46 +01:00
Emmanuele Bassi
94e2c7a949 build: Generate ClutterJson in the top directory
Instead of doing the shlib trick, build ClutterJson (if needed) inside
the top-level clutter/ directory - similar to a non-recursive layout.

Hopefully, one day, we'll be able to do this with a real non-recursive
layout.
2010-09-13 02:26:47 +01:00
Emmanuele Bassi
c03458a861 build: Remove gir files from dist
The introspection data is going to be generated, so it should never be
in the dist.
2010-09-13 02:10:35 +01:00
Emmanuele Bassi
64924f0e98 build: Do not build a noinst library for the tesselator
Let's try to keep Cogl's build as non-recursive as possible, in the hope
that one day we'll be able to make it fully non-recursive along with the
rest of Clutter.
2010-09-12 19:25:47 +01:00
Emmanuele Bassi
4ee05f8e21 keysyms: Update the macros to CLUTTER_KEY_*
The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.

This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:

  - clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
  - clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*

The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.

This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
2010-09-10 17:54:52 +01:00
Lucas Rocha
1447eff00f introspection: Add full path for the Clutter-1.0 inclusion
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-10 17:51:19 +01:00
Emmanuele Bassi
edb54574fa build: Disable deprecated API when building Clutter
Make sure we don't use deprecated API internally by adding
CLUTTER_DISABLE_DEPRECATED to the AM_CPPFLAGS.

This requires adding -UCLUTTER_DISABLE_DEPRECATED to the introspection
scanner CFLAGS, otherwise the deprecated API will never be introspected
and the data generated will not be compatible.
2010-09-10 17:51:18 +01:00
Emmanuele Bassi
d76f64a10c Do not use deprecated API internally 2010-09-10 17:51:13 +01:00
Emmanuele Bassi
01362effca actor: Add a method for querying key focus
A simple convenience method on Clutter.Actor for checking whether
it has key focus assigned on the Stage to which it belongs.
2010-09-10 11:42:11 +01:00
Emmanuele Bassi
71a4db6135 animation: Allow detaching an animation from an actor
When animating an actor through clutter_actor_animate() and friends we
might want forcibly detach the animation instance from the actor in
order to start a new one - for instance, in response to user
interaction.

Currently, there is no way to do that except in a very convoluted way,
by emitting the ::completed signal and adding a special case in the
signal handlers; this is due to the fact that clutter_actor_animate()
adds more logic than the one added by clutter_animation_set_object(),
so calling set_object(NULL) or unreferencing the animation instance
itself won't be enough.

The right way to approach this is to add a new method to Clutter.Actor
that detaches any eventual Animation currently referencing it.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2051
2010-09-10 11:18:53 +01:00
Colin Walters
3aa2d00c3b introspection: Don't look for installed Cogl-1.0.gir
If we're depending on an uninstalled .gir, use --include-uninstalled.
We need to explicitly specify Cogl to let the scanner know it's also
uninstalled.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-09 23:01:40 +01:00
Colin Walters
5f5369990f introspection: Don't look for installed Clutter-1.0.gir
If we're depending on an uninstalled .gir, use --include-uninstalled.
2010-09-09 18:44:03 +01:00
Chris Kühl
d86dc377de Added documentation for alpha parameter in Behaviour constructors.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2304

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-09 16:34:21 +01:00
Neil Roberts
9e1cd15b48 cogl-vertex-buffer: Flush the framebuffer state first
Flushing the framebuffer state can cause some drawing to occur if the
framebuffer has a clip stack which needs the stencil buffer. This was
causing the array pointers set up by enable_state_for_drawing_buffer
to get mangled so it would crash when it hits glDrawArrays. This patch
moves the framebuffer state flush to before it sets up the array
pointers.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2297
2010-09-09 12:19:53 +01:00
Robert Bragg
bcf20955d3 ClutterX11TexturePixmap: Fix unbalanced error trapping
I think this is what commit 2cf1405506 intended to do since it
specifically mentioned cleaning up the trap in
clutter_x11_texture_pixmap_set_pixmap, but although it moved the untrap
to only be done in the case where Pixmap != None it left the position of
the trap itself unchanged. This meant the error trapping wouldn't be
balanced if pixmap == None since the untrap wouldn't be done. We now
only trap and untrap around the XGetGeometry call done when pixmap !=
None.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2303
2010-09-09 11:18:53 +01:00
Emmanuele Bassi
089a20e79d build: Add ClutterX11 introspection generation 2010-09-08 18:27:12 +01:00
Emmanuele Bassi
f8bd45dbce x11-texture-pixmap: Do not go through g_object_get()
The pixmap width and height are stored in our own private data
structure; going through g_object_get() is pointless overhead.
2010-09-08 17:39:04 +01:00