profile/ivi/clutter.git
13 years agoRemove the GLES2 wrapper
Neil Roberts [Sun, 5 Dec 2010 18:02:05 +0000 (18:02 +0000)]
Remove the GLES2 wrapper

The GLES2 wrapper is no longer needed because the shader generation is
done within the GLSL fragend and vertend and any functions that are
different for GLES2 are now guarded by #ifdefs.

13 years agocogl-pipeline: Use enums for the layer combine values
Neil Roberts [Mon, 6 Dec 2010 21:29:56 +0000 (21:29 +0000)]
cogl-pipeline: Use enums for the layer combine values

Once the GLES2 wrapper is removed then we won't have the GLenums
needed for setting up the layer combine state. This adds Cogl enums
instead which have the same values as the corresponding GLenums. The
enums are:

CoglPipelineCombineFunc
CoglPipelineCombineSource
 and
CoglPipelineCombineOp

13 years agocogl: upload matrices with uniforms on GLES2
Neil Roberts [Mon, 6 Dec 2010 12:31:51 +0000 (12:31 +0000)]
cogl: upload matrices with uniforms on GLES2

Once the GLES2 wrapper is removed we won't be able to upload the
matrices with the fixed function API any more. The fixed function API
gives a global state for setting the matrix but if a custom shader
uniform is used for the matrices then the state is per
program. _cogl_matrix_stack_flush_to_gl is called in a few places and
it is assumed the current pipeline doesn't need to be flushed before
it is called. To allow these semantics to continue to work, on GLES2
the matrix flush now just stores a reference to the matrix stack in
the CoglContext. A pre_paint virtual is added to the progend which is
called whenever a pipeline is flushed, even if the same pipeline was
flushed already. This gives the GLSL progend a chance to upload the
matrices to the uniforms. The combined modelview/projection matrix is
only calculated if it is used. The generated programs end up never
using the modelview or projection matrix so it usually only has to
upload the combined matrix. When a matrix stack is flushed a reference
is taked to it by the pipeline progend and the age is stored so that
if the same state is used with the same program again then we don't
need to reupload the uniform.

13 years agocogl-matrix-stack: Add _cogl_matrix_stack_has_identity_flag
Neil Roberts [Fri, 10 Dec 2010 17:42:39 +0000 (17:42 +0000)]
cogl-matrix-stack: Add _cogl_matrix_stack_has_identity_flag

This adds an internal function to quickly determine whether the top of
the matrix stack is known to be the identity matrix.

13 years agocogl-matrix-stack: Convert to be a CoglObject
Neil Roberts [Fri, 10 Dec 2010 16:06:16 +0000 (16:06 +0000)]
cogl-matrix-stack: Convert to be a CoglObject

We will want to use ref-counting on the CoglMatrixStack so it might as
well be a CoglObject.

13 years agomatrix-stack: Make header style consistent
Robert Bragg [Fri, 10 Dec 2010 11:34:02 +0000 (11:34 +0000)]
matrix-stack: Make header style consistent

Cogl doesn't follow the Clutter/GTK+ columnized function prototype style
so this updates cogl-matrix-stack.h to match the other Cogl headers.

13 years agomatrix-stack: Adds a stack age counter
Robert Bragg [Fri, 10 Dec 2010 11:13:09 +0000 (11:13 +0000)]
matrix-stack: Adds a stack age counter

Sometimes it would be useful if we could efficiently track when a matrix
stack has been modified. For example on GLES2 we have to upload the
modelview as a uniform to our glsl programs but because the modelview
state is part of the framebuffer state it becomes a bit more tricky to
know when to re-sync the value of the uniform with the framebuffer
state. This adds an "age" counter to CoglMatrixStack which is
incremented for any operation that effectively modifies the top of the
stack so now we can save the age of the stack inside the pipeline
whenever we update modelview uniform and later compare that with the
stack to determine if it has changed.

13 years agocogl-pipeline: Add internal API to get the layer matrix
Neil Roberts [Mon, 6 Dec 2010 12:31:16 +0000 (12:31 +0000)]
cogl-pipeline: Add internal API to get the layer matrix

This returns the layer matrix given a pipeline and a layer index. The
API is kept as internal because it directly returns a pointer into the
layer private data to avoid a copy into an out-param. We might also
want to add a public function which does the copy.

13 years agocogl-vertex-attribute: Use glVertexAttribPointer on GLES2
Neil Roberts [Fri, 3 Dec 2010 17:46:16 +0000 (17:46 +0000)]
cogl-vertex-attribute: Use glVertexAttribPointer on GLES2

When the GLES2 wrapper is removed we can't use the fixed function API
such as glColorPointer to set the builtin attributes. Instead the GLSL
progend now maintains a cache of attribute locations that are queried
with glGetAttribLocation. The code that previously maintained a cache
of the enabled texture coord arrays has been modified to also cache
the enabled vertex attributes under GLES2. The vertex attribute API is
now the only place that is using this cache so it has been moved into
cogl-vertex-attribute.c

13 years agocogl-path: Stroke using the vertex attribute API
Neil Roberts [Fri, 3 Dec 2010 11:31:09 +0000 (11:31 +0000)]
cogl-path: Stroke using the vertex attribute API

Previously when stroking a path it was flushing a pipeline and then
directly calling glDrawArrays to draw the line strip from the path
nodes array. This patch changes it to build a CoglVertexArray and a
series of attributes to paint with instead. The vertex array and
attributes are attached to the CoglPath so it can be reused later. The
old vertex array for filling has been renamed to fill_vbo.

13 years agocogl: Move COGL_DEBUG=show-source into cogl-shader.c
Neil Roberts [Thu, 2 Dec 2010 22:19:44 +0000 (22:19 +0000)]
cogl: Move COGL_DEBUG=show-source into cogl-shader.c

