Damien Lespiau [Thu, 14 Oct 2010 15:37:25 +0000 (16:37 +0100)]
gitignore: Update the path of generated GLES2 shaders
The generation is not happening in the main Cogl directory, Update the
.gitignore file accordingly.
Robert Bragg [Mon, 1 Nov 2010 22:07:11 +0000 (22:07 +0000)]
matrix-stack: use GArray instead of GSList for stack
In some micro-benchmarks testing journal throughput the list
manipulation jumps pretty high in the profile. This replaces the GSList
usage with a GArray instead which is effectively a grow only allocation
that means we avoid ongoing allocations while manipulating the stack
mid-scene.
Robert Bragg [Mon, 1 Nov 2010 20:33:20 +0000 (20:33 +0000)]
pipeline: Avoid costly checking of lighting properties
During _cogl_pipeline_needs_blending_enabled we were always checking the
current lighting properties (ambient,diffuse,specular,emission) which
had a notable impact during micro-benchmarks that exercise journal
throughput of simple colored rectangles. This #if 0's the offending code
considering that Cogl doesn't actually support lighting currently and
when it actually does then we will be able to optimize this by avoiding
the checks when lighting is disabled.
Robert Bragg [Mon, 1 Nov 2010 20:27:32 +0000 (20:27 +0000)]
cogl: add separate material for blended source_colors
When using cogl_set_source_color4ub there is a notable difference
between colors that require blending and those that dont. When trying to
modify the color of pipeline referenced by the journal we don't force a
flush of the journal unless the color change will also change the
blending state. By using two separate pipeline objects for handing
opaque or transparent colors we can avoid ever flushing the journal when
repeatedly using cogl_set_source_color and jumping between opaque and
transparent colors.
Robert Bragg [Mon, 1 Nov 2010 18:55:48 +0000 (18:55 +0000)]
texture_quad_multiple_primitives: rework wrap mode overrides
This reworks _cogl_texture_quad_multiple_primitives so instead of using
the CoglPipelineWrapModeOverrides mechanism to force the clamp to edge
repeat mode we now derive an override pipeline using cogl_pipeline_copy
instead. This avoids a relatively large, unconditional, memset.
Robert Bragg [Mon, 1 Nov 2010 18:33:17 +0000 (18:33 +0000)]
_multitexture_quad_single_primitive: avoid wrap overrides
This avoids using the wrap mode overrides mechanism to implement
_cogl_multitexture_quad_single_primitive which requires memsetting a
fairly large array. This updates it to use cogl_pipeline_foreach_layer()
and we now derive an override_material to handle changes to the wrap
modes instead of using the CoglPipelineWrapModeOverrides.
Neil Roberts [Wed, 3 Nov 2010 16:02:27 +0000 (16:02 +0000)]
cogl-path: Don't bother filling the path if less than 3 nodes
Previously there was a check to avoid filling the path if there are
zero nodes. However the tesselator also won't generate any triangles
if there are less than 3 nodes so we might as well bail out in that
case too. If we don't emit any triangles then we would end up trying
to create an empty VBO. Although I don't think this should necessarily
be a problem, this seems to cause Mesa to segfault in version 7.8.1
when calling glBufferSubData (although not in
master). test-cogl-primitives tries to fill a path with only two
points so it's convenient to be able to avoid the crash in this case.
Neil Roberts [Tue, 2 Nov 2010 17:35:17 +0000 (17:35 +0000)]
cogl-journal: Log the clip state in the journal
When adding a new entry to the journal a reference is now taken on the
current clip stack. Modifying the current clip state no longer causes
a journal flush. The journal flushing code now has an extra stage to
compare the clip state of each entry. The comparison can simply be
done by comparing the pointers. Although different clip states will
still end up with multiple draw calls this at leasts allows a scene
comprising of multiple different clips to be upload with one vbo. It
also lays the groundwork to do certain tricks when drawing clipped
rectangles such as modifying the geometry instead of setting a clip
state.
Neil Roberts [Tue, 2 Nov 2010 17:34:51 +0000 (17:34 +0000)]
cogl-framebuffer: Add a flag to skip flushing the clip state
This adds a flag to avoid flushing the clip state when flushing the
framebuffer state. This will be used by the journal to manage its own
clip state flushing.
Neil Roberts [Tue, 2 Nov 2010 17:15:06 +0000 (17:15 +0000)]
cogl: Don't flush the journal when flushing clip state
Flushing the clip state no longer does anything that would cause the
journal to flush. The clip state is only flushed when flushing the
framebuffer state and in all cases this ends up flushing the journal
in one way or another anyway. Avoiding flushing the journal will make
it easier to log the clip state in the journal.
Previously when trying to set up a rectangle clip that can't be
scissored or when using a path clip the code would use cogl_rectangle
as part of the process to fill the stencil buffer. This is now changed
to use a new internal _cogl_rectangle_immediate function which
directly uses the vertex array API to draw a triangle strip without
affecting the journal. This should be just as efficient as the
previous journalled code because these places would end up flushing
the journal immediately before and after submitting the single
rectangle anyway and flushing the journal always creates a new vbo so
it would effectively do the same thing.
Similarly there is also a new internal _cogl_clear function that does
not flush the journal.
Neil Roberts [Wed, 3 Nov 2010 15:48:56 +0000 (15:48 +0000)]
cogl-path: Use the vertex array API instead of CoglVertexBuffer
The new vertex array is now implemented in terms of the
CoglVertexBuffer anyway so it should be slightly faster to use a
vertex array directly.
Neil Roberts [Tue, 2 Nov 2010 14:28:12 +0000 (14:28 +0000)]
cogl: Move the clip stack dirtiness to the context rather than the FB
Previously we tracked whether the clip stack needs flushing as part of
the CoglClipState which is part of the CoglFramebuffer state. This is
a bit odd because most of the clipping state (such as the clip planes
and the scissor) are part of the GL context's state rather than the
framebuffer. We were marking the clip state on the framebuffer dirty
every time we change the framebuffer anyway so it seems to make more
sense to have the dirtiness be part of the global context.
Instead of a just a single boolean to record whether the state needs
flushing, the CoglContext now holds a reference to the clip stack that
was flushed. That way we can flush arbitrary stack states and if it
happens to be the same as the state already flushed then Cogl will do
nothing. This will be useful if we log the clip stack in the journal
because then we will need to flush unrelated clip stack states for
each batch.
Neil Roberts [Mon, 1 Nov 2010 19:52:45 +0000 (19:52 +0000)]
cogl-clip-stack: Don't allocate a separate struct for CoglClipStack
Instead of having a separate CoglHandle for CoglClipStack the code is
now expected to directly hold a pointer to the top entry on the
stack. The empty stack is then the NULL pointer. This saves an
allocation when we want to copy the stack because we can just take a
reference on a stack entry. The idea is that this will make it
possible to store the clip stack in the journal without any extra
allocations.
The _cogl_get_clip_stack and set functions now take a CoglClipStack
pointer instead of a handle so it would no longer make sense to make
them public. However I think the only reason we would have wanted that
in the first place would be to save the clip state between switching
FBOs and that is no longer necessary.
Neil Roberts [Wed, 3 Nov 2010 13:34:21 +0000 (13:34 +0000)]
cogl: Don't flush the framebuffer state for the internal draw
CoglVertexAttribute has an internal draw function that is used by the
CoglJournal to avoid the call to cogl_journal_flush which would
otherwise end up recursively flushing the journal forever. The
enable_gl_state function called by this was previously also calling
_cogl_flush_framebuffer_state. However the journal code tries to
handle this function specially by calling it with a flag to disable
flushing the modelview matrix. This is useful because the journal
handles flushing the modelview itself. Without this patch the journal
state ends up getting flushed twice. This isn't a particularly big
problem currently because the matrix stack has caching to recognise
when it would push the same state twice and bails out. However if we
later want to use the framebuffer flush flags to override a particular
state of the framebuffer (such as the clip state) then we need to make
sure the flush isn't called twice.
Neil Roberts [Thu, 4 Nov 2010 16:01:23 +0000 (16:01 +0000)]
cogl-buffer: Use void* instead of guint8* for map and set_data
Unless the CoglBuffer is being used for texture data then it's
relatively unlikely that the data will contain an array of bytes. For
example if it's used as a vertex array then it's more likely to be
floats or some vertex struct. In that case it's much more convenient
if set_data and map use void* pointers so that we can avoid a cast.
Neil Roberts [Thu, 4 Nov 2010 17:31:59 +0000 (17:31 +0000)]
Add a conformance test for the CoglPrimitive convenience constructors
This adds a simple conformance test which calls all of the convenience
constructors for CoglPrimitive.
Neil Roberts [Thu, 4 Nov 2010 17:21:56 +0000 (17:21 +0000)]
cogl-primitive: Fix the texture attribute offsets
The offsets for the texture coordinate attributes in the convenience
constructors were all wrong.
Neil Roberts [Thu, 4 Nov 2010 16:54:20 +0000 (16:54 +0000)]
cogl-primitive: Fix a typo in new_with_attributes_array
A typo in the g_return_val_if_fail was causing it to segfault.
Neil Roberts [Thu, 4 Nov 2010 16:42:11 +0000 (16:42 +0000)]
cogl-primitive: Add the missing cogl_primitive_new_p2 function
There was a struct defined for CoglP2Vertex but there was no
constructor function to use it.
Neil Roberts [Thu, 4 Nov 2010 16:13:01 +0000 (16:13 +0000)]
cogl-primitive: Fix the ref-counting for the convenience constuctors
The convenience constructors for the builtin vertex structs were
creating the primitive and then immediately destroying it and
returning the pointer. I think the intention was to unref the
attributes instead. This adds an internal wrapper around the
new_with_attributes_array constructor which unrefs the attributes
instead of the primitive. The convenience constructors now use that.
Robert Bragg [Thu, 4 Nov 2010 13:23:23 +0000 (13:23 +0000)]
primitive: fix prototypes and start adding docs
This fixes the prototypes for the cogl_primitive_new_xyz functions and
also adds documentation with examples for each one.
Neil Roberts [Thu, 4 Nov 2010 14:56:44 +0000 (14:56 +0000)]
cogl-gles2-wrapper: Fix a reference to the old name for CoglPipeline
The GLES2 wrapper was referring to COGL_MATERIAL_PROGRAM_TYPE_GLSL but
this has since been renamed to COGL_PIPELINE_PROGRAM_TYPE_GLSL so the
GLES2 backend wouldn't compile.
Robert Bragg [Fri, 29 Oct 2010 14:49:25 +0000 (15:49 +0100)]
gles2: disable vbos until while we rework backend
The gles2 wrapper functions don't understand about the CoglBuffer API so
they don't support attributes stored in a CoglVertexArray. Instead of
teaching the backend about buffers we are going to wait until we have
overhauled the GLES 2 backend. We are currently making progress
consolidating the GLES 2 backend with a new GLSL backend for
CoglMaterial. This will hugely simplify the GLES 2 support and share
code with the OpenGL backend. In the end it's hoped that this problem
will simply go away so it doesn't make much sense to solve it with the
current design.
Robert Bragg [Wed, 27 Oct 2010 17:54:57 +0000 (18:54 +0100)]
cogl: rename CoglMaterial -> CoglPipeline
This applies an API naming change that's been deliberated over for a
while now which is to rename CoglMaterial to CoglPipeline.
For now the new pipeline API is marked as experimental and public
headers continue to talk about materials not pipelines. The CoglMaterial
API is now maintained in terms of the cogl_pipeline API internally.
Currently this API is targeting Cogl 2.0 so we will have time to
integrate it properly with other upcoming Cogl 2.0 work.
The basic reasons for the rename are:
- That the term "material" implies to many people that they are
constrained to fragment processing; perhaps as some kind of high-level
texture abstraction.
- In Clutter they get exposed by ClutterTexture actors which may be
re-inforcing this misconception.
- When comparing how other frameworks use the term material, a material
sometimes describes a multi-pass fragment processing technique which
isn't the case in Cogl.
- In code, "CoglPipeline" will hopefully be a much more self documenting
summary of what these objects represent; a full GPU pipeline
configuration including, for example, vertex processing, fragment
processing and blending.
- When considering the API documentation story, at some point we need a
document introducing developers to how the "GPU pipeline" works so it
should become intuitive that CoglPipeline maps back to that
description of the GPU pipeline.
- This is consistent in terminology and concept to OpenGL 4's new
pipeline object which is a container for program objects.
Note: The cogl-material.[ch] files have been renamed to
cogl-material-compat.[ch] because otherwise git doesn't seem to treat
the change as a moving the old cogl-material.c->cogl-pipeline.c and so
we loose all our git-blame history.
Robert Bragg [Wed, 27 Oct 2010 11:43:36 +0000 (12:43 +0100)]
pango: Use CoglMaterial type for materials
Instead of using the CoglHandle type for material variables this updates
the pango code to use CoglMaterial * instead. CoglHandle is the old
typename which is being phased out of the API.
Robert Bragg [Wed, 27 Oct 2010 11:36:24 +0000 (12:36 +0100)]
pango: push/pop source instead of trashing users source
The pango-display-list code was calling cogl_set_source in numerous
places and it didn't appear to be saving the users source to restore
later. This could result in the user inadvertantly drawing a primitive
with one of these internally managed materials instead of one that they
chose. To rectify this the code now uses cogl_{push,pop}_source to save
and restore the users source.
Robert Bragg [Mon, 18 Oct 2010 16:17:22 +0000 (17:17 +0100)]
primitives: implements cogl_polygon on vertex_attributes
This updates the implementation of cogl_polygon so it sits on the new
CoglVertexArray and CoglVertexAttribute apis. This lets us minimize the
number of different drawing paths we have to maintain in Cogl.
Since the sliced texture support for cogl_polygon has been broken for a
long time now and no one has complained this patch also greatly
simplifies the code by not doing any special material validation so
cogl_polygon will be restricted in the same way as
cogl_draw_vertex_attributes. (i.e. sliced textures not supported).
Robert Bragg [Tue, 26 Oct 2010 18:22:57 +0000 (19:22 +0100)]
journal: port to the vertex_attributes API
Instead of using raw OpenGL in the journal we now use the vertex
attributes API instead. This is part of an ongoing effort to reduce the
number of drawing paths we maintain in Cogl.
Robert Bragg [Tue, 26 Oct 2010 17:56:57 +0000 (18:56 +0100)]
vertex-buffer: use cogl_get_rectangle_indices
The functionality of cogl_vertex_buffer_indices_get_for_quads is now
provided by cogl_get_rectangle_indices so this reworks the former to now
work in terms of the latter so we don't have duplicated logic.
Robert Bragg [Tue, 12 Oct 2010 11:55:23 +0000 (12:55 +0100)]
vertex-buffer: port to CoglVertexAttributes + CoglPrimitive
As part of an ongoing effort to reduce the number of draw paths we have
in Cogl this re-works CoglVertexBuffer to use the CoglVertexAttribute
and CoglPrimitive APIs instead of using raw GL.
Robert Bragg [Tue, 26 Oct 2010 17:57:33 +0000 (18:57 +0100)]
primitive: adds immutable ref/unref mechanism
This adds a way to mark that a primitive is in use so that modifications
will generate a warning. The plan is to use this mechanism when batching
primitives in the journal to warn users that mid-scene modifications of
primitives is not allowed.
Robert Bragg [Tue, 12 Oct 2010 14:48:31 +0000 (15:48 +0100)]
primitive: Adds convenience constructors
This adds convenience primitive constructors named like:
cogl_primitive_new_p3 or
cogl_primitive_new_p3c4 or
cogl_primitive_new_p3t2c4
where the letters correspond to the interleved vertex attributes layouts
such as CoglP3Vertex which is a struct with 3 float x,y,z members for
the [p]osition, or CoglP3T2C4Vertex which is a struct with 3 float x,y,z
members for the [p]osition, 2 float s,t members for the [t]exture
coordinates and 4 unsigned byte r,g,b,a members for the [c]olor.
The hope is that people will find these convenient enough to replace
cogl_polygon.
Robert Bragg [Tue, 12 Oct 2010 11:54:07 +0000 (12:54 +0100)]
cogl: Adds experimental CoglPrimitive API
A CoglPrimitive is a retainable object for drawing a single primitive,
such as a triangle strip, fan or list.
CoglPrimitives build on CoglVertexAttributes and CoglIndices which
themselves build on CoglVertexArrays and CoglIndexArrays respectively.
A CoglPrimitive encapsulates enough information such that it can be
retained in a queue (e.g. the Cogl Journal, or renderlists in the
future) and drawn at some later time.
Robert Bragg [Tue, 12 Oct 2010 11:53:10 +0000 (12:53 +0100)]
cogl: Adds experimental CoglVertexAttribute API
A CoglVertexAttribute defines a single attribute contained in a
CoglVertexArray. I.e. a CoglVertexArray is simply a buffer of N bytes
intended for containing a collection of attributes (position, color,
normals etc) and a CoglVertexAttribute defines one such attribute by
specifying its start offset in the array, its type, the number of
components and the stride etc.
Robert Bragg [Tue, 12 Oct 2010 11:48:58 +0000 (12:48 +0100)]
cogl: Adds experimental CoglIndices API
CoglIndices define a range of indices inside a CoglIndexArray. I.e. a
CoglIndexArray is simply a buffer of N bytes and you can then
instantiate multiple CoglIndices collections that define a sub-region of
a CoglIndexArray by specifying a start offset and an index data type.
Robert Bragg [Tue, 12 Oct 2010 11:34:27 +0000 (12:34 +0100)]
cogl: Adds experimental CoglVertexArray type
This adds a new CoglVertexArray object which is a subclass of CoglBuffer
used to hold vertex attributes. A later commit will add a
CoglVertexAttribute API which will be used to describe the attributes
inside a CoglVertexArray.
Robert Bragg [Tue, 12 Oct 2010 11:36:22 +0000 (12:36 +0100)]
cogl: Adds experimental CoglIndexArray type
A CoglIndexArray is a subclass of CoglBuffer and will be used to hold
vertex indices. A later commit will add a CoglIndices API which will
allow describing a range of indices inside a CoglIndexArray.
Robert Bragg [Tue, 26 Oct 2010 18:08:51 +0000 (19:08 +0100)]
buffer: adds immutable ref/unref mechanism
This adds an internal mechanism to mark that a buffer is in-use so that
a warning can be generated if the user attempts to modify the buffer.
The plans is for the journal to use this mechanism so that we can warn
users about mid-scene modifications of buffers.
Robert Bragg [Tue, 12 Oct 2010 12:14:17 +0000 (13:14 +0100)]
buffer: make _bind() return base pointer
We now make _cogl_buffer_bind return a base pointer for the bound buffer
which can be used with OpenGL. The pointer will be NULL for GPU based
buffers or may point to an malloc'd buffer. Since OpenGL expects an
offset instead of a pointer when dealing with buffer objects this means
we can handle fallback malloc buffers and GPU buffers in a consistent
way.
Robert Bragg [Tue, 26 Oct 2010 18:02:04 +0000 (19:02 +0100)]
material: Bail out faster if re-flushing unchanged material
This allows _cogl_material_flush_gl_state to bail out faster if
repeatedly asked to flush the same material and we can see the material
hasn't changed.
Since we can rely on the material age incrementing when any material
property changes or any associated layer property changes then we can
track the age of the material after flushing so it can be compared with
the age of the material if it is subsequently re-flushed. If the age is
the same we only have to re-assert the texture object state.
Robert Bragg [Tue, 26 Oct 2010 16:43:16 +0000 (17:43 +0100)]
material-node: track if node owns reference on parent
MaterialNodes are used for the sparse graph of material state and layer
state. In the case of materials there is the idea of weak materials that
don't take a reference on their parent and in that case we need to be
careful not to unref our parent during
_cogl_material_node_unparent_real. This adds a has_parent_reference
member to the CoglMaterialNode struct so we now know when to skip the
unref.
Robert Bragg [Tue, 26 Oct 2010 16:38:58 +0000 (17:38 +0100)]
cogl-object: correctly free user_data_array in _unref
If there is private data associated with a CoglObject then there may be
a user_data_array that needs to be freed. The code was mistakenly
freeing the array inside the loop that was actually iterating over the
user data array notifying the objects destruction instead of waiting
until all the data entries had been destroyed.
Owen W. Taylor [Sat, 30 Oct 2010 22:11:03 +0000 (18:11 -0400)]
Don't leave stale invalidated queued redraws around
Once an actor had _clutter_stage_queue_redraw_entry_invalidate()
called on it once, then priv->queue_redraw_entry would point to
an entry with entry->actor NULL. _clutter_stage_queue_actor_redraw()
doesn't handle this case and no further redraws would be queued.
To fix this, NULL out priv->queue_redraw_entry() and then make sure
we free the invalidated entry in
_clutter_stage_maybe_finish_queue_redraws() just as we do for
still valid entries.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2389
Neil Roberts [Mon, 1 Nov 2010 15:21:04 +0000 (15:21 +0000)]
win32: Fix a couple of build warnings
* clutter-backend-win32 had an unused variable
* clutter-event-win32 was using the abs function without including
stdlib.h
Neil Roberts [Mon, 1 Nov 2010 15:13:12 +0000 (15:13 +0000)]
clutter-backend-win32: Use g_object_unref on the stage manager
Previously when trying to destroy all of the stages in the backend
dispose function it would poke directly in the ClutterStageManager
struct to get the list. In
8613013ab08 the defintion of
ClutterStageManager moved to a different header which isn't included
by the Win32 backend so it wouldn't compile. In that commit the X11
backend was changed to unref the stage manager instead of poking in
the internals so we should do the same for the win32 backend.
Damien Lespiau [Sun, 31 Oct 2010 18:34:23 +0000 (18:34 +0000)]
clone: Remove checks in set_source_internal()
One of the ideas behind _internal() functions is to be able to have a
version of the original one without checks (among other things). As
these functions are either static or private to the library, we control
the arguments given to it, and thus no need for checking them again
here.
Damien Lespiau [Sun, 31 Oct 2010 16:49:40 +0000 (16:49 +0000)]
texture: Warn when the file loaded from a ClutterScript can't be found
Telling the user about files not found when loading a ClutterScript with
ClutterTextures in it is very useful and can save a few minutes (or
hours) of frustation because it "does not work".
Neil Roberts [Fri, 15 Oct 2010 17:00:29 +0000 (18:00 +0100)]
Merge cogl-program-{gl,gles}.c into one cogl-program.c
This merges the two implementations of CoglProgram for the GLES2 and
GL backends into one. The implementation is more like the GLES2
version which would track the uniform values and delay sending them to
GL. CoglProgram is now effectively just a GList of CoglShaders along
with an array of stored uniform values. CoglProgram never actually
creates a GL program, instead this is left up to the GLSL material
backend. This is necessary on GLES2 where we may need to relink the
user's program with different generated shaders depending on the other
emulated fixed function state. It will also be necessary in the future
GLSL backends for regular OpenGL. The GLSL and ARBfp material backends
are now the ones that create and link the GL program from the list of
shaders. The linked program is attached to the private material state
so that it can be reused if the CoglProgram is used again with the
same material. This does mean the program will get relinked if the
shader is used with multiple materials. This will be particularly bad
if the legacy cogl_program_use function is used because that
effectively always makes one-shot materials. This problem will
hopefully be alleviated if we make a hash table with a cache of
generated programs. The cogl program would then need to become part of
the hash lookup.
Each CoglProgram now has an age counter which is incremented every
time a shader is added. This is used by the material backends to
detect when we need to create a new GL program for the user program.
The internal _cogl_use_program function now takes a GL program handle
rather than a CoglProgram. It no longer needs any special differences
for GLES2. The GLES2 wrapper function now also uses this function to
bind its generated shaders.
The ARBfp shaders no longer store a copy of the program source but
instead just directly create a program object when cogl_shader_source
is called. This avoids having to reupload the source if the same
shader is used in multiple materials.
There are currently a few gross hacks to get the GLES2 backend to work
with this. The problem is that the GLSL material backend is now
generating a complete GL program but the GLES2 wrapper still needs to
add its fixed function emulation shaders if the program doesn't
provide either a vertex or fragment shader. There is a new function in
the GLES2 wrapper called _cogl_gles2_use_program which replaces the
previous cogl_program_use implementation. It extracts the GL shaders
from the GL program object and creates a new GL program containing all
of the shaders plus its fixed function emulation. This new program is
returned to the GLSL material backend so that it can still flush the
custom uniforms using it. The user_program is attached to the GLES2
settings struct as before but its stored using a GL program handle
rather than a CoglProgram pointer. This hack will go away once the
GLSL material backend replaces the GLES2 wrapper by generating the
code itself.
Under Mesa this currently generates some GL errors when glClear is
called in test-cogl-shader-glsl. I think this is due to a bug in Mesa
however. When the user program on the material is changed the GLSL
backend gets notified and deletes the GL program that it linked from
the user shaders. The program will still be bound in GL
however. Leaving a deleted shader bound exposes a bug in Mesa's
glClear implementation. More details are here:
https://bugs.freedesktop.org/show_bug.cgi?id=31194
Neil Roberts [Wed, 27 Oct 2010 14:07:03 +0000 (15:07 +0100)]
cogl: Use separate materials for set_source_color and texture
Previously cogl_set_source_color and cogl_set_source_texture modified
a single global material. If an application then mixes using
cogl_set_source_color and texture then the material will constantly
need a new ARBfp program because the numbers of layers alternates
between 0 and 1. This patch just adds a second global material that is
only used for cogl_set_source_texture. I think it would still end up
flushing the journal if cogl_set_source_texture is used with multiple
different textures but at least it should avoid a recompile unless the
texture target also changes. It might be nice to somehow attach a
material to the CoglTexture for use with cogl_set_source_texture but
it would be difficult to implement this without creating a circular
reference.
Robert Bragg [Tue, 12 Oct 2010 11:53:44 +0000 (12:53 +0100)]
Move IndicesType and VerticesMode typedefs to cogl-types.h
This moves the CoglIndicesType and CoglVerticesMode typedefs from
cogl-vertex-buffer.h to cogl-types.h so they can be shared with the
anticipated cogl vertex attribute API.
Robert Bragg [Tue, 26 Oct 2010 15:05:00 +0000 (16:05 +0100)]
buffer: BufferBindTarget + BufferUsageHint enum renaming
This renames the BufferBindTarget + BufferUsageHint enums to match the
anticipated new APIs for "index arrays" and "vertex arrays" as opposed
to using the terms "vertices" or "indices".
Robert Bragg [Mon, 18 Oct 2010 17:50:02 +0000 (18:50 +0100)]
buffer: warn if (offset + size) > buffer->size
previously we would silently bail out if the given offset + data size
would overflow the buffer size. Now we use g_return_val_if_fail so we
get a warning if we hit this case.
Robert Bragg [Tue, 12 Oct 2010 12:25:05 +0000 (13:25 +0100)]
pixel-array: Remove some benign variables
There were some completely unused static global variables declared in
cogl-pixel-array.c which this patch removes.
Robert Bragg [Tue, 12 Oct 2010 12:23:44 +0000 (13:23 +0100)]
pixel-array: Remove flags member and flag macros
There are no flags associated with pixel-arrays so we don't need the
flags member or flag macros.
Robert Bragg [Tue, 26 Oct 2010 15:06:46 +0000 (16:06 +0100)]
buffer: Add a store_created bit field member
This adds a store_created bit field to CoglBuffer so we know if the
underlying buffer has been allocated yet. Previously the code was trying
to do something really wrong by accidentally using the
COGL_PIXEL_ARRAY_FLAG_IS_SET macro (note "PIXEL_ARRAY") and what is more
odd was the declaration of a CoglPixelArray *pixel_array in
cogl-buffer.c which the buffer was being cast too before calling using
the macro. Probably this was the fall-out of some previous code
re-factoring.
Robert Bragg [Tue, 12 Oct 2010 10:46:29 +0000 (11:46 +0100)]
buffer: remove flag macros
All the macros get used for are to |= (a new flag bit), &= ~(a flag bit)
or use the & operator to test if a flag bit is set. I haven't found the
code more readable with these macros, but several times now I've felt
the need to double check if these macros do anything else behind the
hood or I've forgotten what flags are available so I've had to go to the
macro definition to see what the full enum names are for the flags (the
macros use symbol concatenation) so I can search for the definition of
all the flags. It turns out they are defined next to the macro so you
don't have to search far, but without the macro that wouldn't have been
necessary.
The more common use of the _IS_SET macro is actually more concise
expanded and imho since it doesn't hide anything in a separate header
file the code is more readable without the macro.
Robert Bragg [Tue, 12 Oct 2010 11:35:47 +0000 (12:35 +0100)]
material: Adds _cogl_material_get_layer_texture
This is a counter part for _cogl_material_layer_get_texture which takes
a layer index instead of a direct CoglMaterialLayer pointer. The aim is
to phase out code that directly iterates the internal layer pointers of
a material since the layer pointers can change if any property of any
layer is changed making direct layer pointers very fragile.
Robert Bragg [Mon, 18 Oct 2010 18:00:50 +0000 (19:00 +0100)]
material: add internal layer filter getters
This adds internal _cogl_material_get_layer_filters and
_cogl_material_get_layer_{min,mag}_filter functions which can be used to
query the filters associated with a layer using a layer_index, as
opposed to a layer pointer. Accessing layer pointers is considered
deprecated so we need to provide layer_index based replacements.
Robert Bragg [Sun, 1 Aug 2010 22:05:28 +0000 (23:05 +0100)]
material: Adds missing get_layer_wrap_mode_xyz prototypes
This adds missing getter function prototypes for
cogl_material_get_layer_wrap_mode_{s,t,p}
Robert Bragg [Sun, 1 Aug 2010 15:07:38 +0000 (16:07 +0100)]
vertex-buffer: remove the unstrided CBO type
When we come to submitting the users given attributes we sort them into
different types of buffers. Previously we had three types; strided,
unstrided and multi-pack. Really though unstrided was just a limited
form of multi-pack buffer and didn't imply any hind of special
optimization so this patch consolidates some code by reducing to just
two types; strided and multi-pack.
Robert Bragg [Wed, 28 Jul 2010 12:59:34 +0000 (13:59 +0100)]
material: Adds _cogl_material_pre_paint_for_layer
This is a counter part for _cogl_material_layer_pre_paint which takes a
layer index instead of a direct CoglMaterialLayer pointer. The aim is to
phase out code that directly iterates the internal layer pointers of a
material since the layer pointers can change if any property of any
layer is changed making direct layer pointers very fragile.
Robert Bragg [Mon, 25 Oct 2010 12:25:21 +0000 (13:25 +0100)]
cogl: Adds {push,pop,get}_source functions
This exposes the idea of a stack of source materials instead of just
having a single current material. This allows the writing of orthogonal
code that can change the current source material and restore it to its
previous state. It also allows the implementation of new composite
primitives that may want to validate the current source material and
possibly make override changes in a derived material.
Emmanuele Bassi [Mon, 25 Oct 2010 22:44:53 +0000 (23:44 +0100)]
Merge branch 'private-cleanup'
* private-cleanup:
Add copyright notices
Clean up clutter-private.h/6
Clean up clutter-private.h/5
Clean up clutter-private.h/4
Clean up clutter-private.h/3
Clean up clutter-private.h/2
Clean up clutter-private.h/1
Emmanuele Bassi [Mon, 25 Oct 2010 16:44:27 +0000 (17:44 +0100)]
Post-release version bump to 1.5.5
Emmanuele Bassi [Mon, 25 Oct 2010 16:30:52 +0000 (17:30 +0100)]
Release Clutter 1.5.4
Chris Lord [Fri, 22 Oct 2010 16:41:06 +0000 (17:41 +0100)]
state: Correct the documentation
Correct the argument order and replace all occurrences of
clutter_state_change() with the appropriate clutter_state_set_state() or
clutter_state_warp_to_state().
Chris Lord [Fri, 22 Oct 2010 15:32:05 +0000 (16:32 +0100)]
state: Fix warping to the current state during transitions
If you warp to a state, it should be immediately set. Check if the
animation is in progress when warping to a state and don't short-circuit
in the already-set check if we're not animating.
Chris Lord [Fri, 22 Oct 2010 15:13:16 +0000 (16:13 +0100)]
state: Handle setting keys for the current target state
Add special behaviour when you set the key of the current target state:
- If the state is transitioning, add/modify the interval so that the new
key transitions from the current time (taking into account pre-delay) to
its target final property
- If the state is set but has already finished animating/was warped to,
set the property immediately
Chris Lord [Fri, 22 Oct 2010 14:24:49 +0000 (15:24 +0100)]
state: Fix crasher when removing the last key of a transitioning state
If ClutterState is in the middle of a transition and you remove all the
keys from the target state, the target state will be destroyed without
stopping the animation/unsetting the target state. This caused an invalid
memory access.
Chris Lord [Thu, 21 Oct 2010 15:51:45 +0000 (16:51 +0100)]
state: Allow setting a NULL state
Allow setting a %NULL state. This has the effect of unsetting the current
state and stopping all animation. This allows you to, for example, start
a state transition, set the state to NULL, alter the state transition
and then resume it again, by just setting it.
Emmanuele Bassi [Mon, 25 Oct 2010 16:16:24 +0000 (17:16 +0100)]
Update NEWS
Emmanuele Bassi [Mon, 25 Oct 2010 16:09:46 +0000 (17:09 +0100)]
Merge branch 'wip/path-constraint'
* wip/path-constraint:
docs: Add PathConstraint
tests: Add a PathConstraint interactive test
Add ClutterPathConstraint
actor-box: Add setters for origin and size
Emmanuele Bassi [Mon, 25 Oct 2010 15:09:40 +0000 (16:09 +0100)]
docs: Add PathConstraint
Emmanuele Bassi [Mon, 25 Oct 2010 14:47:15 +0000 (15:47 +0100)]
tests: Add a PathConstraint interactive test
Emmanuele Bassi [Mon, 25 Oct 2010 14:46:04 +0000 (15:46 +0100)]
Add ClutterPathConstraint
ClutterPathConstraint is a simple Constraint implementation that
modifies the allocation of the Actor to which is has been applied using
a progress value and a ClutterPath.
Emmanuele Bassi [Mon, 25 Oct 2010 14:45:35 +0000 (15:45 +0100)]
actor-box: Add setters for origin and size
Damien Lespiau [Thu, 14 Oct 2010 15:48:00 +0000 (11:48 -0400)]
eglnative: Fix the type of stage for eglnative
CLUTTER_TYPE_STAGE_EGLNATIVE does not exist any more, use
CUTTER_TYPE_STAGE_EGL instead.
Neil Roberts [Thu, 21 Oct 2010 16:20:44 +0000 (17:20 +0100)]
win32: Fix clutter_win32_disable_event_retrieval
There was previously a flag that gets set when this function was
called but nothing checked it so the function effectively did
nothing. Also the flag was a member of the backend struct but this
can't be used because the function should be called before
clutter_init so the backend is not ready yet. This patch makes the
event disabling work more like the X11 backend and set a global
variable instead.
Ole André Vadla Ravnås [Thu, 14 Oct 2010 13:30:54 +0000 (15:30 +0200)]
win32: Use _clutter_actor_rerealize() like X11 backend does
http://bugzilla.clutter-project.org/show_bug.cgi?id=1654
Neil Roberts [Fri, 27 Aug 2010 14:54:21 +0000 (15:54 +0100)]
win32: Add a public clutter_win32_handle_event function
This function handles a single windows message. The idea is that it
could be used by clutter-gtk to forward on events from a
GdkEventFilter. The function replaces the old message_translate()
function. That function didn't translate the event anymore anyway and
instead it could generate multiple events so
clutter_win32_handle_event seems like a more appropriate name. The
function returns TRUE or FALSE depending on whether the event was
completely handled instead of setting call_window_proc.
Neil Roberts [Thu, 21 Oct 2010 15:27:17 +0000 (16:27 +0100)]
clutter-stage: Set the Cogl framebuffer size after allocating
When handling an allocation on the stage, Clutter uses the oppurtunity
to inform Cogl of the new size of the framebuffer so that it can
handle the viewport correctly. It queries the size of the window
implementation using a backend virtual function. However it was doing
this before letting the backend handle the allocation so on Win32 it
would end up using the previous framebuffer size. This wasn't
affecting the X11 backend because in that case the resizes are
asynchronous so setting the stage size causes one allocation which
ends up sending a window size request. Eventually a ConfigureNotify is
received which causes the size of the stage to be set again and
another allocation is fired meaning the framebuffer size will be set
again this time with the correct size. In Win32 the resizes are
synchronous so we don't have this second allocation.
Neil Roberts [Mon, 25 Oct 2010 12:15:01 +0000 (13:15 +0100)]
cogl-context-winsys: Avoid zero-length arrays
When compiling for non-glx platforms the winsys feature data array
ends up empty. Empty arrays cause problems for MSVC so this patch adds
a stub entry so that the array always has at least one entry.
Based on a patch by Ole André Vadla Ravnås
Neil Roberts [Mon, 25 Oct 2010 12:08:52 +0000 (13:08 +0100)]
Avoid mixing declarations and code
Mixing declarations and code causes problems for MSVC as it is a C99
feature so we should try to avoid it.
Neil Roberts [Mon, 25 Oct 2010 12:07:50 +0000 (13:07 +0100)]
Avoid variable length arrays in clutter-backend-x11
There was an array whose length was define by a static const int
variable. GCC seems to consider this a variable-length array so it
will cause warnings now that -Wvla is enabled. We might as well make
this constant a #define instead to avoid the warning.
Neil Roberts [Mon, 25 Oct 2010 12:03:39 +0000 (13:03 +0100)]
Add -Wdeclaration-after-statement and -Wvla to maintainer CFLAGS
These warnings pick up C99 extensions that are commonly accidentally
used and which cause problems when compiling with MSVC.
Giovanni Campagna [Sun, 24 Oct 2010 12:45:16 +0000 (14:45 +0200)]
Avoid warnings on ClutterClone with a NULL source
clutter_clone_apply_transform should check the source before calling
methods on it, else criticals will be emitted.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2381
Emmanuele Bassi [Mon, 25 Oct 2010 11:31:50 +0000 (12:31 +0100)]
Update NEWS
Ole André Vadla Ravnås [Sat, 9 Oct 2010 21:07:26 +0000 (23:07 +0200)]
binding-pool: Use the correct marshaller
Ole André Vadla Ravnås [Thu, 14 Oct 2010 11:11:46 +0000 (13:11 +0200)]
interval: Remember to chain up to parent in finalize()
Neil Roberts [Mon, 4 Oct 2010 13:34:24 +0000 (14:34 +0100)]
cogl-texture-2d-sliced: Use the other backends for the slices
Instead of directly manipulating GL textures itself,
CoglTexture2DSliced now works in terms of CoglHandles. It creates the
texture slices using cogl_texture_new_with_size which should always
end up creating a CoglTexture2D because the size should fit. This
allows us to avoid replicating some code such as the first pixel
mipmap tracking and it better enforces the separation that each
texture backend is the only place that contains code dealing with each
texture target.
Neil Roberts [Mon, 4 Oct 2010 14:27:38 +0000 (15:27 +0100)]
Support foreign textures in the texture-2d and rectangle backends
This adds two new internal functions to create a foreign texture for
the texture 2d and rectangle backends. cogl_texture_new_from_foreign
will now use one of these backends directly if there is no waste
instead of always using the sliced texture backend.
Damien Lespiau [Fri, 22 Oct 2010 05:52:27 +0000 (06:52 +0100)]
build: Dist cookbook.xsl
cookbook.xsl was not in EXTRA_DIST, so the cookbook was not buildable
with released tarballs.
Emmanuele Bassi [Thu, 21 Oct 2010 12:13:00 +0000 (13:13 +0100)]
Add copyright notices
Emmanuele Bassi [Thu, 21 Oct 2010 11:16:05 +0000 (12:16 +0100)]
Clean up clutter-private.h/6
Move all Actor private API to a separate file.
Emmanuele Bassi [Thu, 21 Oct 2010 10:59:50 +0000 (11:59 +0100)]
Clean up clutter-private.h/5
Move PaintVolume private API to a separate header.
Emmanuele Bassi [Thu, 21 Oct 2010 10:49:37 +0000 (11:49 +0100)]
Clean up clutter-private.h/4
Move the private Backend API to a separate header.
This also allows us to finally move the class vtable and instance
structure to a separate file and plug the visibility hole that left
the Backend class bare for everyone to poke into.
Emmanuele Bassi [Thu, 21 Oct 2010 10:29:09 +0000 (11:29 +0100)]
Clean up clutter-private.h/3
Move Stage private API to a separate header.
Emmanuele Bassi [Thu, 21 Oct 2010 09:59:49 +0000 (10:59 +0100)]
Clean up clutter-private.h/2
Move StageManager private API to a different header.
Emmanuele Bassi [Thu, 21 Oct 2010 09:54:14 +0000 (10:54 +0100)]
Clean up clutter-private.h/1
Move DeviceManager/InputDevice private API to a different header.
Emmanuele Bassi [Wed, 20 Oct 2010 08:42:34 +0000 (09:42 +0100)]
build: Go back to autoreconf
After testing and distchecking, I verified that autoreconf can still be
used to rebuild the autotools setup.
Thanks to Javier Jardón for the second pair of eyes.