Emmanuele Bassi [Tue, 15 Jun 2010 15:46:59 +0000 (16:46 +0100)]
Add cogl-depth-test to the Git ignore file
Emmanuele Bassi [Tue, 15 Jun 2010 15:42:30 +0000 (16:42 +0100)]
Set the initial value of a variable
Fixes a compiler warning.
Robert Bragg [Mon, 14 Jun 2010 22:14:15 +0000 (23:14 +0100)]
material: Adds arbfp compile counter
This adds a uprof counter to track how many ARBfp programs get compiled
by an application.
Robert Bragg [Thu, 10 Jun 2010 18:03:57 +0000 (19:03 +0100)]
material: Support sparse ARBfp program generation
We don't need to generate a new ARBfp program for every material created
if we can find an ancestor whos state will result in the same program
being generated.
The more code we can have adopt the coding pattern of deriving their
materials from other similar materials using cogl_material_copy() the
more likely this metric will be good enough on its own to minimize the
set of arbfp programs necessary to support a given application.
Robert Bragg [Mon, 14 Jun 2010 21:20:27 +0000 (22:20 +0100)]
material: free any layer cache in material_set_parent
Previously in _cogl_material_pre_change_notify we manually freed the
layer caches of a material if we caused a reparent, but it makes more
sense to have _cogl_material_set_parent do this directly instead.
Robert Bragg [Thu, 27 May 2010 19:04:49 +0000 (20:04 +0100)]
Adds an internal weak material mechanism
This adds a _cogl_material_weak_copy() function that can be used to
create materials that don't count as strong dependants on their parents.
This means the parent can be modified without worrying about how it will
affect weak materials. The material age of the parent can potentially be
queried to determine if a weak material might need to be re-created.
Robert Bragg [Thu, 27 May 2010 14:19:15 +0000 (15:19 +0100)]
material: Adds a simple material age getter
When we add support for weak materials it's expected that Clutter will
want to attach them as private data to other materials and it needs a
mechanism to determine when a weak material should be re-created because
its parent has changed somehow.
This adds the concept of a material age (internal only currently) which
increments whenever a material is modified. Clutter can then save the
age of the material which its weak materials are derived from and later
determine when the weak material may be invalid.
Robert Bragg [Thu, 27 May 2010 14:18:15 +0000 (15:18 +0100)]
primitives: we were memsetting the wrong wrap mode overrides pointer
In _cogl_texture_quad_multiple_primitives we weren't memsetting the
CoglMaterialWrapModeOverrides structure we were memsetting
&state.wrap_mode_overrides where state.wrap_mode_overrides is just a
pointer that might potentially later point to the
CoglMaterialWrapModeOverrides structure.
Robert Bragg [Wed, 26 May 2010 13:13:37 +0000 (14:13 +0100)]
material: generalize how we compare simple material properties
In _cogl_material_equal we were repeating the same code pattern to
compare several of the state groups so this just adds
simple_property_equal function that's now used instead.
Robert Bragg [Wed, 26 May 2010 10:33:32 +0000 (11:33 +0100)]
material: Make CoglMaterial responsible for depth state
This redirects the legacy depth testing APIs through CoglMaterial and
adds a new experimental cogl_material_ API for handling the depth
testing state.
This adds the following new functions:
cogl_material_set_depth_test_enabled
cogl_material_get_depth_test_enabled
cogl_material_set_depth_writing_enabled
cogl_material_get_depth_writing_enabled
cogl_material_set_depth_test_function
cogl_material_get_depth_test_function
cogl_material_set_depth_range
cogl_material_get_depth_range
As with other experimental Cogl API you need to define
COGL_ENABLE_EXPERIMENTAL_API to access them and their stability isn't
yet guaranteed.
Robert Bragg [Wed, 26 May 2010 02:07:17 +0000 (03:07 +0100)]
cogl docs: Improve documentation for cogl_ortho
cogl_ortho is one of those APIs whos style was, for better or worse,
copied from OpenGL and for some inexplicable reason the near and far
arguments are inconsistent with the left, right, top, bottom arguments
because they don't take z coordinates they take a "distance" which
should be negative for a plane behind the viewer.
This updates the documentation to explain this.
Robert Bragg [Wed, 19 May 2010 00:02:16 +0000 (01:02 +0100)]
primitives: no longer assume _get_layers list remains valid
The internal CoglMaterialLayer pointers associated with a material may
change whenever layer properties are modified so it's no longer ok to
assume that a list of layers returned by cogl_material_get_layers
remains valid if the layers have been changed.
Robert Bragg [Tue, 18 May 2010 23:36:31 +0000 (00:36 +0100)]
material: Adds simple breadcrumb debugging mechanism
Since it can sometimes be awkward to figure out where a particular
material came from when debugging, this adds a breadcrumb mechanism that
lets you associate a const string with a material that may give a clue
about its origin.
Robert Bragg [Tue, 18 May 2010 22:38:33 +0000 (23:38 +0100)]
material: remove override options from _cogl_material_equal
As a follow on to using cogl_material_copy instead of flush options this
patch now removes the ability to pass flush options to
_cogl_material_equal which is the final reference to the
CoglMaterialFlushOptions mechanism.
Robert Bragg [Tue, 18 May 2010 21:42:49 +0000 (22:42 +0100)]
cogl: remove _cogl_material_flush_gl_state flush options
Since cogl_material_copy should now be cheap to use we can simplify
how we handle fallbacks and wrap mode overrides etc by simply copying
the original material and making our override changes on the new
material. This avoids the need for a sideband state structure that has
been growing in size and makes flushing material state more complex.
Note the plan is to eventually use weak materials for these override
materials and attach these as private data to the original materials so
we aren't making so many one-shot materials.
Robert Bragg [Thu, 8 Apr 2010 11:21:04 +0000 (12:21 +0100)]
CoglMaterial: Implements sparse materials design
This is a complete overhaul of the data structures used to manage
CoglMaterial state.
We have these requirements that were aiming to meet:
(Note: the references to "renderlists" correspond to the effort to
support scenegraph level shuffling of Clutter actor primitives so we can
minimize GPU state changes)
Sparse State:
We wanted a design that allows sparse descriptions of state so it scales
well as we make CoglMaterial responsible for more and more state. It
needs to scale well in terms of memory usage and the cost of operations
we need to apply to materials such as comparing, copying and flushing
their state. I.e. we would rather have these things scale by the number
of real changes a material represents not by how much overall state
CoglMaterial becomes responsible for.
Cheap Copies:
As we add support for renderlists in Clutter we will need to be able to
get an immutable handle for a given material's current state so that we
can retain a record of a primitive with its associated material without
worrying that changes to the original material will invalidate that
record.
No more flush override options:
We want to get rid of the flush overrides mechanism we currently use to
deal with texture fallbacks, wrap mode changes and to handle the use of
highlevel CoglTextures that need to be resolved into lowlevel textures
before flushing the material state.
The flush options structure has been expanding in size and the structure
is logged with every journal entry so it is not an approach that scales
well at all. It also makes flushing material state that much more
complex.
Weak Materials:
Again for renderlists we need a way to create materials derived from
other materials but without the strict requirement that modifications to
the original material wont affect the derived ("weak") material. The
only requirement is that its possible to later check if the original
material has been changed.
A summary of the new design:
A CoglMaterial now basically represents a diff against its parent.
Each material has a single parent and a mask of state that it changes.
Each group of state (such as the blending state) has an "authority"
which is found by walking up from a given material through its ancestors
checking the difference mask until a match for that group is found.
There is only one root node to the graph of all materials, which is the
default material first created when Cogl is being initialized.
All the groups of state are divided into two types, such that
infrequently changed state belongs in a separate "BigState" structure
that is only allocated and attached to a material when necessary.
CoglMaterialLayers are another sparse structure. Like CoglMaterials they
represent a diff against their parent and all the layers are part of
another graph with the "default_layer_0" layer being the root node that
Cogl creates during initialization.
Copying a material is now basically just a case of slice allocating a
CoglMaterial, setting the parent to be the source being copied and
zeroing the mask of changes.
Flush overrides should now be handled by simply relying on the cheapness
of copying a material and making changes to it. (This will be done in a
follow on commit)
Weak material support will be added in a follow on commit.
Robert Bragg [Tue, 15 Jun 2010 13:26:37 +0000 (14:26 +0100)]
material: fix #ifdef guard around use of _TEXTURE_RECTANGLE
We were incorrectly guarding the use of GL_TEXTURE_RECTANGLE_ARB with
ifdef ARB_texture_rectangle instead of ifdef GL_ARB_texture_rectangle
which broke test-cogl-texture-rectangle.
Robert Bragg [Thu, 10 Jun 2010 13:39:20 +0000 (14:39 +0100)]
blend-strings: removes the AUTO_COMPOSITE function enum
This was mistakenly added some time ago because at some point when we
were discussing how to handle premultiplied alpha in Clutter/Cogl we
were considering having a magic "just do the right thing" option which
was later abandoned.
Robert Bragg [Thu, 10 Jun 2010 13:17:42 +0000 (14:17 +0100)]
cogl-color: add cogl_color_init_from_xyz funcs
This is to try and improve API consistency. Simple cogl structures that
don't derive from CoglObject and which can be allocated on the stack,
such as CoglColor and CoglMatrix should all have "_init" or
"_init_from" functions to initialize all the structure members. (As
opposed to a cogl_xyz_new() function for CoglObjects). CoglColor
previously used the naming scheme "_set_from" for these initializers but
"_set" is typically reserved for setting individual properties of a
structure/object.
This adds three _init functions:
cogl_color_init_from_4ub
cogl_color_init_from_4f
cogl_color_init_from_4fv
The _set_from functions are now deprecated but only with a gtk-doc
annotation for now. This is because the cogl_color_set_from API is quite
widely used already and so were giving a grace period before enabling a
GCC deprecated warning just because otherwise the MX maintainers will
complain to me that I've made their build logs look messy.
Robert Bragg [Thu, 10 Jun 2010 13:07:40 +0000 (14:07 +0100)]
cogl-color: add private _cogl_color_get_rgba_4ubv API
The journal logs colors as 4bytes into a vertex array and since we are
planning to make CoglMaterial track its color using a CoglColor instead
of a byte array this convenience will be useful for re-implementing
_cogl_material_get_colorubv.
Johan Bilien [Mon, 14 Jun 2010 19:34:24 +0000 (19:34 +0000)]
build: Do not include built sources in the distribution
allows to run make distcheck without first running make
http://bugzilla.openedhand.com/show_bug.cgi?id=2171
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Øyvind Kolås [Mon, 14 Jun 2010 15:57:44 +0000 (16:57 +0100)]
state: consistently use clutter_state_get_state where possible
The previous commit reimplemented logic for creating states, this - and
other parts of the code should be using clutter_state_get_state.
Øyvind Kolås [Mon, 14 Jun 2010 14:45:07 +0000 (15:45 +0100)]
state: make null source state encounterd in json treated as wildcard
To be properly useful the state machine needs to be able to specify the
default transitions to a target state with no specified source state.
Øyvind Kolås [Tue, 25 May 2010 10:54:15 +0000 (11:54 +0100)]
test-state: move press/release callbacks to stage avoiding grab
Emmanuele Bassi [Mon, 14 Jun 2010 13:05:49 +0000 (14:05 +0100)]
docs: Clarify the scope of Text:single-line-mode
Only editable text actors can be in single-line mode.
Kristian Høgsberg [Mon, 14 Jun 2010 11:59:42 +0000 (12:59 +0100)]
Don't add GL libs for EGL X11 backend
Configure uses the GL .pc file to add GL includes and libs for the eglx
backend.
http://bugzilla.openedhand.com/show_bug.cgi?id=2104
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Neil Roberts [Mon, 14 Jun 2010 10:59:33 +0000 (11:59 +0100)]
clutter-text: Round the layout width to nearest integer not down
When converting the floating point allocation width to an integer
multiple of PANGO_SCALE to give to the PangoLayout it can sometimes
end up slightly short of the allocated size due to rounding
errors. This can cause some of the lines to be wrapped differently
when a non-integer-aligned position is used (such as when animating
text). It works better to round the number to the nearest integer by
adding 0.5 instead of letting the default float cast truncate it
downwards.
http://bugzilla.openedhand.com/show_bug.cgi?id=2170
Emmanuele Bassi [Sat, 12 Jun 2010 16:45:54 +0000 (17:45 +0100)]
drag-action: Remove the press event button
Both ::drag-begin and ::drag-end have a "button" argument - even though
we assume internally, and externally, that dragging can only be the
result of a primary button operation.
Emmanuele Bassi [Fri, 11 Jun 2010 17:12:54 +0000 (18:12 +0100)]
Merge branch 'wip/deform-effect'
* wip/deform-effect:
docs: Add DeformEffect and PageTurnEffect to the API reference
effect: Add PageTurnEffect
effect: Add DeformEffect
offscreen-effect: Traslate the modelview with the offsets
docs: Fix Effect subclassing section
Emmanuele Bassi [Fri, 11 Jun 2010 14:49:46 +0000 (15:49 +0100)]
Hide the marshallers
The marshallers we use for the signals are declared in a private header,
and it stands to reason that they should also be hidden in the shared
object by using the common '_' prefix. We are also using some direct
g_cclosure_marshal_* symbol from GLib, instead of consistently use the
clutter_marshal_* symbol.
Neil Roberts [Fri, 11 Jun 2010 13:47:30 +0000 (14:47 +0100)]
cogl/winsys/cogl-eglx: Use the right egl header on 1.1
Commit
b0cc98fdceb introduced a #include for the egl header in
cogl-eglx.c The header name is different under GLES 1.1 so it broke
compilation.
Neil Roberts [Fri, 11 Jun 2010 13:37:56 +0000 (14:37 +0100)]
cogl-program: Add cogl_program_uniform_1i to GLES
The GLES 1.1 backend was missing a stub for cogl_program_uniform_1i.
Neil Roberts [Fri, 11 Jun 2010 13:36:38 +0000 (14:36 +0100)]
cogl-gles2: Prefix internal GLES 2 wrapper symbols with _
Some internal symbols used for the GLES 2 wrapper were accidentally
being exported. This prepends an underscore to them so they won't
appear in the shared library.
Emmanuele Bassi [Fri, 11 Jun 2010 14:23:46 +0000 (15:23 +0100)]
click-action: Use clutter_actor_contains()
Instead of an internal copy.
Dan Winship [Thu, 10 Jun 2010 12:24:55 +0000 (08:24 -0400)]
actor: add clutter_actor_contains()
It is often useful to determine if one actor is an ancestor of
another. Add a method to do that.
http://bugzilla.openedhand.com/show_bug.cgi?id=2162
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Fri, 11 Jun 2010 13:47:48 +0000 (14:47 +0100)]
shader-effect: Allow creating vertex shaders
By default, ShaderEffect creates a fragment shader; in order to be able
to deprecate ClutterShader we need a way for ShaderEffect sub-classes to
create a vertex shader if needed - By using a write-only, constructor
only property.
ClutterShader has, internally, a ClutterShaderType enumeration that can
be used exactly for this. We just need to expose it and create a GObject
property for ClutterShaderEffect.
Neil Roberts [Thu, 22 Apr 2010 13:33:47 +0000 (14:33 +0100)]
cogl-clip-stack: Always use the scissor when clipping
Whenever a path or a rectangle is added to the clip stack it now also
stores a screen space bounding box in the entry. Then when the clip
stack is flushed the bounding box is first used to set up the
scissor. That way when we eventually come to use the stencil buffer
the clear will be affected by the scissor so we don't have to clear
the entire buffer.
Neil Roberts [Thu, 22 Apr 2010 13:13:52 +0000 (14:13 +0100)]
cogl-path: Export _cogl_path_get_bounds
_cogl_path_get_bounds is no longer static and is exported in
cogl-path-private.h so that it can be used in the clip stack code. The
old version of the function returned x/y and width/height. However
this was mostly used to call cogl_rectangle which takes x1/y1
x2/y2. The function has been changed to just directly return the
second form because it is more useful. Anywhere that was previously
using the function now just directly looks at path->path_nodes_min and
path->path_nodes_max instead.
Neil Roberts [Thu, 22 Apr 2010 12:48:49 +0000 (13:48 +0100)]
cogl-clip-state: Export transform_point internally to Cogl
The transform_point function takes a modelview matrix, projection
matrix and a viewport and performs all three transformations on a
point to give a Cogl window coordinate. This is useful in a number of
places in Cogl so this patch moves it to cogl.c and adds it to
cogl-internal.h
Sunil Sadasivan [Thu, 13 May 2010 07:59:06 +0000 (00:59 -0700)]
cogl_texture_get_data() copies using wrong width size.
For sliced 2D textures, _cogl_texture_2d_sliced_get_data() uses the
bitmap width, instead of the rowstride, when memcpy()ing into the
dest buffer.
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Damien Lespiau [Sun, 6 Jun 2010 22:03:26 +0000 (23:03 +0100)]
cogl-color: Provide setters for all the channels
We only had getters for the red, green, blue and alpha channels of a
color. This meant that, if you wanted to change, say, the alpha
component of a color, one would need to query the red, green and blue
channels and use set_from_4ub() or set_from_4f().
Instead of this, just provide some setters for CoglColor, using the same
naming scheme than the existing getters.
Damien Lespiau [Sun, 6 Jun 2010 21:57:02 +0000 (22:57 +0100)]
cogl-color: Add cogl_color_unpremultiply()
For some operations on pre-multiplied colors (say, replace the alpha
value), you need to unpremultiply the color.
This patch provides the counterpart to cogl_color_premultiply().
Emmanuele Bassi [Wed, 26 May 2010 15:32:23 +0000 (16:32 +0100)]
cogl: Initialize the framebuffer bits on state flush
The place where we actually change the framebuffer is
_cogl_framebuffer_flush_state(), so if we changed to a new frame buffer
we need to initialize the color bits there.
http://bugzilla.openedhand.com/show_bug.cgi?id=2094
Emmanuele Bassi [Wed, 26 May 2010 16:14:53 +0000 (17:14 +0100)]
cogl-framebuffer: Use the FBO extension for color sizes
OpenGL 3.0 deprecated querying of the GL_{RED,GREEN,BLUE}_BITS
constants, and the FBO extension provides a mechanism to query for the
color buffer sizes which *should* work even with the default
framebuffer. Unfortunately, this doesn't seem to hold for Mesa - so we
just use this for the offscreen CoglFramebuffer type, and we fall back
to glGetIntegerv() for the onscreen one.
http://bugzilla.openedhand.com/show_bug.cgi?id=2094
Emmanuele Bassi [Wed, 26 May 2010 15:31:18 +0000 (16:31 +0100)]
cogl: Hide cogl_framebuffer_get_*_bits()
These accessors should be private, for the time being.
http://bugzilla.openedhand.com/show_bug.cgi?id=2094
Emmanuele Bassi [Thu, 10 Jun 2010 17:51:22 +0000 (18:51 +0100)]
docs: Add DeformEffect and PageTurnEffect to the API reference
Emmanuele Bassi [Thu, 10 Jun 2010 15:56:16 +0000 (16:56 +0100)]
effect: Add PageTurnEffect
A simple deformation effect that simulates a page curl.
Ported from MxDeformPageTurn inside the Mx toolkit, written by
Chris Lord.
Emmanuele Bassi [Wed, 9 Jun 2010 16:52:06 +0000 (17:52 +0100)]
effect: Add DeformEffect
DeformEffect is an abstract class that should be used to write effects
that change the geometry of an actor before submitting it to the GPU.
Just like the ShaderEffect class, DeformEffect renders the actor to
which it has been applied into an FBO; then it creates a mesh and stores
it inside a VBO. Sub-classes can control vertex attributes like
position, texel coordinates and the color.
Emmanuele Bassi [Thu, 10 Jun 2010 16:35:56 +0000 (17:35 +0100)]
offscreen-effect: Traslate the modelview with the offsets
Instead of using the stage offsets when painting we can simply traslate
the current modelview. This allows sub-classes to fully override the
paint_target() virtual function without chaining up.
Emmanuele Bassi [Thu, 10 Jun 2010 16:34:48 +0000 (17:34 +0100)]
docs: Fix Effect subclassing section
It still mentions the long since removed "prepare" function.
Neil Roberts [Wed, 9 Jun 2010 12:53:34 +0000 (13:53 +0100)]
cogl-material: Fix the function which sets the enable blend flag
This function had two problems. Firstly it would clear the enable
blend flag before calling pre_change_notify so that if blending was
previously enabled the journal would end up being flushed while the
flag was still cleared. Secondly it would call the pre change notify
whenever blending is needed regardless of whether it was already
needed previously.
This was causing problems in test-depth.
Robert Bragg [Mon, 26 Apr 2010 09:01:43 +0000 (10:01 +0100)]
material: Avoid redundant glBindTexture calls
This adds a _cogl_bind_gl_texture_transient function that should be used
instead of glBindTexture so we can have a consistent cache of the
textures bound to each texture unit so we can avoid some redundant
binding.
Robert Bragg [Mon, 26 Apr 2010 09:01:43 +0000 (10:01 +0100)]
material: Adds backend abstraction for fragment processing
As part of an effort to improve the architecture of CoglMaterial
internally this overhauls how we flush layer state to OpenGL by adding a
formal backend abstraction for fragment processing and further
formalizing the CoglTextureUnit abstraction.
There are three backends: "glsl", "arbfp" and "fixed". The fixed backend
uses the OpenGL fixed function APIs to setup the fragment processing,
the arbfp backend uses code generation to handle fragment processing
using an ARBfp program, and the GLSL backend is currently only there as
a formality to handle user programs associated with a material. (i.e.
the glsl backend doesn't yet support code generation)
The GLSL backend has highest precedence, then arbfp and finally the
fixed. If a backend can't support some particular CoglMaterial feature
then it will fallback to the next backend.
This adds three new COGL_DEBUG options:
* "disable-texturing" as expected should disable all texturing
* "disable-arbfp" always make the arbfp backend fallback
* "disable-glsl" always make the glsl backend fallback
* "show-source" show code generated by the arbfp/glsl backends
Neil Roberts [Wed, 9 Jun 2010 13:42:18 +0000 (14:42 +0100)]
cogl-atlas-texture: Flush the journal before starting blit not after
_cogl_atlas_texture_blit_begin binds a texture to use as the
destination and it expects it to stay bound until
_cogl_atlas_texture_end_blit is called. However there was a call to
_cogl_journal_flush directly after setting up the blit state which
could cause the wrong texture to be bound. This just moves the flush
to before the call to _cogl_atlas_texture_blit_begin.
This was breaking test-cogl-sub-texture.
Robert Bragg [Fri, 4 Jun 2010 15:42:30 +0000 (16:42 +0100)]
atlas: fix some journal flushing issues
1) Always flush when migrating textures out of an atlas because although
it's true that the original texture data will remain valid in the
original texture we can't assume that journal entries have resolved the
GL texture that will be used. This is only true if a layer0_override has
been used.
2) Don't flush at the point of creating a new atlas simply flush
immediately before reorganizing an atlas. This means we are now assuming
that we will never see recursion due to atlas textures being modified
during a journal flush. This means it's the responsibility of the
primitives code to _ensure_mipmaps for example not the responsibility of
_cogl_material_flush_gl_state.
Robert Bragg [Fri, 4 Jun 2010 16:06:32 +0000 (17:06 +0100)]
primitives: make sure to update texture storage before drawing
We want to make sure that the material state flushing code will never
result in changes to the texture storage for that material. So for
example mipmaps need to be ensured by the primitives code.
Changes to the texture storage will invalidate the texture coordinates
in the journal and we want to avoid a recursion of journal flushing.
Robert Bragg [Mon, 26 Apr 2010 15:30:25 +0000 (16:30 +0100)]
test-cogl-tex-foreign: save and restore GL state correctly
This test breaks out into raw OpenGL to create a foreign texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.
Robert Bragg [Mon, 26 Apr 2010 15:27:59 +0000 (16:27 +0100)]
test-cogl-texture-rectangle: save restore GL state correctly
This test breaks out into raw OpenGL to create a RECTANGLE texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.
Robert Bragg [Mon, 26 Apr 2010 08:55:50 +0000 (09:55 +0100)]
matrix: add cogl_matrix_equal API
This adds a way to compare two CoglMatrix structures to see if they
represent the same transformations. memcmp can't be used because a
CoglMatrix contains private flags and padding.
Damien Lespiau [Wed, 18 Nov 2009 00:26:09 +0000 (00:26 +0000)]
cogl-material: Use fragment programs instead of texture env combiners
THIS IS A WORK IN PROGRESS
Mesa is building a big shader when using ARB_texture_env_combine. The
idea is to bypass that computation, do it ourselves and cache the
compiled program in a CoglMaterial.
For now that feature can be enabled by setting the COGL_PIPELINE
environment variable to "arbfp". COGL_SHOW_FP_SOURCE can be set to a non
empty string to dump the fragment program source too.
TODO:
* fog (really easy, using OPTION)
* support tex env combiner operands, DOT3, ADD_SIGNED, INTERPOLATE
combine modes (need refactoring the generation of temporary
variables) (not too hard)
* alpha testing for GLES 2.0?
Damien Lespiau [Sat, 14 Nov 2009 14:59:59 +0000 (14:59 +0000)]
cogl: Introduce private feature flags and check for ARB_fp
The Cogl context has now a feature_flags_private enum that will allow us
to query and use OpenGL features without exposing them in the public
API.
The ARB_fragment_program extension is the first user of those flags.
Looking for this extension only happens in the gl driver as the gles
drivers will not expose them.
One can use _cogl_features_available_private() to check for the
availability of such private features.
While at it, reindent cogl-internal.h as described in CODING_STYLE.
Neil Roberts [Wed, 9 Jun 2010 11:18:53 +0000 (12:18 +0100)]
test-cogl-texture-rectangle: Fix the size allocated for reading data
The test was only allocating enough space for 256 rows of pixels but
it was then reading 384 so it would randomly fail.
Emmanuele Bassi [Wed, 9 Jun 2010 10:53:58 +0000 (11:53 +0100)]
Always have a valid font map
Every time we request a CoglPangoFontMap, either internally or
externally, we should have one available.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Johan Bilien [Tue, 8 Jun 2010 19:22:29 +0000 (15:22 -0400)]
Create the pango context in clutter_set_font_flags
if it wasn't already. Allows honoring CLUTTER_FONT_MIPMAPPING.
http://bugzilla.openedhand.com/show_bug.cgi?id=2161
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Robert Bragg [Thu, 3 Jun 2010 19:03:20 +0000 (20:03 +0100)]
backend-glx: Avoid vblank waits/glFinish calls when throttling blits
If we have the GLX_SGI_video_sync extension then it's possible to always
keep track for the video sync counter each time we call glXSwapBuffers
or do a sub stage blit. This then allows us to avoid waiting before
issuing a blit if we can see that the counter has already progressed.
Also since we expect that glXCopySubBuffer is synchronized to the vblank
we don't need to use glFinish () in conjunction with the vblank wait
since the vblank wait's only purpose is to add a delay.
Robert Bragg [Thu, 3 Jun 2010 22:12:08 +0000 (23:12 +0100)]
backend-glx: only check for GLX_SGI_video_sync for direct contexts
The GLX_SGI_video_sync spec explicitly says that it's only supported for
direct contexts so we don't setup up the function pointers if
glXIsDirect () returns GL_FALSE.
Robert Bragg [Thu, 3 Jun 2010 19:03:20 +0000 (20:03 +0100)]
backend-glx: Make sure to throttle sub region blits
Neither glXCopySubBuffer or glBlitFramebuffer are integrated with the
swap interval of a framebuffer so that means when we do partial stage
updates (as Mutter does in response to window damage) then the blits
aren't throttled which means applications that throw lots of damage
events at the compositor can effectively cause Clutter to run flat out
taking up all the system resources issuing more blits than can even be
seen.
This patch now makes sure we use the GLX_SGI_video_sync or a
DRM_VBLANK_RELATIVE ioctl to throttle blits to the vblank frequency as
we do when using glXSwapBuffers.
Adel Gadllah [Sat, 5 Jun 2010 10:51:32 +0000 (12:51 +0200)]
backend-glx: Provide copy_sub_buffer fallback
Currently glXCopySubBufferMESA is used for sub stage redraws, but in case
a driver does not support GLX_MESA_copy_sub_buffer we fall back to redrawing
the complete stage which isn't really optimal.
So instead to directly fallback to complete redraws try using GL_EXT_framebuffer_blit
to do the BACK to FRONT buffer copies.
http://bugzilla.openedhand.com/show_bug.cgi?id=2128
Neil Roberts [Tue, 8 Jun 2010 16:26:26 +0000 (17:26 +0100)]
cogl-gles2-wrapper: Fix some cases using the wrong texture unit
At two places in cogl_wrap_prepare_for_draw it was trying to loop over
the texture units to flush some state. However it was retrieving the
texture unit pointer using w->active_texture_unit instead of the loop
index so it would end up with the wrong state.
Also in glEnableClientState it was using the active unit instead of
the client active unit.
Emmanuele Bassi [Tue, 8 Jun 2010 10:19:28 +0000 (11:19 +0100)]
texture-async: Fix path fallback code
And error out in case of load failure.
Emmanuele Bassi [Mon, 7 Jun 2010 22:26:03 +0000 (23:26 +0100)]
Post-release bump to 1.3.5
Emmanuele Bassi [Mon, 7 Jun 2010 22:19:02 +0000 (23:19 +0100)]
Release 1.3.4
Emmanuele Bassi [Mon, 7 Jun 2010 21:45:34 +0000 (22:45 +0100)]
script: Support layout manager properties
Layout properties work similarly to child properties, with the added
headache that they require the 3-tuple:
( layout manager, container, actor )
to be valid in order to be inspected, parsed and applied. This means
using the newly added back-pointer from the container to the layout
manager and then rejigging a bit how the ScriptParser handles the
unresolved properties.
Similarly to the child properties, which use the "child::" prefix, the
layout manager properties use the "layout::" prefix and are defined with
the child of a container holding a layout manager.
Emmanuele Bassi [Mon, 7 Jun 2010 20:34:36 +0000 (21:34 +0100)]
layout-manager: Implement set_container()
Store a back pointer of the layout manager inside the container using
the GObject instance data. This introduces a change in the implementation
of ClutterLayoutManager, though it's still binary compatible.
Emmanuele Bassi [Mon, 7 Jun 2010 14:45:24 +0000 (15:45 +0100)]
blur-effect: Fix loop unrolling
The box blur shader was not sampling all the points for producing the
desired effect.
Damien Lespiau [Sat, 5 Jun 2010 20:05:23 +0000 (21:05 +0100)]
doc: Some fixes for the Cogl documentation
• 3 general fixes (typos, copy/paste),
• ignore cogl-object-private.h,
• cogl_fixed_atani() was in reality cogl_fixed_atan(), fixed in commit
43564f05.
• Fix the cogl-vector section: sections must have a </SECTION> tag at
the end. Also the cogl-vector section was added in the middle of the
cogl-buffer one. Let's shiffle it out and add that </SECTION> tag.
Damien Lespiau [Mon, 31 May 2010 20:04:53 +0000 (21:04 +0100)]
animator,state: Mark variadic functions that ends with NULL
GCC can catch errors when it knows that a variadic function must be
ended with NULL. Let's use the glib macro encapsulating the GCC
attribute to clutter_animator_set() and clutter_state_set().
Colin Walters [Fri, 4 Jun 2010 03:34:09 +0000 (23:34 -0400)]
g_source_set_name on custom sources (if available)
Call g_source_set_name, if the versio of GLib is new enough.
This aids debugging, using e.g. SystemTap. See
https://bugzilla.gnome.org/show_bug.cgi?id=620511
for more information
http://bugzilla.openedhand.com/show_bug.cgi?id=2151
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 7 Jun 2010 09:52:32 +0000 (10:52 +0100)]
Add test-cogl-object to the ignore file
Damien Lespiau [Fri, 4 Jun 2010 16:17:45 +0000 (17:17 +0100)]
build: Don't distribute clutter-version.h and cogl-defines.h
As with
a351ff2af earlier, distributing headers generated at configure
time conflicts with out of tree builds as the distributed headers will
be included first instead of including the generated ones.
Robert Bragg [Tue, 1 Jun 2010 18:27:07 +0000 (19:27 +0100)]
cogl-object-private.h: white space cleanup
simply replaces tabs with spaces
Robert Bragg [Tue, 1 Jun 2010 16:27:59 +0000 (17:27 +0100)]
conform: Adds a test-cogl-object conformance test
This tests the new cogl_object_get/set_user_data API
Robert Bragg [Tue, 1 Jun 2010 17:06:47 +0000 (18:06 +0100)]
CoglObject: Adds a COGL_OBJECT macro for casting
This adds a convenience COGL_OBJECT macro for casting CoglObject
subclasses to (CoglObject *) pointers.
Robert Bragg [Thu, 27 May 2010 21:24:56 +0000 (22:24 +0100)]
CoglObject: Adds cogl_object_{get,set}_user_data
This provides a mechanism for associating private data with any
CoglObject. We expect Clutter will use this to associate weak materials
with normal materials.
Robert Bragg [Tue, 1 Jun 2010 16:53:42 +0000 (17:53 +0100)]
cogl-path: Adds missing cogl_is_path prototype
This adds a missing cogl_is_path prototype to the public cogl-path.h
header.
Robert Bragg [Tue, 1 Jun 2010 16:34:59 +0000 (17:34 +0100)]
cogl-path: Renames cogl_path_get/set cogl_get/set_path
These aren't path methods so aren't consistent with the
cogl_object_method naming style we are aiming for.
Emmanuele Bassi [Thu, 3 Jun 2010 14:20:17 +0000 (15:20 +0100)]
test-drag: Add desaturation effect
Use a desaturation effect on the drag handle.
Damien Lespiau [Thu, 3 Jun 2010 12:48:53 +0000 (13:48 +0100)]
build: Fix out of tree gtk-doc generation
Various headers are build in builddirs (clutter-marshal.h, mkenums
headers and cogl-define.h) so we need to add the corresponding include
paths for gtk-doc to build its scanner.
Damien Lespiau [Thu, 3 Jun 2010 10:59:48 +0000 (11:59 +0100)]
build: Do not distribute clutter-json.h
clutter-jon.h is generated at configure time, we should not distribute it.
This caused a build issue when compiling from a tarballs and out of tree
builds as we ended up with two clutter-json.h one in $(top_srcdir)/json
and the other in $(top_builddir)/json and picked up the wrong one
($(top_srcdir)/json is included first in the include search path).
Emmanuele Bassi [Thu, 3 Jun 2010 13:34:41 +0000 (14:34 +0100)]
docs: Effects fixes for the API reference
Emmanuele Bassi [Thu, 3 Jun 2010 13:08:59 +0000 (14:08 +0100)]
effects: Fix stacking of offscreen-based effects
Stacking multiple effects sub-classing ClutterOffscreenEffect requires
a small fix in the code that computes the screen coordinates of the
actor to position the FBO correctly with regards to the stage.
Emmanuele Bassi [Tue, 1 Jun 2010 13:45:55 +0000 (14:45 +0100)]
actor: Add "effects" to the animatable metas
Since ClutterEffect is an ActorMeta it should be possible to animate the
properties of named effects using the @effects syntax, just like it
happens for actions and constraints.
Emmanuele Bassi [Mon, 17 May 2010 11:55:46 +0000 (12:55 +0100)]
shader-effect: Simplify setting the shader source
Sub-classes of ShaderEffect currently have to get the handle for the
Cogl shader and call cogl_shader_source(); this makes it awkward to
implement a ShaderEffect, and it exposes handles and Cogl API that we
might want to change in the future.
We should provide a ClutterShaderEffect method that allows to (safely)
set the shader source at the right time for sub-classes to use.
Emmanuele Bassi [Wed, 21 Apr 2010 10:30:06 +0000 (11:30 +0100)]
docs: Add Effects API to the reference
Emmanuele Bassi [Fri, 16 Apr 2010 11:33:20 +0000 (12:33 +0100)]
effect: Rework the OffscreenEffect painting
The OffscreenEffect should set up the off screen draw buffer so that it
has the same projection and modelview as if it where on screen; we
achieve that by setting up the viewport to be the same size of the stage
but with an initial offset given by the left-most vertex of the actor.
When we paint the texture attached to the FBO we then set up the
modelview matrix of the on screen draw buffer so that it's the same as
the stage one: this way, the texture will be painted in screen
coordinates and it will occupy the same area as the actor would have
had.
Emmanuele Bassi [Tue, 13 Apr 2010 23:40:24 +0000 (00:40 +0100)]
effect: Add ColorizeEffect
A copy of DesaturateEffect that converts to grayscale and applies a
user-defined tint to the render target.
Emmanuele Bassi [Fri, 9 Apr 2010 15:14:21 +0000 (16:14 +0100)]
effect: Add DesaturateEffect
A simple shader-based effect that desaturates an actor and its contents
based on a controllable factor.
Emmanuele Bassi [Thu, 8 Apr 2010 17:46:54 +0000 (18:46 +0100)]
effect: Add BlurEffect
A simple, GLSL shader-based blur effect.
The blur shader is taken straight from the test-shader.c interactive
test case. It's a fairly clunky, inefficient and visually incorrect
implementation of a box blur, but it's all we have right now until I
figure out a way to do multi-pass shading with the current API.
Emmanuele Bassi [Tue, 13 Apr 2010 15:40:31 +0000 (16:40 +0100)]
effect: Add ShaderEffect
The ShaderEffect class is an abstract base type for shader-based
effects. GLSL-based effects should be implemented by sub-classing
ShaderEffect and overriding ActorMeta::set_actor() to set the source
code of the shader, and Effect::pre_paint() to update the uniform
values, if any.
The ShaderEffect has a generic API for sub-classes to set the values
of the uniforms defined by their shaders, and it uses the shader
types we defined for ClutterShader, to avoid re-inventing the wheel
every time.
Emmanuele Bassi [Mon, 17 May 2010 10:39:27 +0000 (11:39 +0100)]
effect: Add OffscreenEffect
The OffscreenEffect class is meant to be used to implement Effect
sub-classes that create an offscreen framebuffer and redirect the
actor's paint sequence there. The OffscreenEffect is useful for
effects using fragment shaders.
Any shader-based effect being applied to an actor through an offscreen
buffer should be used before painting the resulting target material and
not for every actor. This means that doing:
pre_paint: cogl_program_use(program)
set up offscreen buffer
paint: [ actors ] → offscreen buffer → target material
post_paint: paint target material
cogl_program_use(null)
Is not correct. Unfortunately, we cannot really do:
post_paint: cogl_program_use(program)
paint target material
cogl_program_use(null)
Because the OffscreenEffect::post_paint() implementation also pops the
offscreen buffer and re-instates the previous framebuffer:
post_paint: cogl_program_use(program)
change frame buffer ← ouch!
paint target material
cogl_program_use(null)
One way to fix it is to allow using the shader right before painting
the target material - which means adding a new virtual inside the
OffscreenEffect class vtable in additions to the ones defined by the
parent Effect class.
The newly-added paint_target() virtual allows the correct sequence of
actions by adding an entry point for sub-classes to wrap the "paint
target material" operation with custom code, in order to implement the
case above correctly as:
post_paint: change frame buffer
cogl_program_use(program)
paint target material
cogl_program_use(null)
The added upside is that sub-classes of OffscreenEffect involving
shaders really just need to override the prepare() and paint_target()
virtuals, since the pre_paint() and post_paint() do all that's needed.