The code to display the source when the show-source debug option is
given has been moved to _cogl_shader_set_source_with_boilerplate so
that it will show both user shaders and generated shaders. It also
shows the code with the full boilerplate. To make it the same for
ARBfp, cogl_shader_compile_real now also dumps user ARBfp shaders.

13 years agocogl: Add a vertend to generate GLSL
Neil Roberts [Thu, 2 Dec 2010 20:48:45 +0000 (20:48 +0000)]
cogl: Add a vertend to generate GLSL

The GLSL vertend is mostly only useful for GLES2. The fixed function
vertend is kept at higher priority than the GLSL vertend so it is
unlikely to be used in any other circumstances.

13 years agocogl-shader-boilerplate: Don't put the color attrib in location 0
Neil Roberts [Tue, 7 Dec 2010 12:33:39 +0000 (12:33 +0000)]
cogl-shader-boilerplate: Don't put the color attrib in location 0

Due to Mesa bug 28585 calling glVertexAttrib with attrib location 0
doesn't appear to work. This patch just reorders the vertex and color
attributes in the shader in the hope that Mesa will assign the color
attribute to a different location.

13 years agocogl-shader-boilerplate: Add more builtins for GLES2
Neil Roberts [Thu, 2 Dec 2010 22:08:51 +0000 (22:08 +0000)]
cogl-shader-boilerplate: Add more builtins for GLES2

Some builtin attributes such as the matrix uniforms and some varyings
were missing from the boilerplate for GLES2. This also moves the
texture matrix and texture coord attribute declarations to
cogl-shader.c so that they can be dynamically defined depending on the
number of texture coord arrays enabled.

13 years agocogl-pipeline: Rename the fragment_{source,header}_buffer to codegen
Neil Roberts [Thu, 2 Dec 2010 18:05:22 +0000 (18:05 +0000)]
cogl-pipeline: Rename the fragment_{source,header}_buffer to codegen

We want to reuse the same buffers for vertends so calling them
fragment_* doesn't make sense.

13 years agocogl: Add a fixed function vertend
Neil Roberts [Mon, 29 Nov 2010 18:32:21 +0000 (18:32 +0000)]
cogl: Add a fixed function vertend

The vertends are intended to flush state that would be represented in
a vertex program. Code to handle the layer matrix, lighting and
point size has now been moved from the common cogl-pipeline-opengl
backend to the fixed vertend.

13 years agocogl: Add a GLSL 'progend'
Neil Roberts [Thu, 2 Dec 2010 14:00:46 +0000 (14:00 +0000)]
cogl: Add a GLSL 'progend'

'progend' is short for 'program backend'. The progend is intended to
operate on combined state from a fragment backend and a vertex
backend. The progend has an 'end' function which is run whenever the
pipeline is flushed and the two pipeline change notification
functions. All of the progends are run whenever the pipeline is
flushed instead of selecting a single one because it is possible that
multiple progends may be in use for example if the vertends and
fragends are different. The GLSL progend will take the shaders
generated by the fragend and vertend and link them into a single
program. The fragend code has been changed to only generate the shader
and not the program. The idea is that pipelines can share fragment
shader objects even if their vertex state is different. The authority
for the progend needs to be the combined authority on the vertend and
fragend state.

13 years agocogl-program: Add private functions to check if have each shader type
Neil Roberts [Thu, 2 Dec 2010 13:54:15 +0000 (13:54 +0000)]
cogl-program: Add private functions to check if have each shader type

This adds two internal functions:

gboolean
_cogl_program_has_fragment_shader (CoglHandle handle);

gboolean
_cogl_program_has_vertex_shader (CoglHandle handle);

They just check whether any of the contained shaders are of that type.

13 years agocogl-pipeline: Make find codegen authority more general
Neil Roberts [Wed, 1 Dec 2010 17:06:18 +0000 (17:06 +0000)]
cogl-pipeline: Make find codegen authority more general

The pipeline function _cogl_pipeline_find_codegen_authority has been
renamed to _cogl_pipeline_find_equivalent_parent and it now takes a
set of flags for the pipeline and layer state that affects the
authority. This is needed so that we can reuse the same code in the
vertend and progends.

13 years agocogl-pipeline: Move texture enabling/disabling to fixed fragend
Neil Roberts [Tue, 30 Nov 2010 12:48:27 +0000 (12:48 +0000)]
cogl-pipeline: Move texture enabling/disabling to fixed fragend

Previously enabling and disabling textures was done whatever the
backend in cogl-pipeline-opengl. However enabling and disabling
texture targets only has any meaning if no fragment shaders are being
used so this patch moves the code to cogl-pipeline-fragend-fixed.

The GLES2 wrapper has also been changed to ignore enabledness when
deciding whether to update texture coordinate attribute pointers.

13 years agoRename CoglPipelineBackend to CoglPipelineFragend
Neil Roberts [Mon, 29 Nov 2010 16:56:41 +0000 (16:56 +0000)]
Rename CoglPipelineBackend to CoglPipelineFragend

The current Cogl pipeline backends are entirely concerned with the
fragment processing state. We also want to eventually have separate
backends to generate shaders for the vertex processing state so we
need to rename the fragment backends. 'Fragend' is a somewhat weird
name but we wanted to avoid ending up with illegible symbols like
CoglPipelineFragmentBackendGlslPrivate.

13 years agocogl-pipeline-opengl: Remove the includes for the various backends
Neil Roberts [Thu, 2 Dec 2010 15:37:53 +0000 (15:37 +0000)]
cogl-pipeline-opengl: Remove the includes for the various backends

Nothing in cogl-pipeline-opengl needs to know about the actual backend
implementations, instead it just accesses then through the vtables.

