Commit Graph

5617 Commits

Author SHA1 Message Date
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
Damien Lespiau
e0ce4cee8c win32: export TARGET and ROOT_DIR in env.sh
So children of the shell sourcing it can use them (eg. buildbot slaves)
2010-12-02 16:54:43 +00:00
Damien Lespiau
c1878316e0 win32: Detect the mingw32 cross compiler on Fedora
Fedora mingw32 cross compiler is prefix with i686-pc-mingw32-.
2010-12-02 16:54:41 +00:00
Damien Lespiau
e73d5b30bb 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).
2010-12-02 16:54:38 +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
Elliot Smith
50849ac1fd 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.
2010-12-02 10:56:06 +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
Damien Lespiau
9ad55edf24 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.
2010-11-30 10:08:49 -05:00
Damien Lespiau
4ceb95d2ca 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.
2010-11-30 14:50:13 +00:00
Damien Lespiau
27a3a2056a build: Remove unused variable
and be 100% warning free again.
2010-11-30 14:40:38 +00:00
Damien Lespiau
9ba5447c9b 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.
2010-11-30 14:40:38 +00:00
Damien Lespiau
bce4c87232 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.
2010-11-30 14:40:38 +00:00
Damien Lespiau
ac431ac21d 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().
2010-11-30 14:40:38 +00:00
Damien Lespiau
c20beabf93 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.
2010-11-30 14:40:38 +00:00
Damien Lespiau
94c2812d72 evdev: Only create a xkbcommon mapping for keyboard devices 2010-11-30 14:40:38 +00:00
Damien Lespiau
7cd6ba2828 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.
2010-11-30 14:40:38 +00:00
Damien Lespiau
afd279dd76 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.
2010-11-30 14:40:38 +00:00
Damien Lespiau
afee3b009c 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.
2010-11-30 14:40:37 +00:00
Damien Lespiau
b83a4813a4 evdev: Make sure we only add evdev devices
Let's use the sysfs path of the device to make sure we only load evdev
device, not legacy mousedev ones for instance. We rely on the sysfs
API/ABI guarantees and look for devices finishing by /input%d/event%d.
2010-11-30 14:40:37 +00:00
Damien Lespiau
c6493885c3 evdev: First stab at an evdev backend
This backend is a event backend that can be enabled for EGL (for now).
It uses udev (gudev) to query input devices on a linux system, listens to
keyboard events from input devices and xkbcommon to translate raw key
codes into key keysyms.

This commit only supports key events, more to follow.
2010-11-30 14:40:37 +00:00
Damien Lespiau
9f5f62b4b5 evdev: Fix the unicode_value for new ClutterEvents
Looking at what the X11 backend does: the unicode value is being
translated to the unicode codepoint of the symbol if possible. Let's do
the same then.

Before that, key events for say KEY_Right (0xff53) had the unicode_value
set to the keysym, which meant "This key event is actually printable and
is Unicode codepoint is 0xff53", which lead to interesting results.
2010-11-30 14:40:37 +00:00
Damien Lespiau
ef5256ec25 evdev: Factor out the xkbcommon code from the wayland client backend
The wayland client code has support for translating raw linux input
device key codes coming from the wayland compositor into key symbols
thanks to libxkbcommon.

A backend directly listening to linux input devices (called evdev, just
like the Xorg one) could use exactly the same code for the translation,
so abstract it a bit in a separate file.
2010-11-30 14:40:37 +00:00
Emmanuele Bassi
b5a9de1a23 moduleset: Add gstreamer and gst-plugins-good 2010-11-30 10:35:17 +00:00
Emmanuele Bassi
1d153fa860 moduleset: Disable stand-alone Cally 2010-11-30 10:34:59 +00:00
Emmanuele Bassi
085962a361 moduleset: Switch gtk2 to the 2.24 branch 2010-11-30 10:34:38 +00:00
Emmanuele Bassi
5e085e8d7f Post-release version bump to 1.5.9 2010-11-29 14:21:21 +00:00
Emmanuele Bassi
8cebec6bdc Release Clutter 1.5.8 (snapshot) 2010-11-29 14:09:09 +00:00
Neil Roberts
d046df8e6f cogl-shader.c: Don't add the common boilerplate twice
In 6246c2bd6 I moved the code to add the boilerplate to a shader to a
separate function and also made it so that the common boilerplate is
added as a separate string to glShaderSource. However I didn't notice
that the #define for the vertex and fragment shaders already includes
the common part so it was being added twice. Mesa seems to accept this
but it was causing problems on the IMG driver because COGL_VERSION was
defined twice.
2010-11-29 13:43:09 +00:00
Neil Roberts
ae300dc8e0 cogl-pipeline-glsl: Use char* instead of GLchar*
It appears that some GLES2 headers don't define GLchar and it works
just as well to use a regular char.
2010-11-29 13:42:20 +00:00
Emmanuele Bassi
08308fd397 docs: Close a tag 2010-11-29 12:51:52 +00:00
Emmanuele Bassi
556c938b4d Update NEWS 2010-11-29 12:01:20 +00:00
Emmanuele Bassi
038fe708f8 Merge remote branch 'elliot/cookbook-animations-scaling'
* elliot/cookbook-animations-scaling:
  cookbook: Add recipe for animated scaling of an actor
  cookbook: Add example of scaling a texture
  cookbook: Added "animated scaling" recipe skeleton
  cookbook: Added animated scaling example
2010-11-29 11:56:36 +00:00
Chris Lord
67143bd846 text: Optimise get_preferred_height for single-line-mode
Don't calculate an extra layout in clutter_text_get_preferred_height for
single-line strings, when it's unnecessary. There's no need to set the
width of a layout when in single-line mode, as wrapping will not happen.
2010-11-29 11:51:33 +00:00
Emmanuele Bassi
e1b58d9407 Update NEWS file 2010-11-29 11:19:16 +00:00
Emmanuele Bassi
850a35f069 shader-effect: Remove unused function
The reset_uniforms() internal function is not used any more because the
CoglProgram cannot be reset post-creation - hence the uniforms cannot
change.
2010-11-29 10:59:16 +00:00
Neil Roberts
08087c965b ClutterShaderEffect: Don't throw away the program for a new actor
Previously when the shader effect is used with a new actor it would
end up throwing away the old program. I don't think this is neccessary
and it means if you use an effect to temporarily bind to an actor then
it will recompile the shader whenever it is applied.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2454
2010-11-29 10:55:53 +00:00
Neil Roberts
2dc9e0dc29 ClutterOffscreenEffect: Don't throw away the material for a new actor
When a new actor is set for ClutterOffscreenEffect it would throw away
the old material. I don't think there is anything specifically tied to
the actor in the material so throwing away just loses Cogl's cached
state about the material. This ends up relinking the shader every time
a new actor is set in ClutterShaderEffect.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2454
2010-11-29 10:55:52 +00:00
Tomeu Vizoso
b63e9ee8f8 Don't bail out from creating the FBO if we don't have it yet.
This happens when reattaching an effect to another actor.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2453
2010-11-29 10:54:39 +00:00
Tomeu Vizoso
47d63c1c55 Set the signal handler to 0 when disconnecting it.
Otherwise we'll try to disconnect it again later.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2452
2010-11-29 10:54:33 +00:00