1
0
Fork 0
Commit graph

4125 commits

Author SHA1 Message Date
Kristian Høgsberg
8c23766da8 x11: Create the list of all devices correctly
Linked lists are tricky.
2011-01-06 14:28:41 +00:00
Emmanuele Bassi
2fe20ff3c5 osx: Implement the set_accept_focus() vfunc
Like the x11 and win32 backends, the quartz backend should allow setting
the key focus when showing the stage window.
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
9d6a33d0c8 win32: Implement the set_accept_focus() vfunc
Implement the ClutterStageWindow::set_accept_focus() virtual function in
the win32 backend.

If accept_focus is set to be TRUE then we call SetforegroundWindow()
after calling ShowWindow(). This is similar to what GDK does when
dealing with the same situation.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
497f39e2f4 x11: Implement the set_accept_focus() vfunc
Actually set the InputHint flag and set the input field of the WM_SPEC
hints depending on the value of the accept-focus bitfield.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:47:00 +00:00
Emmanuele Bassi
bbede9fef5 stage: Add :accept-focus property and accessors
Allow the developer to set whether the Stage should receive key focus
when mapped. The implementation is fully backend-dependent. The default
value is TRUE because that's what we've been expecting so far.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:44:13 +00:00
Emmanuele Bassi
e1cd6f49b2 stage-window: Add set_accept_focus() vfunc
Allow Stage implementations to set whether or not they want to accept
key focus when being shown.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
2010-12-30 12:44:13 +00:00
Johan Bilien
601b958ab1 Fixed a crash when destroying the actor of a LEAVE event
When processing a LEAVE event, one might destroy the actor, so the weak
reference device->actor would be NULL.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-12-30 12:27:26 +00:00
Johan Bilien
c95cc8d477 Only reset the relayout_pending flag when actually doing a relayout
If an actor is (unfortunately) queuing a relayout in relayout, you would
end up with (ClutterActor*)stage->needs_allocation set to TRUE and
stage->relayout_pending set to TRUE. But if then in the same cycle, an
actor calls clutter_actor_get_allocation_box, that will trigger another
(recursive) _clutter_stage_maybe_relayout, which will wrongly reset the
relayout pending to FALSE, while not actually performing a new relayout
because of the re-entrancy protection.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2503
2010-12-30 11:48:51 +00:00
Emmanuele Bassi
b6558c5a18 docs: Fixes for the Cogl API reference 2010-12-22 09:52:35 +00:00
Emmanuele Bassi
605e8d6fb5 text: Only paint cursor if we have key focus
If a Text actor does not have key focus then there's no point in showing
the cursor at all.
2010-12-21 10:50:24 +00:00
Emmanuele Bassi
491bbc226e constraints: Remove signal handlers on dispose
Same as commit 2fa8b3a3ab but done for
AlignConstraint and SnapConstraint as well.
2010-12-18 13:24:54 +00:00
Emmanuele Bassi
2fa8b3a3ab bind-constraint: Remove handlers in dispose
We should remove the signal handlers on the source actor when a
BindConstraint is disposed, to avoid dangling pointers and wrong
invocations.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2493
2010-12-18 13:16:23 +00:00
Emmanuele Bassi
6c244c0549 geometry: Avoid sign issues when interpolating
Width and height in ClutterGeometry are unsigned, and this might lead to
overflow and wrap around issues.
2010-12-17 13:53:28 +00:00
Alexandre Quessy
c3313726f0 Fixed a typo in a doc string
http://bugzilla.clutter-project.org/show_bug.cgi?id=2485
2010-12-17 13:37:05 +00:00
Emmanuele Bassi
c444447cd3 timeline: Rename the reverse property to auto-reverse
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
2010-12-17 12:07:52 +00:00
Neil Roberts
faaff03730 clutter-stage: Don't always set the projection and viewport matrix
The stage has a dirty flag to record whenever the viewport and
projection matrices need to be flushed. However after flushing these
the flags were never cleared so it would always redundantly update the
state.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2480
2010-12-14 13:12:29 +00:00
Neil Roberts
f595433942 cogl-pipeline-fragend-arbfp: Generate ARBfp if user vertex shader
The ARBfp fragend was bypassing generating a shader if the pipeline
contains a user program. However it shouldn't do this if the pipeline
only contains a vertex shader. This was breaking
test-cogl-just-vertex-shader.
2010-12-14 13:12:28 +00:00
Emmanuele Bassi
52442414d9 cally: Allow memory management for actions
Adding an action should allow passing a user data pointer, and have a
notification action that gets called when removing the action. This
allows introspection and language bindings to attach custom data to the
action - for instance, the real callable object that should be invoked.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2479
2010-12-14 10:07:32 +00:00
Mike Owens
def14e80cb ClutterText: Only grab keyboard focus if keyboard-interactive.
Previously, ClutterText took keyboard focus on mouse-down, regardless
if it were editable or selectable.  Now it checks these properties,
and behaves like other actors if it can't do anything useful with
the focus.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2462
2010-12-14 09:36:28 +00:00
Neil Roberts
7b985f034f Allow multiple CoglAtlases for textures
Previously Cogl would only ever use one atlas for textures and if it
reached the maximum texture size then all other new textures would get
their own GL texture. This patch makes it so that we create as many
atlases as needed. This should avoid breaking up some batches and it
will be particularly good if we switch to always using multi-texturing
with a default shader that selects between multiple atlases using a
vertex attribute.