13 years agoanimation: Allow transforming values in bind()
Emmanuele Bassi [Sat, 11 Dec 2010 17:40:52 +0000 (17:40 +0000)]
animation: Allow transforming values in bind()

While we do check for compatibility and transformability of a GValue
with the GParamSpec value type, we are actually failing really badly
at it.

First of all, we bail out on the wrong conditions.

Then we use the type of the value passed instead of using the type
of the property itself.

This makes it impossible to actually use transformation functions for
GValue types - even those that have been registered by GLib itself -
when using the Animation API directly, instead of going through the
clutter_actor_animate() wrappers.

13 years agointrospection: Skip some C-only structures
Emmanuele Bassi [Fri, 10 Dec 2010 17:15:39 +0000 (17:15 +0000)]
introspection: Skip some C-only structures

The ParamSpec sub-classes we define are meant to be used only from the C
API, as high-level languages completely ignore them.

The ClutterStageWindow interface is an internal type that escaped into
the public headers; all its methods are private, but we cannot remove
the type until we break for 2.0.

13 years agointrospection: Add cairo-1.0 to the dependencies
Emmanuele Bassi [Fri, 10 Dec 2010 17:15:23 +0000 (17:15 +0000)]
introspection: Add cairo-1.0 to the dependencies

13 years agoRemove unnecessary duplicate name for private enumerations
Emmanuele Bassi [Fri, 10 Dec 2010 16:03:10 +0000 (16:03 +0000)]
Remove unnecessary duplicate name for private enumerations

13 years agodocs: Update NEWS
Emmanuele Bassi [Thu, 9 Dec 2010 16:05:55 +0000 (16:05 +0000)]
docs: Update NEWS

13 years agodocs: Add 1.6 index to the API references
Emmanuele Bassi [Thu, 9 Dec 2010 15:52:04 +0000 (15:52 +0000)]
docs: Add 1.6 index to the API references

13 years agoUse G_STRFUNC correctly
Emmanuele Bassi [Thu, 9 Dec 2010 15:42:19 +0000 (15:42 +0000)]
Use G_STRFUNC correctly

It cannot be chained up via the pre-processor.

13 years agoRename the EGLDisplay accessors
Emmanuele Bassi [Thu, 9 Dec 2010 15:11:37 +0000 (15:11 +0000)]
Rename the EGLDisplay accessors

The accessor for the EGL display should be namespaced for the correct
backend-specific API.

13 years agodocs: Documentation fixes
Emmanuele Bassi [Thu, 9 Dec 2010 15:06:12 +0000 (15:06 +0000)]
docs: Documentation fixes

13 years agodocs: Documentation fixes
Emmanuele Bassi [Thu, 9 Dec 2010 13:59:08 +0000 (13:59 +0000)]
docs: Documentation fixes

13 years agobuild: Check NEWS file during release, not distcheck
Emmanuele Bassi [Thu, 9 Dec 2010 13:49:01 +0000 (13:49 +0000)]
build: Check NEWS file during release, not distcheck

The check-news option in configure.ac conflicts with the idea of using a
buildbot to do a distcheck.

Since we're doing some validation on the state of the build during the
release-check phase we should add the NEWS file check there.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2468

13 years agocookbook: Remove bold on emphasis inside programlisting
Elliot Smith [Thu, 9 Dec 2010 11:40:27 +0000 (11:40 +0000)]
cookbook: Remove bold on emphasis inside programlisting

If an <emphasis> element is placed inside a <programlisting> in a cookbook
recipe, the result is bold italic text in the HTML output. This isn't
particularly readable.

Fix is to style emphasis elements inside programlistings
so the font weight is not bold but is still italicised.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2475

13 years agotests: Add test for clutter_model_get_iter_at_row()
Jussi Kukkonen [Thu, 2 Dec 2010 14:08:10 +0000 (16:08 +0200)]
tests: Add test for clutter_model_get_iter_at_row()

http://bugzilla.clutter-project.org/show_bug.cgi?id=2460

13 years agoFix clutter_list_model_get_iter_at_row() when filtered
Jussi Kukkonen [Thu, 2 Dec 2010 14:27:36 +0000 (16:27 +0200)]
Fix clutter_list_model_get_iter_at_row() when filtered

Currently clutter_list_model_get_iter_at_row() always returns an
iterator to the last non-filtered row  when asking for row [1-N].

Patch makes the function return an iterator to the Nth non-filtered
row or NULL.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2460

13 years agowayland: Update to current api
nobled [Tue, 7 Dec 2010 07:10:59 +0000 (07:10 +0000)]
wayland: Update to current api

Adapt to changes from these wayland commits:
35fd2a8cc68c42d90756330535de04cbbb4d2613
2bb3ebe1e437acf836449f0a63f3264ad29566f2
f8fc08f77187f6a5723281dab66841e5f3c24320

http://bugzilla.clutter-project.org/show_bug.cgi?id=2474

13 years agowayland: fix typo
nobled [Tue, 7 Dec 2010 07:07:40 +0000 (07:07 +0000)]
wayland: fix typo

Fixes the build error:

clutter-input-device-wayland.c:154:69:
error: too few arguments to function call

http://bugzilla.clutter-project.org/show_bug.cgi?id=2473

13 years agobuild: Do not hardcode --warn-all for g-ir-scanner
Emmanuele Bassi [Thu, 9 Dec 2010 12:37:41 +0000 (12:37 +0000)]
build: Do not hardcode --warn-all for g-ir-scanner

It's possible to use --warn-all through the introspection scanner
options from outside the build environment.

13 years agoReduce the amount of g-ir-scanner warnings
Emmanuele Bassi [Thu, 9 Dec 2010 12:36:50 +0000 (12:36 +0000)]
Reduce the amount of g-ir-scanner warnings

