Robert Bragg [Thu, 8 Oct 2009 11:08:21 +0000 (12:08 +0100)]
build: expose automake conditionals for cogl winsys
Expose the ./configured window system/backend options to the Cogl
automake files via some new SUPPORT_XYZ conditionals.
Robert Bragg [Tue, 13 Oct 2009 14:27:06 +0000 (15:27 +0100)]
configure.ac: Adds some COGL_HAS_XYZ_SUPPORT defines
This exposes the ./configured window system/backend options to Cogl via
a set of new COGL_HAS_XYZ_SUPPORT defines:
COGL_HAS_{X11,XLIB,GLX,EGL,EGL_PLATFORM_XYZ,OSX,WIN32,WGL}_SUPPORT
Brian Tarricone [Fri, 26 Mar 2010 03:55:31 +0000 (20:55 -0700)]
eglx: implement cogl_get_proc_address()
http://bugzilla.openedhand.com/show_bug.cgi?id=2124
Neil Roberts [Tue, 18 May 2010 16:25:25 +0000 (17:25 +0100)]
eglx: Rename EGLNative{Window,Display}Type back to Native{Window,Display}Type
Commit e2a990d renamed these types to new names from EGL 1.3. However
it still works to use the old names under EGL 1.3 so let's just use
those to keep compatibility.
Neil Roberts [Tue, 18 May 2010 16:08:12 +0000 (17:08 +0100)]
clutter-backend-egl: Chain up in dispose before destroying the context
clutter_backend_egl_dispose now chains up before disposing its own
resources so that ClutterBackendX11 will destroy all of the stages
before we destroy the egl context. Otherwise the actors may try to
make GL calls during destruction which causes a crash.
Neil Roberts [Tue, 18 May 2010 15:51:46 +0000 (16:51 +0100)]
clutter-stage-egl.c: Don't call eglWait*()
According to the docs, eglSwapBuffers performs an implicit glFlush
before swapping so there should be no need to wait.
Neil Roberts [Tue, 18 May 2010 14:52:05 +0000 (15:52 +0100)]
test-cogl-materials: Fix compilation under GLES 2
GLES 2 doesn't have GL_MAX_TEXTURE_UNITS. Instead the cogl backend
uses GL_MAX_TEXTURE_IMAGE_UNITS with a maximum limit of 16. The same
restriction is now used in the test.
Brian Tarricone [Fri, 26 Mar 2010 02:44:37 +0000 (19:44 -0700)]
fix case when EGL driver doesn't support EGL_NATIVE_VISUAL_ID
Some EGL drivers, such as the PowerVR simulator (and some proprietary drivers)
return zero when the EGLConfig is queried for the EGL_NATIVE_VISUAL_ID
attribute via eglGetConfigAttrib().
This patch detects and attempts to work around that situation by picking a
visual with the same color depth.
http://bugzilla.openedhand.com/show_bug.cgi?id=2123
Neil Roberts [Wed, 5 May 2010 16:30:00 +0000 (17:30 +0100)]
clutter-backend-egl: Create a dummy X window and EGL surface
After the EGL context is created it now also creates an invisible 1x1
window and a corresponding surface so that the context can be
immediately made current. This is similar to changes for the GLX
backend introduced in
d2c091e62.
http://bugzilla.openedhand.com/show_bug.cgi?id=2056
Brian Tarricone [Fri, 26 Mar 2010 02:37:26 +0000 (19:37 -0700)]
update backend to use lazy context/stage creation
http://bugzilla.openedhand.com/show_bug.cgi?id=2056
Neil Roberts [Tue, 18 May 2010 12:55:18 +0000 (13:55 +0100)]
configure: Check the result of AM_PATH_GLIB_2_0
The AM_PATH_GLIB_2_0 doesn't automatically cause the configure script
to fail if the test fails. This wouldn't usually cause any problems
because we later check for the right glib version using
PKG_CHECK_MODULES directly. However AM_PATH_GLIB_2_0 is more thorough
when checking because it also tries to run a program against the
library to read the version. If the macro fails but the pkg-config
check passes then nothing will define GLIB_GENMARSHAL and the build
step will fail in a confusing way.
This adds a check for the result and gives an AC_MSG_ERROR if it
fails. The glib dependencies have been moved out of CLUTTER_DEPS to
AM_PATH_GLIB_2_0.
http://bugzilla.openedhand.com/show_bug.cgi?id=2127
Øyvind Kolås [Mon, 17 May 2010 17:05:19 +0000 (18:05 +0100)]
animator: fix issue of dropped frames towards end of animations
Neil Roberts [Wed, 12 May 2010 17:57:52 +0000 (18:57 +0100)]
cogl-material: Set the blend equation even if blend funcs are the same
Previously it would only try to set the blend equation if the RGB and
alpha blending functions were different. However it's completely valid
to use a non-standard blending function when the functions are the
same. This patch moves the blending equation to outside the if
statement.
Neil Roberts [Wed, 12 May 2010 14:19:09 +0000 (15:19 +0100)]
cogl-material: Set blend constant even if alpha and rgb factors are the same
Previously it would only set the blend constant if glBlendFuncSeparate
was used but it is perfectly acceptable to use the blend constant when
the same factor is used for each. It now sets the blend constant
whenever one of the factors would use the constant.
Neil Roberts [Wed, 12 May 2010 16:56:25 +0000 (17:56 +0100)]
cogl-blend-string: Don't split combined blend statements into two
When a single statement is used to specify the factors for both the
RGB and alpha parts it previously split up the statement into
two. This works but it ends up unnecessarily using glBlendFuncSeparate
when glBlendFunc would suffice.
For example, the blend statement
RGBA = ADD(SRC_COLOR*(SRC_COLOR), DST_COLOR*(1-SRC_COLOR))
would get split into the two statements
RGBA = ADD(SRC_COLOR*(SRC_COLOR[RGB]), DST_COLOR*(1-SRC_COLOR[RGB]))
A = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))
That translates to:
glBlendFuncSeparate (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
This patch makes it so that arg_to_gl_blend_factor can handle the
combined RGBA mask instead. That way the single statement gets
translated to the equivalent call:
glBlendFunc (GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
Chris Lord [Thu, 13 May 2010 14:51:42 +0000 (15:51 +0100)]
text: Fix typos that were causing false-positive cache hits
If a cached layout didn't actually match the layout we're looking for,
it would be returned anyway. Remove this return so that it can correctly
continue looking and get a cache miss if appropriate.
http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Neil Roberts [Thu, 22 Apr 2010 10:58:52 +0000 (11:58 +0100)]
cogl-path: Use true copy-on-write semantics
Previously a path copy was implemented such that only the array of
path nodes was shared with the source and the rest of the data is
copied. This was so that the copy could avoid a deep copy if the
source path is appended to because the copy keeps track of its own
length. This optimisation is probably not worthwhile because it makes
the copies less cheap. Instead the CoglPath struct now just contains a
single pointer to a new CoglPathData struct which is separately
ref-counted. When the path is modified it will be copied if the ref
count on the data is not 1.
Neil Roberts [Mon, 10 May 2010 16:43:17 +0000 (17:43 +0100)]
Add a conformance test for ClutterCairoTexture
This adds a simple test for ClutterCairoTexture that draws two
rectangles to the cairo surface in an idle callback and then verifies
that they appeared at the right colours in the paint callback. If that
succeeds then the second time the idle callback is invoked it will
replace one of the rectangles with a sub region update and the
following paint callback will again verify the rectangles.
Owen W. Taylor [Sat, 8 May 2010 17:38:37 +0000 (13:38 -0400)]
text: correct caching logic
This patch combines a number of fixes and improvements to the
layout caching logic in ClutterText.
* Fix: The width must always be set on the PangoLayout when painting.
This is necessary because the layout aligns in the width, and
even when we think we are left-aligned, the auto-dir feature
of PangoLayout may result in right-alignment.
* Fix: We should only ever try to reuse a cached layout based
on its logical width if layout.width was -1 when computing
that logical width. If the layout was already ellipsized,
then comparing the logical width to the new width we are
trying to wrap to doesn't make sense. (If "abc" ellipsizes
to a 15-pixel wide "..." for a width of 1 pixel, that doesn't
mean that we should use "..." for a width of 15 pixels. Maybe
"abc" itself is 15 pixels wide.)
* Improvement: rather than looking up cached layouts based on the
input allocation_width/allocation_height, look them up based
on the actual width/height/ellipsize that we pass to create
a layout. This is simpler and improves the chance we'll get
a cache hit when appropriate even if there are small floating
point differences.
Note because of the first fix this is less aggressive than dd40732
in caching layouts; get_preferred_width() and painting can't share
a layout since get_preferred_width() needs to pass a width of -1
to Pango and painting needs to pass the real width.
The patch has been updated from the clutter-1.2 branch to current
master; using the profiling instrumentation it is possible to verify
with test-text-field that the hit/miss counters go from:
Name Total Per Frame
---- ----- ---------
Text layout cache hit counter 13 6
Text layout cache miss counter 11 5
before applying the patch, to:
Name Total Per Frame
---- ----- ---------
Text layout cache miss counter 4 2
Text layout cache hit counter 3 1
after applying the patch.
https://bugzilla.gnome.org/show_bug.cgi?id=618104
http://bugzilla.openedhand.com/show_bug.cgi?id=2109
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Neil Roberts [Mon, 10 May 2010 14:33:05 +0000 (15:33 +0100)]
Revert "clutter-cairo-texture: Use the new cogl_pixel_buffer API"
This reverts commit
716ec82db8bec57e35d51e8dee5468435fc9e59e.
The Cogl pixel buffer API currently has problems if an atlas texture
is created or the format needs to be converted. The atlas problem
doesn't currently show because the atlas rejects BGR textures anyway
but we may want to change this soon. The problem with format
conversion would happen under GLES because that does not support BGR
textures at all so Cogl has to do the conversion. However it doesn't
currently show either because GLES has no support for buffer objects
anyway.
It's also questionable whether the patch would give any performance
benefit because Cairo needs read/write access which implies the buffer
can't be put in write-optimised memory.
Conflicts:
clutter/clutter-cairo-texture.c
http://bugzilla.openedhand.com/show_bug.cgi?id=1982
Owen W. Taylor [Sat, 8 May 2010 20:58:14 +0000 (16:58 -0400)]
cogl-framebuffer: Flush journal when creating fbo
Since framebuffer state is not flushed prior to replaying the journal,
the trick of marking the framebuffer dirty prior to calling
glBindFramebuffer() doesn't work... the outstanding journal entries
will get replayed to the newly created framebuffer.
Fix this by flushing the journal as well.
http://bugzilla.openedhand.com/show_bug.cgi?id=2110
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Emmanuele Bassi [Mon, 10 May 2010 13:28:21 +0000 (14:28 +0100)]
Add tests/conform/wrappers to the ignore file
Emmanuele Bassi [Sat, 8 May 2010 23:13:16 +0000 (00:13 +0100)]
Fix annotation typos
Neil Roberts [Fri, 7 May 2010 17:03:39 +0000 (18:03 +0100)]
clutter-cairo-texture: Fix destroying the old texture
In clutter_cairo_texture_create_region it tries to destroy the old
texture before mapping the PBO by setting the texture on the first
layer of the material to COGL_INVALID_HANDLE. However it was using the
material API incorrectly so it ended up showing a warning and doing
nothing.
Robert Bragg [Thu, 6 May 2010 13:53:50 +0000 (14:53 +0100)]
conform: Make gtester run a list of wrappers
Instead of asking gtester to run ./test-conformance directly we now tell
it to run a list of wrapper scripts. This results in each test being
spawned in a separate process avoiding leakage of state between tests
which has been a big problem with the conformance tests for quite a
while now.
Neil Roberts [Fri, 7 May 2010 14:58:26 +0000 (15:58 +0100)]
test-cogl-multitexture: Set linear filters on the two textures
Otherwise it seems that rounding errors will cause the fragments at
the edge of the quad to blend with neighbouring quarters of the
texture which cause the test to fail.
Neil Roberts [Thu, 6 May 2010 13:21:53 +0000 (14:21 +0100)]
test-conform-common: Disconnect all paint handlers on the stage
A few of the tests connected to the paint signal but never
disconnected it. Most of these handlers had a call to g_main_quit in
them which meant that it could sometimes cause subsequent tests to
exit after the first frame is painted. Most of the tests don't
validate any of the results until after a couple of frames have been
rendered so this ended up skipping out the test entirely.
To workaround this the test setup function now disconnects all
handlers for the paint signal on the default stage before the test is
run.
Neil Roberts [Thu, 6 May 2010 13:18:32 +0000 (14:18 +0100)]
test-cogl-readpixels: Reset the viewport and matrices
The on_paint function for test-cogl-readpixels tries to temporarily
set the projection, modelview and viewport to its own values. However
it was never restoring the saved values so it could affect the results
of subsequent tests.
Neil Roberts [Thu, 6 May 2010 13:16:33 +0000 (14:16 +0100)]
test-cogl-path: Initialise state.frame
state.frame was left unitialized so it would be left to happenstance
which of the first three frames would be used for validating the test.
Neil Roberts [Thu, 6 May 2010 13:15:04 +0000 (14:15 +0100)]
cogl-clip-stack: Set *stencil_used_p when the stack is empty
If the clip stack is empty then _cogl_clip_stack_flush exits
immediately. This was missing out the assignment of *stencil_used_p at
the bottom of the function. If a path is then used after the clip is
cleared then it would think it needs to merge with the clip so the
stencil would not be cleared correctly.
Neil Roberts [Wed, 7 Apr 2010 23:20:18 +0000 (00:20 +0100)]
clutter-color: Don't directly read the contents of GValue structs
The code for implementing ClutterColor as GParamSpec and the
color↔string transformation functions were assuming that ClutterColor
owns the data in the GValue struct and directly reading
data[0].v_pointer to get a pointer to the color. However ClutterColor
is actually a boxed type and the format of the data array is meant to
be internal to GObject so it is not safe to poke around in it
directly. This patch changes it to use g_value_get_boxed to get the
pointer.
Also, boxed types allow a NULL value to be stored and not all of the
code was coping with this. This patch also attempts to fix that.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
Neil Roberts [Wed, 7 Apr 2010 23:17:48 +0000 (00:17 +0100)]
clutter-color: Remove the value table
ClutterColor has long had a GTypeValueTable struct around and the
functions defined to be implemented as a fundamental type. However the
struct was never actually used anywhere and ClutterColor is actually
defined as a boxed type. This patch removes the table because it is
very confusing to have code lying around that is not used.
http://bugzilla.openedhand.com/show_bug.cgi?id=2068
Øyvind Kolås [Wed, 5 May 2010 17:15:12 +0000 (18:15 +0100)]
animator: fix looping when doing cubic interpolation
When using interpolation and the last key is not at 1.0 a bouncing
artifact could be observed after the keys.
Øyvind Kolås [Wed, 5 May 2010 15:55:16 +0000 (16:55 +0100)]
animator: only keys that are removed due to actors disappearing are inert
Øyvind Kolås [Wed, 5 May 2010 12:48:34 +0000 (13:48 +0100)]
animator: refactoring
renamed KeyAnimator to PropertyIter
Øyvind Kolås [Wed, 5 May 2010 12:58:15 +0000 (13:58 +0100)]
animator: retain ease-in/interpolation when changing first key
Duplicate the existing ease-in/interpolation mode for the property when
removing, replacing the first key for a property or adding a new first
key for a property.
Øyvind Kolås [Wed, 5 May 2010 12:34:06 +0000 (13:34 +0100)]
animator: fix crash when setting keys on running animator
When inserting or modifying keys of a running animator the internal
iterators per property could go out of sync. Reinitializing the
iterators if the timeline is running avoids this.
Neil Roberts [Wed, 5 May 2010 11:05:15 +0000 (12:05 +0100)]
gles: Fix the functions names for the GL_OES_framebuffer_object ext
In
91cde78a7 I accidentally changed the function names that get looked
up for the framebuffer extension under GLES so that they didn't have
any suffix. The spec for extension specifies that they should have the
OES suffix.
Owen W. Taylor [Fri, 30 Apr 2010 18:56:07 +0000 (14:56 -0400)]
Ignore unexpected GLX_BufferSwapComplete
A server that supports GLX_BufferSwapComplete will always send
these events, so we should just silently ignore them if we've
chosen not to take advantage of the INTEL_swap_event GLX
extension.
http://bugzilla.openedhand.com/show_bug.cgi?id=2102
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Wed, 5 May 2010 10:53:51 +0000 (11:53 +0100)]
docs: Update the dependencies in the README
Emmanuele Bassi [Wed, 5 May 2010 10:52:20 +0000 (11:52 +0100)]
build: Clean up build dependencies
• Depend on autoconf 2.63
• Depend on automake 1.11
• Depend on gobject-introspection 0.6.7
• Depend on gtk-doc 1.13
• Remove Shave from the build
Emmanuele Bassi [Wed, 5 May 2010 10:32:39 +0000 (11:32 +0100)]
animation: Use 'guint' for set_duration() parameter
The :duration property and the get_duration() method use unsigned int,
but the setter using a signed integer for no apparent reason.
http://bugzilla.openedhand.com/show_bug.cgi?id=2089
Jussi Kukkonen [Sun, 18 Apr 2010 07:47:14 +0000 (10:47 +0300)]
container: use CLUTTER_IS_ACTOR on correct parameter
clutter_container_create_child_meta() uses CLUTTER_IS_ACTOR on the
container parameter instead of the actor parameter.
http://bugzilla.openedhand.com/show_bug.cgi?id=2087
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Damien Lespiau [Mon, 3 May 2010 18:41:17 +0000 (20:41 +0200)]
debug: Use G_UNLIKELY in the tests
Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.
Took the opportunity to re-indent the macros.
Owen W. Taylor [Fri, 30 Apr 2010 18:50:11 +0000 (14:50 -0400)]
Call backend handle_event from clutter_x11_handle_event()
Whether events come from the main loop source or from
clutter_x11_handle_event(), we need to feed them to the backend
virtual handle_event function. This fixes problems with clients
using clutter_x11_handle_event() hanging because
GLXBufferSwapComplete events aren't received.
http://bugzilla.openedhand.com/show_bug.cgi?id=2101
Robert Bragg [Fri, 30 Apr 2010 11:10:16 +0000 (12:10 +0100)]
debug: wrap glClear calls with the GE macro
This adds a GE macro wrapper around our calls to glClear so we can
print a warning for any errors reported by the driver.
Neil Roberts [Mon, 26 Apr 2010 11:41:26 +0000 (12:41 +0100)]
cogl-texture-2d-sliced: Use the converted bitmap when uploading
When uploading texture data the cogl-texture-2d-sliced backend was
using _cogl_texture_prepare_for_upload to create a bitmap suitable for
upload but then it was using the original bitmap instead of the new
bitmap for the data. This was causing any format conversions performed
by cogl_texture_prepare_for_upload to be ignored.
http://bugzilla.openedhand.com/show_bug.cgi?id=2059
Neil Roberts [Mon, 26 Apr 2010 11:30:37 +0000 (12:30 +0100)]
cogl-texture: Don't attempt to use GL to convert formats under GLES
In commit
abe91784c4b I changed cogl-texture so that it would use the
OpenGL mechanism to specify a different internal texture format from
the image format so that it can do the conversion instead of
Cogl. However under GLES the internal format and the image format must
always be the same and it only supports a limited set of formats. This
patch changes _cogl_texture_prepare_for_upload so that it does the
conversion using the cogl bitmap code when compiling for GLES.
http://bugzilla.openedhand.com/show_bug.cgi?id=2059
Neil Roberts [Tue, 27 Apr 2010 15:38:07 +0000 (16:38 +0100)]
cogl-material: Fix the check to prevent using too many layers
There was a check at the bottom of the loop which sets up the state
for each of the layers so that it would break from the loop when the
maximum number of layers is reached. However after doing this it would
not increment 'i'. 'i' is later used to disable the remaining layers
so it would end up disabling the last layer it just set up.
This patch moves the check to be part of the loop condition so that
the check is performed after incrementing 'i'.
http://bugzilla.openedhand.com/show_bug.cgi?id=2064
Neil Roberts [Tue, 27 Apr 2010 15:35:35 +0000 (16:35 +0100)]
cogl-material: Fix the warning for when too many layers are used
The warning displayed when too many layers are used had an off-by-one
error so that it would display even if exactly the maximum number is
used. There was also a missing space at the end of the line in the
message which looked wrong when displayed on the terminal.
http://bugzilla.openedhand.com/show_bug.cgi?id=2064
Neil Roberts [Tue, 27 Apr 2010 15:34:59 +0000 (16:34 +0100)]
test-cogl-materials: Add a test using the maximum number of layers
This adds a test which creates a material using the maximum number of
layers. All of the layers are assigned a white texture except the last
which is set to red. The default combine mode is used for all of the
layers so the final fragment should end up red.
Currently Cogl doesn't provide a way to query the maximum number of
layers so it just uses glGetIntegerv instead. This might cause
problems on GLES 2 because that adds additional restrictions on the
number of layers.
http://bugzilla.openedhand.com/show_bug.cgi?id=2064
Emmanuele Bassi [Wed, 28 Apr 2010 15:19:37 +0000 (16:19 +0100)]
Fix clutter_event_get_coords() for crossing events
The ClutterCrossingEvent data structure contains the coordinates
of the crossing; they are regularly filed out by Clutter and by
the backend event processing code. And yet clutter_event_get_coords()
returns (0, 0) because it thinks that CLUTTER_ENTER and CLUTTER_LEAVE
events do not have coordinates.
Emmanuele Bassi [Tue, 27 Apr 2010 09:12:25 +0000 (10:12 +0100)]
actor: Make consistent use of the name in error reporting
Whenever we are warning inside ClutterActor we prefer the actor's name
to its type, if the name is set. The current code is made less readable
by the use of the ternary operator:
priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (self)
This looks like a job for a simple convenience function.
Emmanuele Bassi [Mon, 26 Apr 2010 11:58:17 +0000 (12:58 +0100)]
Clean up the Texture private data structure
Neil Roberts [Sun, 25 Apr 2010 15:20:39 +0000 (16:20 +0100)]
mingw-cross-compile.sh: Write the build environment to a script
The script now writes out a separate script that can be used to set up
the build environment to $ROOT_DIR/share/env.sh. This can be sourced
in a shell to set up the build environment or it can be given a
command to directly execute in the environment. This makes it easier
to build Clutter from your own source rather than checking it out from
git directly.
Neil Roberts [Sun, 25 Apr 2010 15:09:16 +0000 (16:09 +0100)]
mingw-cross-compile.sh: Update the package versions
This updates to the latest binaries from Tor Lillqvist. zlib and iconv
are now taken from the Tor deps instead of the gnuwin32 project. SDL
is no longer downloaded because the SDL backend has been removed from
Clutter. The GL headers are downloaded from the Mesa cgit rather than
downloading the whole Mesa package. glext.h is taken directly from
khronos.org.
Neil Roberts [Thu, 22 Apr 2010 17:14:40 +0000 (18:14 +0100)]
cogl-path: Make cogl_path_arc_rel static
cogl_path_arc_rel was never in any public headers so it isn't part of
the public API. It also has a slightly inconsistent name because the
rest of the relative path functions are called cogl_path_rel_*. This
patch makes it static for now to make it more obvious that it isn't
public. The name has changed to _cogl_path_rel_arc.
Neil Roberts [Thu, 22 Apr 2010 17:03:57 +0000 (18:03 +0100)]
cogl-path: Add documentation for the angles of cogl_path_arc
This adds documentation for how Cogl interprets the angles given to
cogl_path_arc.
Emmanuele Bassi [Thu, 22 Apr 2010 16:54:05 +0000 (17:54 +0100)]
profile: Add profiling points for Text
Add a static timer for the text layout code, and two counters for the
layout cache hit and miss conditions.
Emmanuele Bassi [Thu, 22 Apr 2010 16:52:13 +0000 (17:52 +0100)]
profile: Fix the report generation
Timers and counters might not exist, so make every section of the
profile report depend on the object that it is querying.
This fixes the profile report generation that was broken by commit
8146d8d08deafd6cf86238a4a8c2fa6149e5c691.
Emmanuele Bassi [Thu, 22 Apr 2010 16:51:56 +0000 (17:51 +0100)]
Add uprof to the jhbuild moduleset
Emmanuele Bassi [Thu, 22 Apr 2010 15:49:57 +0000 (16:49 +0100)]
actor: Add an internal variant of get_stage()
For internal use we should have a get_stage_internal() variant that
avoids type checks and calls to public functions. The implementation
is trivial enough, and it will avoid (scene graph depth + 1) type
checks and (scene graph depth) function calls.
Emmanuele Bassi [Wed, 21 Apr 2010 10:30:54 +0000 (11:30 +0100)]
docs: Fix gtk-doc warnings
Neil Roberts [Wed, 21 Apr 2010 21:36:43 +0000 (22:36 +0100)]
cogl-path: Fix the truncation when adding to a copied path
If a path is copied and then appended to, the copy needs to have the
last sub path truncated so that it fits in the total path size in case
the original path was modified. However the path size check was broken
so if the copied path had more than one sub path it would fail.
Neil Roberts [Wed, 21 Apr 2010 17:58:18 +0000 (18:58 +0100)]
test-cogl-path: Test sub paths and intersections
This changes the original tests so that it splits the original path
into two sub paths. When adding a new block to the copied path it also
adds another sub path. This further stresses the path copying
mechanism and exposes a bug.
It also tests intersections by drawing a self-intersecting path and a
path with two sub-paths that overlap. Where the path overlaps it
should be inverted.
Neil Roberts [Tue, 20 Apr 2010 13:58:57 +0000 (14:58 +0100)]
cogl-clip-stack: Use orientation of the polygon to set clip planes
Previously the clip stack code was trying to detect when the
orientation of the on-screen rectangle had changed by checking if the
order of the y-coordinates on the left edge was different from the
order the x-coordinates on the top edge. This doesn't work for some
rotations which was causing the clip planes to clip the wrong side of
the line. This patch makes it detect the orientation by calculating
the signed area which is a standard computer graphics algorithm.
http://bugzilla.openedhand.com/show_bug.cgi?id=2079
Neil Roberts [Wed, 21 Apr 2010 10:49:57 +0000 (11:49 +0100)]
cogl-path: Document how a shape is filled
This adds some documentation to cogl_path_fill() describing the fill
rule Cogl uses.
Neil Roberts [Mon, 19 Apr 2010 17:54:40 +0000 (18:54 +0100)]
cogl-path: Don't try to union sub paths
When drawing a path with only a single sub path, Cogl uses the
'even-odd' fill rule which means that if a part of the path intersects
with another part then the intersection would be inverted. However
when combining sub paths it treats them as separate paths and then
unions them together. This doesn't match the semantics of the even-odd
rule in SVG and Cairo. This patch makes it so that a new sub path is
just drawn as another triangle fan so that it will continue to invert
the stencil buffer. This is also much simpler and more efficient as
well as being more correct.
http://bugzilla.openedhand.com/show_bug.cgi?id=2088
Neil Roberts [Fri, 26 Mar 2010 23:09:11 +0000 (23:09 +0000)]
picking: Read the colour value using COGL_PIXEL_FORMAT_RGBA_8888_PRE
In commit
c0a553163b I changed the format used to read the picking
pixel to COGL_PIXEL_FORMAT_RGB_888 because it was convenient to avoid
the premult conversion. However this broke picking on GLES on some
platforms because for that glReadPixels is only guaranteed to support
GL_RGBA with GL_UNSIGNED_BYTE. Since the last commit cogl_read_pixels
will always use that format but it will end up with a conversion back
to RGB_888. This patch avoids that conversion and avoids the premult
conversion by reading in RGBA_8888_PRE.
http://bugzilla.openedhand.com/show_bug.cgi?id=2057
Neil Roberts [Fri, 26 Mar 2010 22:40:53 +0000 (22:40 +0000)]
cogl_read_pixels: Always use GL_RGBA/GL_UNSIGNED_BYTE under GLES
Under GLES glReadPixels is documented to only support GL_RGBA with
GL_UNSIGNED_BYTE and an implementation specfic format which can be
fetched with glGet, GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES and
GL_IMPLEMENTATION_COLOR_READ_TYPE_OES. This patch makes it always read
using GL_RGBA and GL_UNSIGNED_BYTE and then convert the results if
neccessary.
This has some room for improvement because it doesn't attempt to use
the implementation specific format. Also the conversion is somewhat
wasteful because there are currently no cogl_bitmap_* functions to
convert without allocating a new buffer so it ends up doing an
intermediate copy.
http://bugzilla.openedhand.com/show_bug.cgi?id=2057
Neil Roberts [Fri, 26 Mar 2010 22:34:56 +0000 (22:34 +0000)]
cogl-bitmap: Fix converting formats with and without alpha channels
_cogl_bitmap_convert_format_and_premult was failing when converting
from RGBA to RGB and vice versa. _cogl_bitmap_fallback_convert
converts without altering the premult status so when choosing a new
format it would copy over the premult bit. However, it did this
regardless of whether the new format had an alpha channel so when
converting from RGBA_8888_PRE to RGB_888 it would end up inventing a
new meaningless format which would be RGB_888_PRE. This patch makes it
avoid copying the premult flag if the destination has no alpha. It
doesn't matter if it copies when the source format has no alpha
because it will always be unset.
_cogl_bitmap_convert_format_and_premult was also breaking when
converting from RGBA_8888_PRE to RGB_888 because it would think
RGB_888 is unpremultiplied and try to convert but then
_cogl_bitmap_fallback_premult wouldn't know how to do the conversion.
http://bugzilla.openedhand.com/show_bug.cgi?id=2057
Emmanuele Bassi [Mon, 19 Apr 2010 16:55:37 +0000 (17:55 +0100)]
Require GLib >= 2.18
We use g_signal_override_class_handler(), which was added in GLib 2.18,
so we should bump up our requirements.
Neil Roberts [Thu, 15 Apr 2010 12:57:45 +0000 (13:57 +0100)]
clutter-texture: Remove confusing comments about realization
In
125bded81 some comments were introduced to ClutterTexture
complaining that it can have a Cogl texture before being
realized. Clutter always assumes that the single GL context is current
so there is no need to wait until the actor is realized before setting
a texture. This patch replaces the comments with clarification that
this should not be a problem.
The patch also changes the documentation about the realized state in
various places to clarify that it is acceptable to create any Cogl
resources before the actor is realized.
http://bugzilla.openedhand.com/show_bug.cgi?id=2075
Robert Bragg [Fri, 16 Apr 2010 13:38:52 +0000 (14:38 +0100)]
glx: handle spurious GLX_BufferSwapComplete events gracefully
Instead of simply aborting we now print out a warning, when a spurious
GLX_BufferSwapComplete event is handled since it seems that people are
coming across the problem (perhaps due to a buggy driver) and making
apps crash in this situation is a bit extreme.
Neil Roberts [Wed, 3 Feb 2010 20:58:32 +0000 (20:58 +0000)]
clutter-cairo-texture: Use the new cogl_pixel_buffer API
ClutterCairoTexture now stores the surface image data in a Cogl pixel
buffer object. When clutter_cairo_texture_create is called the buffer
is mapped and a new Cairo surface is created to render directly to the
PBO. When the surface is destroyed the buffer is unmapped and a Cogl
texture is recreated from the buffer. This should enable slightly
faster uploads when using Cairo because it avoids having to copy the
surface data to the texture.
http://bugzilla.openedhand.com/show_bug.cgi?id=1982
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Fri, 16 Apr 2010 10:11:50 +0000 (11:11 +0100)]
text: Increase the size of the Layout cache
Currently, each ClutterText caches 3 Pango layouts:
» one for the preferred, unbounded width
» one for the preferred height for a given width
» one for the allocated size
Some layout managers do a double pass that could flush the whole cache
before it has a chance of actually storing relevant data, resulting in
a continuous series of misses.
We can try to counteract this by doubling the size of the cache, from
three slots to six. More than six would be pointless, as well as too
memory consuming; but we might get down to a number between 3 and 6 at
any later point.
Rob Bradford [Tue, 13 Apr 2010 23:12:02 +0000 (00:12 +0100)]
text: Check generated size of layouts in cache
By comparing the requested size against the computed sized for existing
Pango layouts we can avoid creating layouts where the requested size
matches that of a previously computed one.
In particular this optimisation means that when working with a fixed
positioning based layout (with no constraints on the size of the
ClutterText) the same PangoLayout can be used to calculate the preferred
width, height and also the layout used for the actual painting.
http://bugzilla.openedhand.com/show_bug.cgi?id=2078
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Neil Roberts [Thu, 15 Apr 2010 09:58:28 +0000 (10:58 +0100)]
cogl: Implement retained clip stacks
This adds three new internal API functions which can be used to retain
the clip stack state and restore it later:
_cogl_get_clip_stack
_cogl_set_clip_stack
_cogl_clip_stack_copy
The functions are currently internal and not yet used but we may want
to make them public in future to replace the cogl_clip_stack_save()
and cogl_clip_stack_restore() APIs.
The get function just returns the handle to the clip stack at the top
of the stack of stacks and the set function just replaces it.
The copy function makes a cheap copy of an existing stack by taking a
reference to the top stack entry. This ends up working like a deep
copy because there is no way to modify entries of a stack but it
doesn't actually copy the data.
Neil Roberts [Thu, 15 Apr 2010 09:27:43 +0000 (10:27 +0100)]
cogl-clip-stack: Convert to be a CoglHandle
CoglClipStacks can now be reference counted via a CoglHandle. The
ClipClipState now stores handles in the list rather than CoglClipStack
pointers.
Neil Roberts [Wed, 14 Apr 2010 18:41:08 +0000 (19:41 +0100)]
Separate out CoglClipStackState from cogl-clip-stack.c
CoglClipStackState has now been renamed to CoglClipState and is moved
to a separate file. CoglClipStack now just maintains a stack and
doesn't worry about the rest of the state. CoglClipStack sill contains
the code to flush the stack to GL.
Neil Roberts [Wed, 14 Apr 2010 17:47:25 +0000 (18:47 +0100)]
cogl-slip-stack: Store clip window rect entries in Cogl coordinates
When glScissor is called it needs to pass coordinates in GL's
coordinate space where the origin is the bottom left. Previously this
conversion was done before storing the window rect in the clip
stack. However this might make it more difficult if we want to be able
to grab a handle to a clip stack and use it in different circumstances
later. This patch moves the coordinate conversion to inside the clip
state flushing code.
Neil Roberts [Wed, 14 Apr 2010 14:42:57 +0000 (15:42 +0100)]
cogl-clip-stack: Store window rect entries as ints not floats
The window rectangles are passed in as integers so there is no point
in converting them to floats when storing a stack entry for them.
Neil Roberts [Wed, 14 Apr 2010 12:17:26 +0000 (13:17 +0100)]
cogl-clip-stack: Use reference counted stack entries
The stack is now stored as a list of reference counted entries.
Instead of using a GList, each entry now contains a link with a
reference to its parent. The idea is that this would allow copying
stacks with a shared ancestry.
Previously the code flushed the state by finding the bottom of the
stack and then applying each entry by walking back up to the top. This
is slightly harder to do now because the list is no longer
doubly-linked. However I don't think it matters which order the
entries are applied so I've just changed it to apply them in reverse
order.
There was also a restriction that if ever the stencil buffer is used
then we could no longer use clip planes for any subsequent entries. I
don't think this makes sense because it should always work as long as
it doesn't attempt to use the clip planes more than once. I've
therefore removed the restriction.
Emmanuele Bassi [Wed, 14 Apr 2010 22:34:38 +0000 (23:34 +0100)]
docs: Clean up ClutterActor's long description
The Actor's long description is a bit cluttered; it contains a section
on the actor's box semantics, on the transformation order and on the
event handling.
We should use <refsect2> tags to divide the Actor's description into
logically separated sections.
We should also add a section about the custom Scriptable properties that
ClutterActor defines, and the special handling of unit-based properties.
Emmanuele Bassi [Tue, 13 Apr 2010 23:52:23 +0000 (00:52 +0100)]
Add test-cogl-wrap-mode to the ignore list
Neil Roberts [Tue, 13 Apr 2010 16:26:03 +0000 (17:26 +0100)]
cogl-atlas-texture: Fix a memory leak
The CoglAtlasTexture struct was not being freed in
_cogl_atlas_texture_free so there would be a small leak whenever a
texture was destroyed.
Thanks to Robert Bragg for spotting this.
Neil Roberts [Thu, 1 Apr 2010 17:35:32 +0000 (18:35 +0100)]
cogl-material: Use CLAMP_TO_EDGE for WRAP_AUTOMATIC unless overriden
CoglMaterial now sets GL_CLAMP_TO_EDGE if WRAP_MODE_AUTOMATIC is used
unless it is overridden when the material is flushed. The primitives
are still expected to expose repeat semantics so no user visible
changes are made. The idea is that drawing non-repeated textures is
the most common case so if we make clamp_to_ege the default then we
will reduce the number of times we have to override the
material. Avoiding overrides will become important if the overriding
mechanism is replaced with one where the primitive is expected to copy
the material and change that instead.
Neil Roberts [Wed, 31 Mar 2010 17:54:34 +0000 (18:54 +0100)]
tests: Add a conformance test for the wrap modes of a cogl material
This renders a texture using different combinations of wrap modes for
the s and t coordinates and then verifies that the expected wrapping
is acheived. The texture is drawn using rectangles, polygons and
vbos. There is also code to test a rectangle using an atlased texture
(which should test the manual repeating) however the validation for
this is currently disabled because it doesn't work.
http://bugzilla.openedhand.com/show_bug.cgi?id=2063
Neil Roberts [Thu, 1 Apr 2010 10:31:33 +0000 (11:31 +0100)]
cogl-material: Add support for setting the wrap mode for a layer
Previously, Cogl's texture coordinate system was effectively always
GL_REPEAT so that if an application specifies coordinates outside the
range 0→1 it would get repeated copies of the texture. It would
however change the mode to GL_CLAMP_TO_EDGE if all of the coordinates
are in the range 0→1 so that in the common case that the whole texture
is being drawn with linear filtering it will not blend in edge pixels
from the opposite sides.
This patch adds the option for applications to change the wrap mode
per layer. There are now three wrap modes: 'repeat', 'clamp-to-edge'
and 'automatic'. The automatic map mode is the default and it
implements the previous behaviour. The wrap mode can be changed for
the s and t coordinates independently. I've tried to make the
internals support setting the r coordinate but as we don't support 3D
textures yet I haven't exposed any public API for it.
The texture backends still have a set_wrap_mode virtual but this value
is intended to be transitory and it will be changed whenever the
material is flushed (although the backends are expected to cache it so
that it won't use too many GL calls). In my understanding this value
was always meant to be transitory and all primitives were meant to set
the value before drawing. However there were comments suggesting that
this is not the expected behaviour. In particular the vertex buffer
drawing code never set a wrap mode so it would end up with whatever
the texture was previously used for. These issues are now fixed
because the material will always set the wrap modes.
There is code to manually implement clamp-to-edge for textures that
can't be hardware repeated. However this doesn't fully work because it
relies on being able to draw the stretched parts using quads with the
same values for tx1 and tx2. The texture iteration code doesn't
support this so it breaks. This is a separate bug and it isn't
trivially solved.
When flushing a material there are now extra options to set wrap mode
overrides. The overrides are an array of values for each layer that
specifies an override for the s, t or r coordinates. The primitives
use this to implement the automatic wrap mode. cogl_polygon also uses
it to set GL_CLAMP_TO_BORDER mode for its trick to render sliced
textures. Although this code has been added it looks like the sliced
trick has been broken for a while and I haven't attempted to fix it
here.
I've added a constant to represent the maximum number of layers that a
material supports so that I can size the overrides array. I've set it
to 32 because as far as I can tell we have that limit imposed anyway
because the other flush options use a guint32 to store a flag about
each layer. The overrides array ends up adding 32 bytes to each flush
options struct which may be a concern.
http://bugzilla.openedhand.com/show_bug.cgi?id=2063
Neil Roberts [Thu, 25 Mar 2010 17:29:22 +0000 (17:29 +0000)]
Split the wrap mode of _cogl_texture_set_wrap_mode into three
GL supports setting different wrap modes for the s, t and r
coordinates so we should design the backend interface to support that
also. The r coordinate is not currently used by any of the backends
but we might as well have it to make life easier if we ever add
support for 3D textures.
http://bugzilla.openedhand.com/show_bug.cgi?id=2063
Neil Roberts [Thu, 1 Apr 2010 19:06:30 +0000 (20:06 +0100)]
cogl: Make private members really hard to accidentally use
CoglColor and CoglMatrix have public declarations with private members
so that we are free to change the implementation but the structures
could still be allocated on the stack in applications. However it's
quite easy not to realise the members are private and then access them
directly. This patch wraps the members in a macro which redefines the
symbol name when including the header outside of the clutter source.
http://bugzilla.openedhand.com/show_bug.cgi?id=2065
Neil Roberts [Mon, 12 Apr 2010 14:16:58 +0000 (15:16 +0100)]
CoglMatrix: Don't make the matrix fields private
The xx, yx, zx etc fields are meant to be read-only but they were
marked as private with the gtk-doc annotation. This patch moves the
private marker so that the 16 float member fields are public but the
type, inverted matrix, flags and padding are not.
Neil Roberts [Mon, 12 Apr 2010 11:06:03 +0000 (12:06 +0100)]
Fix indentation in CoglMatrix
The members of CoglMatrix were indented by 4 characters instead of 2.
Damien Lespiau [Sat, 10 Apr 2010 16:02:42 +0000 (17:02 +0100)]
actor: Flag the color argument of the ::pick signal as being constant
When emitting signals, one can mark arguments as being "static", ie an
indication this argument will not change during the signal emission.
This allows the signal marshalling code to create static GValues, in
this case not to copy the Color.
http://bugzilla.openedhand.com/show_bug.cgi?id=2073
Emmanuele Bassi [Fri, 9 Apr 2010 17:24:09 +0000 (18:24 +0100)]
actor: Do not use G_UNLIKELY in paint()
We decide whether the paint() should be a real paint or a paint in pick
mode depending on the global pick_mode value. Using G_UNLIKELY() on an
operation that most likely is going to be executed once every frame is
going to blow a lot of cache lines and frak with the CPU branch
prediction. Not good.
Emmanuele Bassi [Fri, 9 Apr 2010 17:22:50 +0000 (18:22 +0100)]
tests: Fix test-script.json
A trailing comma is breaking the validity of test-script.json
Fridrich Strba [Fri, 9 Apr 2010 14:43:42 +0000 (15:43 +0100)]
win32: Use GCLP_* instead of GCL_* when calling GetClassLongPtr
(commit message by Neil)
GetClassLongPtr expects a different constant when retrieving handles
or pointers. This fixes problems using Win64.
Neil Roberts [Fri, 9 Apr 2010 13:10:11 +0000 (14:10 +0100)]
Add tests/conform/test-cogl-path to .gitignore
Neil Roberts [Thu, 8 Apr 2010 16:18:40 +0000 (17:18 +0100)]
Add a test case for cogl_path
This tests various paths drawing rectangles and verifies that the
expected pixels are filled in. Some of the paths are drawn by copying
an existing path and modifying it which should test the copy-on-write
code.
Neil Roberts [Thu, 8 Apr 2010 16:43:27 +0000 (17:43 +0100)]
cogl: Support retained paths
This adds three new API calls:
CoglHandle cogl_path_get()
void cogl_path_set(CoglHandle path)
CoglHandle cogl_path_copy(CoglHandle path)
All of the fields relating to the path have been moved from the Cogl
context to a new CoglPath handle type. The cogl context now just
contains a CoglPath handle. All of the existing path commands
manipulate the data in the current path handle. cogl_path_new now just
creates a new path handle and unrefs the old one.
The path handle can be stored for later with cogl_path_get. The path
can then be copied with cogl_path_copy. Internally it implements
copy-on-write semantics with an extra optimisation that it will only
copy the data if the new path is modified, but not if the original
path is modified. It can do this because the only way to modify a path
is by appending to it so the copied path is able to store its own path
length and only render the nodes up to that length. For this to work
the copied path also needs to keep its own copies of the path extents
because the parent path may change these by adding nodes.
The clip stack now uses the cogl_path_copy mechanism to store paths in
the stack instead of directly copying the data. This should save some
memory and processing time.