Whenever a new atlas is created it is stored in a GSList on the
context. A weak weference is taken on the atlas using
cogl_object_set_user_data so that it can be removed from the list when
the atlas is destroyed. The atlas textures themselves take a reference
to the atlas and this is the only thing that keeps the atlas
alive. This means that once the atlas becomes empty it will
automatically be destroyed.

All of the COGL_NOTEs pertaining to atlases are now prefixed with the
atlas pointer to make it clearer which atlas is changing.
2010-12-13 18:59:41 +00:00
Neil Roberts
d01a707623 cogl-atlas: Convert to be a CoglObject subclass
To implement multiple atlases it will be useful to have ref-counting
on the CoglAtlas so it makes sense to convert it to be a CoglObject.
2010-12-13 18:59:41 +00:00
Neil Roberts
d1ddca4eee cogl-shader-boilerplate: Add the 3D texture extension on GLES2
To use the 3D texture extension on GLES2 it has to be enabled with the
following line in GLSL:

#extension GL_OES_texture_3D : enable
2010-12-13 17:29:14 +00:00
Neil Roberts
bdeb555ae1 cogl2-path: Don't flush the enable flags
All of the drawing needed in _cogl_add_path_to_stencil_buffer is done
with the vertex attribute API so there should be no need to flush the
enable flags to enable the vertex array. This was causing problems on
GLES2 where the vertex array isn't available.
2010-12-13 17:29:14 +00:00
Neil Roberts
7dc4b3c894 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.
2010-12-13 17:29:14 +00:00
Neil Roberts
1999bee5d2 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
2010-12-13 17:29:14 +00:00
Neil Roberts
271acaaae5 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.
2010-12-13 17:29:13 +00:00
Neil Roberts
67847260bc 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.
2010-12-13 17:28:52 +00:00
Neil Roberts
016005591d 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.
2010-12-13 17:28:29 +00:00
Robert Bragg
58a2261387 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.
2010-12-13 17:28:29 +00:00
Robert Bragg
4976d22940 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.
2010-12-13 17:28:29 +00:00
Neil Roberts
856d43a27c 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.
2010-12-13 17:28:29 +00:00
Neil Roberts
4514d49dda 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
2010-12-13 17:28:29 +00:00
Neil Roberts
1515a8d73a 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.
2010-12-13 17:28:28 +00:00
Neil Roberts
3c5fa0cf90 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.
2010-12-13 17:28:28 +00:00
Neil Roberts
8764a0d487 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.
2010-12-13 17:28:28 +00:00
Neil Roberts
6c34fb7232 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.
2010-12-13 17:28:28 +00:00
Neil Roberts
cf0ded1361 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
17d689f794 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
a3e53dd029 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
313adc7bdf 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
1e3cdb60d6 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
31f0eb4f71 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
a1996706a2 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
952878aab1 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.
2010-12-13 17:22:57 +00:00
Neil Roberts
dc61d58c0d 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.
2010-12-13 17:22:56 +00:00
Emmanuele Bassi
54db48dfd1 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.
2010-12-11 17:43:23 +00:00
Emmanuele Bassi
ae4e06d8c4 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.
2010-12-10 17:15:39 +00:00
Emmanuele Bassi
d5a4183047 introspection: Add cairo-1.0 to the dependencies 2010-12-10 17:15:23 +00:00
Emmanuele Bassi
49a43a0772 Remove unnecessary duplicate name for private enumerations 2010-12-10 16:03:10 +00:00
Emmanuele Bassi
36c3fc82c5 Use G_STRFUNC correctly
It cannot be chained up via the pre-processor.
2010-12-09 15:42:19 +00:00
Emmanuele Bassi
24133ddadc Rename the EGLDisplay accessors
The accessor for the EGL display should be namespaced for the correct
backend-specific API.
2010-12-09 15:34:22 +00:00
Emmanuele Bassi
f5b51a2428 docs: Documentation fixes 2010-12-09 15:06:12 +00:00
Emmanuele Bassi
ab0eb0a12b docs: Documentation fixes 2010-12-09 13:59:08 +00:00
Jussi Kukkonen
d8515bf429 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
2010-12-09 13:38:35 +00:00
nobled
e7f62bc936 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
2010-12-09 13:32:49 +00:00
nobled
d8a544c0f1 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
2010-12-09 13:32:41 +00:00
Emmanuele Bassi
3795c9b975 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.
2010-12-09 12:37:41 +00:00
Emmanuele Bassi
d229036441 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.
2010-12-09 12:36:50 +00:00
Tomeu Vizoso
b6318bd821 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
2010-12-09 11:57:06 +00:00
Robert Bragg
cf1fced885 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.
2010-12-08 18:57:42 +00:00
Robert Bragg
46295a0dd1 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.
2010-12-08 18:35:03 +00:00
Robert Bragg
87b2300f98 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.
2010-12-08 18:35:02 +00:00
Robert Bragg
bac600b21b 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.
2010-12-08 18:35:02 +00:00
Neil Roberts
9606c42c55 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.
2010-12-08 18:35:02 +00:00
Robert Bragg
ab5f394e5a 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.
2010-12-08 18:35:02 +00:00
Robert Bragg
5fd8e9c608 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.
2010-12-08 18:35:02 +00:00
Robert Bragg
ea66156c83 pipeline: don't use near/far symbols
According to 9cc9033347 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.
2010-12-08 18:35:01 +00:00
Emmanuele Bassi
acd3d61568 docs: Fix listitem tag 2010-12-08 14:26:27 +00:00
Emmanuele Bassi
c454526bbb docs: Clean up clutter_color_from_string()
Add hsl() and hsla() formats, and clean up the wording.
2010-12-08 14:03:02 +00:00
Neil Roberts
ca7dc2f951 cogl-backend-egl: Chain up to the X11 backend init_events
Since c6493885c3 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.
2010-12-07 23:32:47 +00:00
Damien Lespiau
b0751d2342 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.
2010-12-07 22:32:56 +00:00
Neil Roberts
f8fc194b3b 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.
2010-12-07 21:44:32 +00:00
Robert Bragg
9d836d8ce5 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.
2010-12-07 16:47:02 +00:00
Robert Bragg
67c2a1b29f 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.
2010-12-07 16:36:44 +00:00
Robert Bragg
464ed7e6b7 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.
2010-12-07 16:00:32 +00:00
Robert Bragg
e87c3820ee 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.
2010-12-07 16:00:32 +00:00
Robert Bragg
cc36e49ec5 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.
2010-12-07 16:00:32 +00:00
Robert Bragg
ff646b7fc3 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.
2010-12-07 12:16:51 +00:00
Robert Bragg
1180fd159e 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.
2010-12-07 12:16:50 +00:00
Robert Bragg
ef02cb7ff2 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.
2010-12-07 12:16:50 +00:00
Robert Bragg
c29a7526c0 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.
2010-12-07 12:16:50 +00:00
Robert Bragg
3edd02841b 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.
2010-12-03 17:16:58 +00:00
Robert Bragg
9ff191bd3b 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.
2010-12-03 17:16:58 +00:00
Neil Roberts
3fa91efea8 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.
2010-12-03 17:16:58 +00:00
Neil Roberts
62c893feee 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.
2010-12-03 17:16:58 +00:00
Neil Roberts
be63fcee7f 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.
2010-12-03 17:16:58 +00:00
Neil Roberts
dc0506a164 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.
2010-12-03 17:16:57 +00:00
Neil Roberts
22be07c3b5 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.
2010-12-03 17:16:57 +00:00
Neil Roberts
a7d88e1527 Revert "cogl: Remove the generated array size for cogl_tex_coord_in"
This reverts commit 4cfe90bde2.

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
2010-12-03 15:27:17 +00:00
Neil Roberts
dd5431ef38 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.
2010-12-02 16:36:00 +00:00
Neil Roberts
4cfe90bde2 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.
2010-12-02 12:27:29 +00:00
Emmanuele Bassi
4f17bf3bcc keysyms: Update the list
Add TouchpadOn and TouchpadOff from the X11 key symbols.
2010-12-02 09:53:00 +00:00
Neil Roberts
87a72d188e 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.
2010-12-01 15:48:37 +00:00
Neil Roberts
f620d53054 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.
2010-12-01 14:39:28 +00:00
Neil Roberts
a38fa7a2df 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.
2010-11-30 22:28:38 +00:00
Neil Roberts
499a370ee3 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.
2010-11-30 22:17:17 +00:00
Neil Roberts
17a98875d3 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.
2010-11-30 22:15:40 +00:00
Damien Lespiau
1564418b3f 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 27a3a2056a.
2010-11-30 16:39:00 +00:00
Damien Lespiau
8ee9179447 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!
2010-11-30 16:22:49 +00:00
Damien Lespiau
bbbd91e581 cogl: Fix unused variable warning with GLES2
This shader variable is only used with big GL.
2010-11-30 16:03:26 +00:00