As much as we can; the remaining warnings are mostly valid things that
the introspection scanner still flags as potential issues.

13 years agodocs: Use :reverse in the Behaviour migration guide
Emmanuele Bassi [Thu, 9 Dec 2010 12:00:29 +0000 (12:00 +0000)]
docs: Use :reverse in the Behaviour migration guide

Instead of the ::completed signal flip.

13 years agoMerge remote branch 'elliot/cookbook-animations-looping-new-api'
Emmanuele Bassi [Thu, 9 Dec 2010 11:58:10 +0000 (11:58 +0000)]
Merge remote branch 'elliot/cookbook-animations-looping-new-api'

* elliot/cookbook-animations-looping-new-api:
  cookbook: Use new API to reverse timeline

13 years agoMake clutter_shader_effect_set_uniform_value accept G_TYPE_DOUBLE
Tomeu Vizoso [Tue, 7 Dec 2010 14:29:05 +0000 (15:29 +0100)]
Make clutter_shader_effect_set_uniform_value accept G_TYPE_DOUBLE

For users of gobject-introspection that cannot know which
non-integer type to pass.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2471

13 years agopipeline: don't dereference NULL program state
Robert Bragg [Wed, 8 Dec 2010 18:57:42 +0000 (18:57 +0000)]
pipeline: don't dereference NULL program state

This avoid dereferencing a NULL arbfp program state in
_cogl_pipeline_backend_arbfp_layer_pre_change_notify for
_STATE_COMBINE_CONSTANT changes.

13 years agoarbfp: Copy pipelines used as cache keys
Robert Bragg [Wed, 8 Dec 2010 16:29:37 +0000 (16:29 +0000)]
arbfp: Copy pipelines used as cache keys

We are currently using a pipeline as a key into our arbfp program cache
but because we weren't making a copy of the pipelines used as keys there
were times when doing a lookup in the cache would end up trying to
compare a lookup key with an entry key that would point to invalid
memory.

Note: the current approach isn't ideal from the pov that that key
pipeline may reference some arbitrarily large user textures will now be
kept alive indefinitely. The plan to improve on this is that we will
have a mechanism to create a special "key pipeline" which will derive
from the default Cogl pipeline (to avoid affecting the lifetime of
other pipelines) and only copy state from the original pipeline that
affects the arbfp program and will reference small dummy textures
instead of potentially large user textures.

13 years agoarbfp: initialize arbfp_program_state->next_constant_id
Robert Bragg [Wed, 8 Dec 2010 16:27:57 +0000 (16:27 +0000)]
arbfp: initialize arbfp_program_state->next_constant_id

When allocating a new ArbfpProgramState struct when starting code
generation we weren't initializing arbfp_program_state->next_constant_id
to 0.

13 years agopipeline: Clarify stages for finding an arbfp program
Robert Bragg [Wed, 8 Dec 2010 16:23:10 +0000 (16:23 +0000)]
pipeline: Clarify stages for finding an arbfp program

In the arbfp backend there is a seqential approach to finding a suitable
arbfp program to use for a given pipeline; first we see if there's
already a program associated with the pipeline, 2nd we try and find a
program associated with the "arbfp-authority" 3rd we try and lookup a
program in a cache and finally we resort to starting code-generation for
a new program. This patch slightly reworks the code of these steps to
hopefully make them a bit clearer.

13 years agocogl-pipeline: Fix the layer_has_alpha_cb
Neil Roberts [Mon, 6 Dec 2010 21:14:33 +0000 (21:14 +0000)]
cogl-pipeline: Fix the layer_has_alpha_cb

_cogl_pipeline_needs_blending_enabled tries to determine whether each
layer is using the default combine state. However it was using
argument 0 for both checks so the if-statement would never be true.

13 years agopipeline: remove unused HashState member
Robert Bragg [Wed, 8 Dec 2010 11:38:56 +0000 (11:38 +0000)]
pipeline: remove unused HashState member

There was an unused pipeline_differences member as part of the HashState
struct which this patch remove to avoid confusion.

13 years agopipeline: initialize HashState flags member
Robert Bragg [Wed, 8 Dec 2010 11:35:16 +0000 (11:35 +0000)]
pipeline: initialize HashState flags member

There are a set of "EvalFlags" that get passed to _cogl_pipeline_hash
that can tweak the semantics of what state is evaluated for hashing but
these flags weren't getting passed via the HashState state structure
so it would be undefined if you would get the correct semantics.

13 years agopipeline: don't use near/far symbols
Robert Bragg [Wed, 8 Dec 2010 11:30:00 +0000 (11:30 +0000)]
pipeline: don't use near/far symbols

According to 9cc90333473e3 the windows headers #define near as nothing,
and presumable the same is true for 'far' too. Apparently this define is
to improve compatibility with code written for Windows 3.1, so it's good
that people will be able to incorporate such code into their Clutter
applications.

13 years agodocs: Fix listitem tag
Emmanuele Bassi [Wed, 8 Dec 2010 14:26:27 +0000 (14:26 +0000)]
docs: Fix listitem tag

13 years agodocs: Clean up clutter_color_from_string()
Emmanuele Bassi [Wed, 8 Dec 2010 13:59:53 +0000 (13:59 +0000)]
docs: Clean up clutter_color_from_string()

Add hsl() and hsla() formats, and clean up the wording.

13 years agocogl-backend-egl: Chain up to the X11 backend init_events
Neil Roberts [Tue, 7 Dec 2010 23:32:47 +0000 (23:32 +0000)]
cogl-backend-egl: Chain up to the X11 backend init_events

Since c6493885c3f18 when building the EGL backend for eglx there was
no fallback in the init_events implementation so the X11 backend init
function would never get called. This was stopping it from receiving
any X events so a lot of things broke. It now just chains up.

13 years agoinput-device: Downgrade over-zealous warning to note
Damien Lespiau [Tue, 7 Dec 2010 22:06:07 +0000 (22:06 +0000)]
input-device: Downgrade over-zealous warning to note

This warning is really harmless, we just discard the event anyway, let's
demote it to a CLUTTER_NOTE() so event backend implementers can see it.

13 years agoclutter-score: Initialize ClutterScoreEntry::complete_id
Neil Roberts [Tue, 7 Dec 2010 11:02:21 +0000 (11:02 +0000)]
clutter-score: Initialize ClutterScoreEntry::complete_id

When clutter_score_append_at_marker is called instead of
clutter_score_append the complete_id field of ClutterScoreEntry was
being left uninitialised. When the entry is eventually freed it would
sometimes try to disconnect an invalid signal id. This was causing
conformance test failures for me on GLES2.

13 years agocontext: only declare arbfp cache for GL
Robert Bragg [Tue, 7 Dec 2010 16:44:36 +0000 (16:44 +0000)]
context: only declare arbfp cache for GL

We were trying to declare and initializing an arbfp program cache for
GLES but since the prototypes for the _hash and _equal functions were
only available for GL this broke the GLES builds. By #ifdefing the code
to conditionally declare/initialize for GL only this should hopefully
fix GLES builds.

13 years agopipeline: remove spurious use of True instead of TRUE
Robert Bragg [Tue, 7 Dec 2010 16:36:44 +0000 (16:36 +0000)]
pipeline: remove spurious use of True instead of TRUE

The constant 'True' is defined by Xlib which isn't used for all clutter
builds so this replaces occurrences of True with TRUE which is defined
by glib. This should hopefully fix the win32 builds.

13 years agoarbfp: Adds an ARBfp program cache
Robert Bragg [Fri, 3 Dec 2010 12:01:18 +0000 (12:01 +0000)]
arbfp: Adds an ARBfp program cache

This adds a cache (A GHashTable) of ARBfp programs and before ever
starting to code-generate a new program we will always first try and
find an existing program in the cache. This uses _cogl_pipeline_hash and
_cogl_pipeline_equal to hash and compare the keys for the cache.

There is a new COGL_DEBUG=disable-program-caches option that can disable
the cache for debugging purposes.

13 years agopipeline: Implements _cogl_pipeline_hash function
Robert Bragg [Thu, 4 Nov 2010 13:57:36 +0000 (13:57 +0000)]
pipeline: Implements _cogl_pipeline_hash function

This allows us to get a hash for a set of state groups for a given
pipeline. This can be used for example to get a hash of the fragment
processing state of a pipeline so we can implement a cache for compiled
arbfp/glsl programs.

13 years agopipeline: generalize _cogl_pipeline_equal
Robert Bragg [Fri, 3 Dec 2010 11:36:49 +0000 (11:36 +0000)]
pipeline: generalize _cogl_pipeline_equal

_cogl_pipeline_equal now accepts a mask of pipeline differences and layer
differences to constrain what state will be compared. In addition a set
of flags are passed that can tweak the comparison semantics for some
state groups. For example when comparing layer textures we sometimes
only need to compare the texture target and can ignore the data itself.

In updating the code this patch also changes it so all required pipeline
authorities are resolved in one step up-front instead of resolving the
authority for each state group in turn and repeatedly having to traverse
the pipeline's ancestry. This adds two new functions
_cogl_pipeline_resolve_authorities and
_cogl_pipeline_layer_resolve_authorities to handle resolving a set of
authorities.

13 years agodocs: don't dist cogl-2.0 manual if not built
Robert Bragg [Tue, 7 Dec 2010 12:13:10 +0000 (12:13 +0000)]
docs: don't dist cogl-2.0 manual if not built

If not configured with --enable-cogl2-reference then don't try and dist
the doc/references/cogl-2.0 manual. Although this means a tarball built
this way will not be able to build the experimental cogl-2.0 manual this
isn't considered a big problem since anyone interested in this would
hopefully be tracking git for now or we can simply be careful to
configure with --enable-cogl2-reference for our tarball releases.

13 years agopipeline: remove layer->backend_priv[] array
Robert Bragg [Wed, 1 Dec 2010 16:53:08 +0000 (16:53 +0000)]
pipeline: remove layer->backend_priv[] array

This removes the unused array of per-packend priv data pointers
associated with every CoglPipelineLayer. This reduces the size of all
layer allocations and avoids having to zero an array for each
_cogl_pipeline_layer_copy.

13 years agocogl-object: remove un-used cogl_object_get_type
Robert Bragg [Wed, 1 Dec 2010 16:37:25 +0000 (16:37 +0000)]
cogl-object: remove un-used cogl_object_get_type

A non-static function named cogl_object_get_type was inadvertently added
during the addition of the CoglObject base type, but there is no public
prototype in the headers and it's only referenced inside cogl-object.c
to implement cogl_handle_get_type() for compatibility. This removes the
function since we don't want to commit to CoglObject always simply being
a boxed type. In the future we may want to register hierarchical
GTypeInstance based types.

13 years agomatrix gtype: registers a boxed type for CoglMatrix
Robert Bragg [Mon, 29 Nov 2010 21:42:06 +0000 (21:42 +0000)]
matrix gtype: registers a boxed type for CoglMatrix

To allow us to have gobject properties that accept a CoglMatrix value we
need to register a GType. This adds a cogl_gtype_matrix_get_type function
that will register a static boxed type called "CoglMatrix".

This adds a new section to the reference manual for GType integration
functions.

13 years agomatrix: Adds matrix_copy and _free functions
Robert Bragg [Mon, 29 Nov 2010 18:47:10 +0000 (18:47 +0000)]
matrix: Adds matrix_copy and _free functions

As a pre-requisite for being able to register a boxed GType for
CoglMatrix (enabling us to define gobject properties that accept a
CoglMatrix) this adds cogl_matrix_copy and _free functions.

13 years agopipeline simple optimization for _needs_blending_enabled
Robert Bragg [Fri, 3 Dec 2010 16:59:52 +0000 (16:59 +0000)]
pipeline simple optimization for _needs_blending_enabled

In _cogl_pipeline_needs_blending_enabled after first checking whether
the property most recently changed requires blending we would then
resort to checking all other properties too in case some other state
also requires blending. We now avoid checking all other properties in
the case that blending was previously disabled and checking the property
recently changed doesn't require blending.

Note: the plan is to improve this further by explicitly keeping track
of the properties that currently cause blending to be enabled so that we
never have to resort to checking all other properties we can constrain
the checks to those masked properties.

13 years agopipeline: inline _get_parent and _get_authority
Robert Bragg [Fri, 3 Dec 2010 16:56:54 +0000 (16:56 +0000)]
pipeline: inline _get_parent and _get_authority

This moves _cogl_pipeline_get_parent and _cogl_pipeline_get_authority
into cogl-pipeline-private.h so they can be inlined since they have been
seen to get quite high in profiles. Given that they both contain such
small amounts of code the function call overhead is significant.

13 years agoAdd a COGL_DEBUG option to disable software clipping
Neil Roberts [Wed, 10 Nov 2010 14:02:31 +0000 (14:02 +0000)]
Add a COGL_DEBUG option to disable software clipping

This adds a debug option called disable-software-clipping which causes
the journal to always log the clip stack state rather than trying to
manually clip rectangles.

13 years agocogl-journal: Attempt to clip manually to avoid breaking up batches
Neil Roberts [Tue, 9 Nov 2010 19:18:37 +0000 (19:18 +0000)]
cogl-journal: Attempt to clip manually to avoid breaking up batches

Before flushing the journal there is now a separate iteration that
will try to determine if the matrix of the clip stack and the matrix
of the rectangle in each entry are on the same plane. If they are it
can completely avoid the clip stack and instead manually modify the
vertex and texture coordinates to implement the clip. The has the
advantage that it won't break up batching if a single clipped
rectangle is used in a scene.

The software clip is only used if there is no user program and no
texture matrices. There is a threshold to the size of the batch where
it is assumed that it is worth the cost to break up a batch and
program the GPU to do the clipping. Currently this is set to 8
although this figure is plucked out of thin air.

To check whether the two matrices are on the same plane it tries to
determine if one of the matrices is just a simple translation of the
other. In the process of this it also works out what the translation
would be. These values can be used to translate the clip rectangle
into the coordinate space of the rectangle to be logged. Then we can
do the clip directly in the rectangle's coordinate space.

13 years agocogl-clip-stack: Move the struct definitions to the header
Neil Roberts [Tue, 9 Nov 2010 19:09:25 +0000 (19:09 +0000)]
cogl-clip-stack: Move the struct definitions to the header

It will be useful to be able to directly examine the contents of the
clip stack within the journal code.

13 years agocogl-clip-stack: Don't convert rect clips to window clips
Neil Roberts [Tue, 9 Nov 2010 12:01:04 +0000 (12:01 +0000)]
cogl-clip-stack: Don't convert rect clips to window clips

Previously in cogl-clip-state.c when it detected that the current
modelview matrix is screen-aligned it would convert the clip entry to
a window clip. Instead of doing this cogl-clip-stack.c now contains
the detection and keeps the entry as a rectangle clip but marks that
it is entirely described by its scissor rect. When flusing the clip
stack it doesn't do anything extra for entries that have this mark
(because the clip will already been setup by the scissor). This is
needed so that we can still track the original rectangle coordinates
and modelview matrix to help detect when it would be faster to modify
the rectangle when adding it to the journal rather than having to
break up the batch to set the clip state.

13 years agocogl-journal: Defer expanding the vertices until uploading
Neil Roberts [Thu, 25 Nov 2010 21:08:45 +0000 (21:08 +0000)]
cogl-journal: Defer expanding the vertices until uploading

When logging a quad we now only store the 2 vertices representing the
top left and bottom right of the quad. The color is only stored once
per entry. Once we come to upload the data we expand the 2 vertices
into four and copy the color to each vertex. We do this by mapping the
buffer and directly expanding into it. We have to copy the data before
we can render it anyway so it doesn't make much sense to expand the
vertices before uploading and this way should save some space in the
size of the journal. It also makes it slightly easier if we later want
to do pre-processing on the journal entries before uploading such as
doing software clipping.

The modelview matrix is now always copied to the journal entry whereas
before it would only be copied if we aren't doing software
transform. The journal entry struct always has the space for the
modelview matrix so hopefully it's only a small cost to copy the
matrix.

The transform for the four entries is now done using
cogl_matrix_transform_points which may be slightly faster than
transforming them each individually with a call to
cogl_matrix_transfom.

13 years agoRevert "cogl: Remove the generated array size for cogl_tex_coord_in"
Neil Roberts [Thu, 2 Dec 2010 21:08:30 +0000 (21:08 +0000)]
Revert "cogl: Remove the generated array size for cogl_tex_coord_in"

This reverts commit 4cfe90bde275dbb952645397aa2ba2d6f6e2f3ba.

GLSL 1.00 on GLES doesn't support unsized arrays so the whole idea
can't work.

Conflicts:

clutter/cogl/cogl/cogl-pipeline-glsl.c

13 years agowin32: export TARGET and ROOT_DIR in env.sh
Damien Lespiau [Thu, 2 Dec 2010 15:46:40 +0000 (15:46 +0000)]
win32: export TARGET and ROOT_DIR in env.sh

So children of the shell sourcing it can use them (eg. buildbot slaves)

13 years agowin32: Detect the mingw32 cross compiler on Fedora
Damien Lespiau [Thu, 2 Dec 2010 15:41:43 +0000 (15:41 +0000)]
win32: Detect the mingw32 cross compiler on Fedora

Fedora mingw32 cross compiler is prefix with i686-pc-mingw32-.

13 years agowin32: Update glib and cairo version in mingw-cross-compile.sh
Damien Lespiau [Thu, 2 Dec 2010 14:03:01 +0000 (14:03 +0000)]
win32: Update glib and cairo version in mingw-cross-compile.sh

Clutter has moved on and now depends on glib 2.26 and cairo 1.10
(for cairo-gobject).

13 years agocogl-pipeline-glsl: Fix reusing shaders for shared ancestors
Neil Roberts [Thu, 2 Dec 2010 16:30:55 +0000 (16:30 +0000)]
cogl-pipeline-glsl: Fix reusing shaders for shared ancestors

The check for whether we can reuse a program we've already generated
was only being done if the pipeline already had a
glsl_program_state. When there is no glsl_program_state it then looks
for the nearest ancestor it can share the program with. It then
wasn't checking whether that ancestor already had a GL program so it
would start generating the source again. It wouldn't however compile
that source again because _cogl_pipeline_backend_glsl_end does check
whether there is already a program. This patch moves the check until
after it has found the glsl_program_state, whether or not it was found
from an ancestor or as its own state.

13 years agocogl: Remove the generated array size for cogl_tex_coord_in
Neil Roberts [Thu, 2 Dec 2010 12:27:29 +0000 (12:27 +0000)]
cogl: Remove the generated array size for cogl_tex_coord_in

Under GLES2 we were defining the cogl_tex_coord_in varying as an array
with a size determined by the number of texture coordinate arrays
enabled whenever the program is used. This meant that we may have to
regenerate the shader with a different size if the shader is used with
more texture coord arrays later. However in OpenGL the equivalent
builtin varying gl_TexCoord is simply defined as:

varying vec4 gl_TexCoord[]; /* <-- no size */

GLSL is documented that if you declare an array with no size then you
can only access it with a constant index and the size of the array
will be determined by the highest index used. If you want to access it
with a non-constant expression you need to redeclare the array
yourself with a size.

We can replicate the same behaviour in our Cogl shaders by instead
declaring the cogl_tex_coord_in with no size. That way we don't have
to pass around the number of tex coord attributes enabled when we
flush a material. It also means that CoglShader can go back to
directly uploading the source string to GL when cogl_shader_source is
called so that we don't have to keep a copy of it around.

If the user wants to access cogl_tex_coord_in with a non-constant
index then they can simply redeclare the array themself. Hopefully
developers will expect to have to do this if they are accustomed to
the gl_TexCoord array.

13 years agocookbook: Use new API to reverse timeline
Elliot Smith [Tue, 30 Nov 2010 16:52:01 +0000 (16:52 +0000)]
cookbook: Use new API to reverse timeline

clutter_timeline_set_reverse() can be used to
automatically reverse a timeline's direction each time
it completes, so use that in looping animation recipe and
examples.

13 years agokeysyms: Update the list
Emmanuele Bassi [Tue, 30 Nov 2010 18:55:38 +0000 (18:55 +0000)]
keysyms: Update the list

Add TouchpadOn and TouchpadOff from the X11 key symbols.

13 years agocogl-pipeline: Fix comparing layer states for finding codgen authority
Neil Roberts [Wed, 1 Dec 2010 15:48:37 +0000 (15:48 +0000)]
cogl-pipeline: Fix comparing layer states for finding codgen authority

When compiling for GLES2, the codegen is affected by state other than
the layers. That means when we find an authority for the codegen state
we can't directly look at authority->n_layers to determine the number
of layers because it isn't necessarily the layer state authority. This
patch changes it to use cogl_pipeline_get_n_layers instead. Once we
have two authorities that differ in codegen state we then compare all
of the layers to decide if they would affect codegen. However it was
ignoring the fact that the authorities might also differ by the other
codegen state. This path also adds an extra check for whether
_cogl_pipeline_compare_differences contains any codegen bits other
than COGL_PIPELINE_STATE_LAYERS.

13 years agocogl-pipeline: Fix the codgen authority for texture target changes
Neil Roberts [Wed, 1 Dec 2010 14:39:28 +0000 (14:39 +0000)]
cogl-pipeline: Fix the codgen authority for texture target changes

When determining if a layer would require a different shader to be
generated it needs to check a certain set of state changes and it
needs to check whether the texture target is different. However it was
checking whether texture texture was different only if the other state
was also different which doesn't make any sense. It also only checked
the texture difference if that was the only state change which meant
that effectively the code was impossible to reach. Now it does the
texture target check indepent of the other state changes.

13 years agocogl-pipeline-fixed: Use the correct state flag for combine constant
Neil Roberts [Tue, 30 Nov 2010 22:28:38 +0000 (22:28 +0000)]
cogl-pipeline-fixed: Use the correct state flag for combine constant

The fixed pipeline backend wasn't correctly flushing the combine
constant because it was using the wrong flag to determine if the
combine constant has changed since the last flushed material.

13 years agocogl-pipeline-opengl: Fix enabling previously disabled units
Neil Roberts [Tue, 30 Nov 2010 22:17:17 +0000 (22:17 +0000)]
cogl-pipeline-opengl: Fix enabling previously disabled units

When enabling a unit that was disabled from a previous flush pipeline
it was forgetting to rebind the right texture unit so it wouldn't
work. This was causing the redhand to disappear when using the fixed
function backend in test-cogl-multitexture if anything else is added
to the scene.

13 years agocogl-pipeline: Add more ignored state changes for program generation
Neil Roberts [Tue, 30 Nov 2010 22:15:40 +0000 (22:15 +0000)]
cogl-pipeline: Add more ignored state changes for program generation

For shader generation backends we don't need to worry about changes to
the texture object and changing the user matrix. The missing user
matrix flag was causing test-cogl-multitexture to regenerate the
shader every frame.

13 years agocogl: Revert "build: Remove unused variable"
Damien Lespiau [Tue, 30 Nov 2010 16:36:56 +0000 (16:36 +0000)]
cogl: Revert "build: Remove unused variable"

Having ctx here produces a warning on GLES. However it's needed for Big
GL as we have at the top of the file:

 #ifdef HAVE_COGL_GL
 #define glClientActiveTexture ctx->drv.pf_glClientActiveTexture
 #endif

This reverts commit 27a3a2056a245aca64b8e3a7d82b7976c13e897a.

13 years agoegl: Fix compilation with EGLX
Damien Lespiau [Tue, 30 Nov 2010 16:22:49 +0000 (16:22 +0000)]
egl: Fix compilation with EGLX

That what happens when you test things only with 2 configure options
instead of 3. The 2 tested compile, the third one breaks. Another good
catch for the eglx bot!

13 years agocogl: Fix unused variable warning with GLES2
Damien Lespiau [Tue, 30 Nov 2010 16:03:26 +0000 (16:03 +0000)]
cogl: Fix unused variable warning with GLES2

This shader variable is only used with big GL.

13 years agoegl: Don't try to use stage_x11 with non-X winsys
Damien Lespiau [Tue, 30 Nov 2010 15:06:12 +0000 (10:06 -0500)]
egl: Don't try to use stage_x11 with non-X winsys

The access to stage_x11 has to be protected by COGL_HAS_X11_SUPPORT.

13 years agoevdev: Add a comment to revisit the GSource management with glib 2.28
Damien Lespiau [Tue, 30 Nov 2010 14:50:13 +0000 (14:50 +0000)]
evdev: Add a comment to revisit the GSource management with glib 2.28

With glib 2.28, we'll be able to have one GSource per device manager
with child sources for earch device. Make a note to update the code
in a few months.

13 years agobuild: Remove unused variable
Damien Lespiau [Fri, 19 Nov 2010 19:51:39 +0000 (14:51 -0500)]
build: Remove unused variable

and be 100% warning free again.

13 years agoevdev: Enable the compilation of the evdev backend for eglnative
Damien Lespiau [Fri, 19 Nov 2010 19:31:51 +0000 (14:31 -0500)]
evdev: Enable the compilation of the evdev backend for eglnative

Not tested (but checked that it compiles).

There's no reason to only enable the check for the cex100. Hopefully
should work.

We make sure not to enable both the evdev and the tslib backend at the
same time as the DeviceManager is a singleton and we can't have both
subclasses at the same time for now.

13 years agoevdev: Don't oveflow when translating buttons to masks
Damien Lespiau [Fri, 19 Nov 2010 19:19:52 +0000 (14:19 -0500)]
evdev: Don't oveflow when translating buttons to masks

An array is used to translate the button to its mask. Clutter defines
the masks for button 1 to 5 but we report BTN_LEFT..BTN_TASK ie
0x110..0x117. We need to pad the array for the translation not to access
random data for buttons between 0x115 and 0x117.

13 years agoinput-device: Warn if the device has no associated stage
Damien Lespiau [Fri, 12 Nov 2010 00:11:27 +0000 (19:11 -0500)]
input-device: Warn if the device has no associated stage

Discarding the event without any warning when the device has no
associated stage makes it hard to find the bug for people implementing
new event backends. We should really warn for that abnormal condition in
_clutter_input_device_update().

13 years agoevdev: Add mouse support
Damien Lespiau [Fri, 12 Nov 2010 00:07:35 +0000 (19:07 -0500)]
evdev: Add mouse support

We know support EV_REL events comming from evdev devices. This addition
is pretty straigthforward, it adds a x,y per GSource listening to a
evdev device, updates from EL_REL (relative) events and craft new
ClutterMotionEvents. As for buttons, BTN_LEFT..BTN_TASK are translated
to ClutterButtonEvents with 1..8 as button number.

13 years agoevdev: Only create a xkbcommon mapping for keyboard devices
Damien Lespiau [Tue, 9 Nov 2010 18:14:37 +0000 (13:14 -0500)]
evdev: Only create a xkbcommon mapping for keyboard devices

13 years agoevdev: Close the device gracefully in case of a read() error
Damien Lespiau [Tue, 9 Nov 2010 18:02:53 +0000 (13:02 -0500)]
evdev: Close the device gracefully in case of a read() error

Even with udev, the read fails before udev has a chance to signal the
change. Hence (and to handle errors gracefully anyway), let's remove the
device from the device manager in case of a read() error.

13 years agoevdev: Merge clutter-event-evdev.[ch] into the device manager
Damien Lespiau [Tue, 9 Nov 2010 17:50:23 +0000 (12:50 -0500)]
evdev: Merge clutter-event-evdev.[ch] into the device manager

The device manager now fully owns the GSources corresponding to the
devices it manages. This will allow not only to remove the source when
udev signals a device removal but also handle read() errors gracefully
by removing the faulty device from the manager.

13 years agoevdev: Support hotplug (addition/removal) of evdev devices
Damien Lespiau [Tue, 9 Nov 2010 16:56:26 +0000 (11:56 -0500)]
evdev: Support hotplug (addition/removal) of evdev devices

Just connect to the GUdevClient "uevent" signal and deals with
"add"/"remove" commands. This drives the installation/removal of
GSource to listen to the device.