profile/ivi/clutter.git
15 years agoAdd debug notes for calls to glViewport()
Emmanuele Bassi [Thu, 25 Jun 2009 13:39:57 +0000 (14:39 +0100)]
Add debug notes for calls to glViewport()

In order to validate the sequence of:

        XResizeWindow
        ConfigureNotify
        glViewport

that should happen on X11 we need to add debug annotations to the
calls to glViewport() done through COGL.

15 years ago[cogl] cache the viewport width and height
Robert Bragg [Wed, 1 Jul 2009 11:57:30 +0000 (12:57 +0100)]
[cogl] cache the viewport width and height

This avoids some calls to glGetFloatv, which have at least proven to be very
in-efficient in mesa at this point in time, since it always updates all derived
state even when it may not relate to the state being requested.

15 years ago[cogl] Ensure well defined semantics for COGL_INVALID_HANDLE material layers
Robert Bragg [Fri, 19 Jun 2009 11:15:12 +0000 (12:15 +0100)]
[cogl] Ensure well defined semantics for COGL_INVALID_HANDLE material layers

Fixes and adds a unit test for creating and drawing using materials with
COGL_INVALID_HANDLE texture layers.

This may be valid if for example the user has set a texture combine string
that only references a constant color.

_cogl_material_flush_layers_gl_state will bind the fallback texture for any
COGL_INVALID_HANDLE layer, later though we could explicitly check when the
current blend mode does't actually reference a texture source in which case
binding the fallback texture is redundant.

This tests drawing using cogl_rectangle, cogl_polygon and
cogl_vertex_buffer_draw.

15 years agoMerge branch 'cogl-journal-batching'
Robert Bragg [Tue, 30 Jun 2009 16:17:30 +0000 (17:17 +0100)]
Merge branch 'cogl-journal-batching'

[cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
[cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Revert "[rectangle] Avoid modifying materials mid scene"
Revert "[actor] Avoid modifying materials mid-scene to improve journal batching"
[cogl-vertex-buffer] Disable unused client tex coord arrays
[cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer
[cogl] flush matrices in _cogl_add_path_to_stencil_buffer
[journal] Don't resize a singlton VBO; create and destroy a VBO each flush
[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer
[pango-display-list] Use the Cogl journal for short runs of text
[material] _cogl_material_equal: catch the simplest case of matching handles
[material] avoid flushing the journal when just changing the color
[cogl journal] Perform software modelview transform on logged quads.
[Cogl journal] use G_UNLIKLEY around runtime debugging conditions
[cogl journal] Adds a --cogl-debug=batching option to trace batching
[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
[cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos
[cogl] Force Cogl to always use the client side matrix stack
[cogl-debug] Adds a "client-side-matrices" Cogl debug option
[cogl-color] Adds a cogl_color_equal() function
[cogl material] optimize logging of material colors in the journal
[rectangle] Avoid modifying materials mid scene
[actor] Avoid modifying materials mid-scene to improve journal batching
[journal] Always pad our vertex data as if at least 2 layers are enabled
[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes

The Cogl journal is a mechanism Cogl uses to batch geometry resulting from
any of the cogl_rectangle* functions before sending it to OpenGL.  This aims
to improve the Cogl journal so that it can reduce the number of state
changes and draw calls we issue to the OpenGL driver and hopfully improve
performance.

Previously each call to any of the cogl_rectangle* functions would imply an
immediate GL draw call, as well as a corresponding modelview change;
material state changes and gl{Vertex,Color,TexCoord}Pointer calls.  Now
though we have tried to open the scope for batching up as much as possible
so we only have to flush the geometry either before calling glXSwapBuffers,
or when we change state that isn't tracked by the journal.

As a basic example, it's now possible for us to batch typical picking
renders into a single draw call for the whole scene.

Some key points about this change:
- We now perform transformations of quads in software (except for long runs of
  text which continue to use VBOs)
    * It might seem surprising at first, but when you consider that so many
      Clutter actors are little more than textured quads and each actor
      typically implies a modelview matrix change; the costs involved in
      setting up the GPU with the new modelview can easily out weigh the cost
      of simply transforming 4 vertices.
- We always use Cogl's own client side matrix API now.
    * We found the performance of querying the OpenGL driver for matrix state
      was often worse than using the client matrix code, and also - discussing
      with Mesa developers - agreed that since khronos has essentially
      deprecated the GL matrix API (by removing it from OpenGL 3 and
      OpenGL-ES 2) it was appropriate to take full responsibility for all our
      matrix manipulation.
- Developers should avoid modifying materials mid-scene.
    * With the exception of material color changes, if you try and modify a
      material that is referenced in the journal we will currently force a
      journal flush. Note: you can assume that re-setting the same value for
      a material property won't require a flush though.
- Several new --cogl-debug options have been added
    * "disable-batching" can be used to identify bugs in the way that the
      journal does its batching; of could this shouldn't ever be needed :-)
    * "disable-vbos" can be used to test the VBO fallback paths where we
      simply use malloc()'d buffers instead.
    * "batching" lets you get an overview of how the journal is batching
      your geometry and may help you identify ways to improve your
      application performance.
    * "journal" lets you trace all the geometry as it gets logged in the
      journal, and all the geometry as its flushed from the journal.
      Obviously an inconsistency can identify a bug, but the numbers may
      help you verify application logic too.
    * "disable-software-transform" as implied will instead use the driver
      /GPU to transform quads by the modelview matrix.
    Although committed separately a --clutter-debug=nop-picking option was
    also added that lets you remove picking from the equation, which can
    sometimes help make problem analysis more deterministic.

15 years ago[cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Robert Bragg [Mon, 29 Jun 2009 21:32:05 +0000 (22:32 +0100)]
[cogl] Improve ability to break out into raw OpenGL via begin/end mechanism

Although we wouldn't recommend developers try and interleve OpenGL drawing
with Cogl drawing - we would prefer patches that improve Cogl to avoid this
if possible - we are providing a simple mechanism that will at least give
developers a fighting chance if they find it necissary.

Note: we aren't helping developers change OpenGL state to modify the
behaviour of Cogl drawing functions - it's unlikley that can ever be
reliably supported - but if they are trying to do something like:

   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   - continue using Cogl to draw

They should surround their blocks of raw OpenGL with cogl_begin_gl() and
cogl_end_gl():

   cogl_begin_gl ();
   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   cogl_end_gl ();
   - continue using Cogl to draw

Again; we aren't supporting code like this:
   - setup some OpenGL state.
   - use Cogl to draw
   - reset modified OpenGL state.
When the internals of Cogl evolves, this is very liable to break.

cogl_begin_gl() will flush all internally batched Cogl primitives, and emit
all internal Cogl state to OpenGL as if it were going to draw something
itself.

The result is that the OpenGL modelview matrix will be setup; the state
corresponding to the current source material will be setup and other world
state such as backface culling, depth and fogging enabledness will be also
be sent to OpenGL.

Note: no special material state is flushed, so if developers want Cogl to setup
a simplified material state it is the their responsibility to set a simple
source material before calling cogl_begin_gl. E.g. by calling
cogl_set_source_color4ub().

Note: It is the developers responsibility to restore any OpenGL state that they
modify to how it was after calling cogl_begin_gl() if they don't do this then
the result of further Cogl calls is undefined.

15 years agoAdds a cogl_flush() to give developers breaking into raw GL a fighting chance
Robert Bragg [Mon, 29 Jun 2009 16:10:34 +0000 (17:10 +0100)]
Adds a cogl_flush() to give developers breaking into raw GL a fighting chance

This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.

As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.

cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives.  It provides no guarantees about
when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals.  For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.

This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.

15 years ago[cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Robert Bragg [Wed, 24 Jun 2009 17:34:06 +0000 (18:34 +0100)]
[cogl-material] Be more carefull about flushing in cogl_material_remove_layer

Previously we would call _cogl_material_pre_change_notify unconditionally, but
now we wait until we really know we are removing a layer before notifying the
change, which will require a journal flush.

Since the convenience functions cogl_set_source_color4ub and
cogl_set_source_texture share a single material, cogl_set_source_color4ub
always calls cogl_material_remove_layer.  Often this is a NOP though and
shouldn't require a journal flush.

This gets performance back to where it was before reverting the per-actor
material commits.

15 years agoRevert "[rectangle] Avoid modifying materials mid scene"
Robert Bragg [Wed, 24 Jun 2009 17:24:58 +0000 (18:24 +0100)]
Revert "[rectangle] Avoid modifying materials mid scene"

This reverts commit 8cf42ea8ac5c05f6b443c453f9c6c2a3cd75acfa.

Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes which
means using cogl_set_source_color4ub is no longer a concern.

15 years agoRevert "[actor] Avoid modifying materials mid-scene to improve journal batching"
Robert Bragg [Wed, 24 Jun 2009 17:20:45 +0000 (18:20 +0100)]
Revert "[actor] Avoid modifying materials mid-scene to improve journal batching"

This reverts commit 85243da382025bd516937c76a61b8381f6e74689.

Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes
which means using cogl_set_source_color4ub is no longer a concern.

15 years ago[cogl-vertex-buffer] Disable unused client tex coord arrays
Robert Bragg [Wed, 24 Jun 2009 17:10:50 +0000 (18:10 +0100)]
[cogl-vertex-buffer] Disable unused client tex coord arrays

Before any cogl vertex buffer drawing we call
enable_state_for_drawing_buffer which sets up the GL state, but we weren't
disabling unsed client texture coord arrays.

15 years ago[cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer
Robert Bragg [Mon, 22 Jun 2009 00:29:39 +0000 (01:29 +0100)]
[cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer

After flushing the journal an unknown number of client side texture arrays
may be left enabled. Disable them all before using glDrawArrays.

15 years ago[cogl] flush matrices in _cogl_add_path_to_stencil_buffer
Robert Bragg [Sun, 21 Jun 2009 23:49:20 +0000 (00:49 +0100)]
[cogl] flush matrices in _cogl_add_path_to_stencil_buffer

Before calling glRectf we need to ensure we flush the modelview and
projection matrices.

15 years ago[journal] Don't resize a singlton VBO; create and destroy a VBO each flush
Robert Bragg [Sun, 21 Jun 2009 23:11:41 +0000 (00:11 +0100)]
[journal] Don't resize a singlton VBO; create and destroy a VBO each flush

This simplifies the vertex data uploading in the journal, and could improve
performance.  Modifying a VBO mid-scene could reqire synchronizing with the
GPU or some form of shadowing/copying to avoid modifying data that the GPU
is currently processing; the buffer was also being marked as GL_STATIC_DRAW
which could have made things worse.

Now we simply create a GL_STATIC_DRAW VBO for each flush and and delete it
when we are finished.

15 years ago[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer
Robert Bragg [Sun, 21 Jun 2009 23:05:02 +0000 (00:05 +0100)]
[cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer

Using cogl_rectangle (and thus the journal) in
_cogl_add_path_to_stencil_buffer means we have to consider all the state
that the journal may change in case it may interfer with the direct GL calls
used.  This has proven to be error prone and in this case the journal is an
unnecissary overhead.  We now simply call glRectf instead of using
cogl_rectangle.

15 years ago[pango-display-list] Use the Cogl journal for short runs of text
Robert Bragg [Wed, 17 Jun 2009 22:35:49 +0000 (23:35 +0100)]
[pango-display-list] Use the Cogl journal for short runs of text

For small runs of text like icon labels, we can get better performance
going through the Cogl journal since text may then be batched together
with other geometry.

For larger runs of text though we still use VBOs since the cost of logging
the quads becomes too expensive, including the software transform which
isn't at all optimized at this point.  VBOs also have the further advantage
of avoiding repeated validation of vertices by the driver and repeated
mapping of data into the GPU so long as the text doesn't change.

Currently the threshold is 100 vertices/25 quads. This number was plucked
out of thin air and should be tuned later.

With this change I see ~180% fps improvment for test-text. (x61s + i965 +
Mesa 7.6-devel)

15 years ago[material] _cogl_material_equal: catch the simplest case of matching handles
Robert Bragg [Wed, 17 Jun 2009 22:31:40 +0000 (23:31 +0100)]
[material] _cogl_material_equal: catch the simplest case of matching handles

We were missing the simplest test of all: are the two CoglHandles equal and
are the flush option flags for each material equal?  This should improve
batching for some common cases.

15 years ago[material] avoid flushing the journal when just changing the color
Robert Bragg [Wed, 17 Jun 2009 22:31:11 +0000 (23:31 +0100)]
[material] avoid flushing the journal when just changing the color

Whenever we modify a material we call _cogl_material_pre_change_notify which
checks to see if the material is referenced by the journal and if so flushes
if before we modify the material.

Since the journal logs material colors directly into a vertex array (to
avoid us repeatedly calling glColor) then we know we never need to flush
the journal when material colors change.

15 years ago[cogl journal] Perform software modelview transform on logged quads.
Robert Bragg [Wed, 17 Jun 2009 00:31:36 +0000 (01:31 +0100)]
[cogl journal] Perform software modelview transform on logged quads.

Since most Clutter actors aren't much more than textured quads; flushing the
journal typically involves lots of 'change modelview; draw quad' sequences.

The amount of overhead involved in uploading a new modelview and queuing
that primitive is huge in comparison to simply transforming 4 vertices by
the current modelview when logging quads.  (Note if your GPU supports HW
vertex transform, then it still does the projective and viewport transforms)

At the same time a --cogl-debug=disable-software-transform option has been
added for comparison and debugging.

This change allows typical pick scenes to be batched into a single draw call
and I'm seeing test-pick run over 200% faster with this.  (i965 + Mesa
7.6-devel)

15 years ago[Cogl journal] use G_UNLIKLEY around runtime debugging conditions
Robert Bragg [Wed, 17 Jun 2009 00:30:24 +0000 (01:30 +0100)]
[Cogl journal] use G_UNLIKLEY around runtime debugging conditions

May as well improve the branch prediction around runtime debugging code.

15 years ago[cogl journal] Adds a --cogl-debug=batching option to trace batching
Robert Bragg [Thu, 11 Jun 2009 10:54:01 +0000 (11:54 +0100)]
[cogl journal] Adds a --cogl-debug=batching option to trace batching

Enabling this option makes Cogl trace how the journal is managing to batch
your rectangles.  The journal staggers how it emmits state to the GL driver
and the batches will normally get smaller for each stage, but ideally you
don't want to be in a situation where Cogl is only able to draw one quad per
modelview change and draw call.

E.g. this is a fairly ideal example:
BATCHING: journal len = 101
BATCHING:  vbo offset batch len = 101
BATCHING:   material batch len = 101
BATCHING:    modelview batch len = 101

This isn't:
BATCHING: journal len = 1
BATCHING:  vbo offset batch len = 1
BATCHING:   material batch len = 1
BATCHING:    modelview batch len = 1
BATCHING: journal len = 1
BATCHING:  vbo offset batch len = 1
BATCHING:   material batch len = 1
BATCHING:    modelview batch len = 1
<repeat>

15 years ago[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
Robert Bragg [Wed, 17 Jun 2009 00:59:28 +0000 (01:59 +0100)]
[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal

When this option is used Cogl will print a trace of all quads that get
logged into the journal, and a trace of quads as they get flushed.

If you are seeing a bug with the geometry being drawn by Cogl this may give
some clues by letting you sanity check the numbers being logged vs the
numbers being emitted.

15 years ago[cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos
Robert Bragg [Wed, 17 Jun 2009 00:46:06 +0000 (01:46 +0100)]
[cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos

For testing the VBO fallback paths it helps to be able to disable the
COGL_FEATURE_VBOS feature flag.  When VBOs aren't available Cogl should use
client side malloc()'d buffers instead.

15 years ago[cogl] Force Cogl to always use the client side matrix stack
Robert Bragg [Wed, 17 Jun 2009 00:37:39 +0000 (01:37 +0100)]
[cogl] Force Cogl to always use the client side matrix stack

Previously we only used the Cogl matrix stack API for indirect contexts, but
it's too costly to keep on requesting modelview matrices from GL (for
logging in the journal) even for direct rendering.

I also experimented with a patch for mesa to improve performance and
discussed this with upstream, but we agreed to consider the GL matrix API
essentially deprecated.  (For reference the GLES 2 and GL 3 specs have
removed the matrix APIs)

15 years ago[cogl-debug] Adds a "client-side-matrices" Cogl debug option
Robert Bragg [Fri, 5 Jun 2009 12:50:00 +0000 (13:50 +0100)]
[cogl-debug] Adds a "client-side-matrices" Cogl debug option

This allows us to force Cogl to use the client side matrix stack even when
direct rendering.

15 years ago[cogl-color] Adds a cogl_color_equal() function
Robert Bragg [Fri, 5 Jun 2009 11:58:31 +0000 (12:58 +0100)]
[cogl-color] Adds a cogl_color_equal() function

CoglColors shouldn't be compared using memcmp since they may contain
uninitialized padding bytes.

The prototype is also suitable for passing to g_hash_table_new as the
key_equal_func.

_cogl_pango_display_list_add_texture now uses this instead of memcmp.

15 years ago[cogl material] optimize logging of material colors in the journal
Robert Bragg [Thu, 4 Jun 2009 13:23:16 +0000 (14:23 +0100)]
[cogl material] optimize logging of material colors in the journal

We now put the color of materials into the vertex array used by the journal
instead of calling glColor() but the number of requests for the material
color were quite expensive so we have changed the material color to
internally be byte components instead of floats to avoid repeat conversions
and added _cogl_material_get_colorubv as a fast-path for the journal to
copy data into the vertex array.

15 years ago[rectangle] Avoid modifying materials mid scene
Robert Bragg [Fri, 5 Jun 2009 12:03:14 +0000 (13:03 +0100)]
[rectangle] Avoid modifying materials mid scene

To improve batching of geometry in the Cogl journal we need to avoid modifying
materials midscene.

Currently cogl_set_source_color and cogl_set_source_texture simply modify a
single shared material. In the future we can improve this so they use a pool
of materials that gets recycled as the journal is flushed, but for now we
give all ClutterRectangles their own private materials for painting with.

15 years ago[actor] Avoid modifying materials mid-scene to improve journal batching
Robert Bragg [Wed, 17 Jun 2009 17:36:27 +0000 (18:36 +0100)]
[actor] Avoid modifying materials mid-scene to improve journal batching

Currently cogl_set_source_color uses a single shared material which means
each actor that uses it causes the journal to flush if the color changes.
Until we improve cogl_set_source_color to use a pool of materials that can
be recycled as the journal is flushed we avoid mid-scene material changes by
giving all actors a private material instead.

15 years ago[journal] Always pad our vertex data as if at least 2 layers are enabled
Robert Bragg [Wed, 10 Jun 2009 12:59:45 +0000 (13:59 +0100)]
[journal] Always pad our vertex data as if at least 2 layers are enabled

The number of material layers enabled when logging a quad in the journal
determines the stride of the corresponding vertex data (since we need a set
of texture coordinates for each layer.) By padding data in the case where we
have only one layer we can avoid a change in stride if we are mixing single
and double layer primitives in a scene (e.g.  relevent for a composite
manager that may use 2 layers for all shaped windows) Avoiding stride
changes means we can minimize calls to gl{Vertex,Color}Pointer when flushing
the journal.

Since we need to update the texcoord pointers when the actual number of
layers changes, this adds another batch_and_call() stage to deal with
glTexCoordPointer and enabling/disabling the client arrays.

15 years ago[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Robert Bragg [Wed, 17 Jun 2009 17:46:42 +0000 (18:46 +0100)]
[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes

Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e.  the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry.  In ideal circumstances we will only flush once per scene.

In summary the journal works like this:

When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal.  A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix.  Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:

- modifying materials mid-scene
    This is because each quad in the journal has an associated material
    reference (i.e. not copy), so if you try and modify a material that is
    already referenced in the journal we force a flush first)

    NOTE: For now this means you should avoid using cogl_set_source_color()
      since that currently uses a single shared material. Later we
  should change it to use a pool of materials that is recycled
  when the journal is flushed.

- modifying any state that isn't currently logged, such as depth, fog and
  backface culling enables.

The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.

We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together.  This is
currently broken up into 3 levels so we can stagger the state changes:

1) we break the journal up according to changes in the number of material layers
   associated with logged quads. The number of layers in a material determines
   the stride of the associated vertices, so we have to update our vertex
   array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
   materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
   we update the modelview matrix and actually emit the actual draw command.

This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.

15 years ago[texture] fix load-async and load-data-async properties.
Øyvind Kolås [Tue, 30 Jun 2009 15:48:53 +0000 (16:48 +0100)]
[texture] fix load-async and load-data-async properties.

Removed the G_PARAM_CONSTRUCT from the property registration of
"load-async" and "load-data-async". It made it impossible to use only
load-data-async, as the async loading state would be unset when
load-async got set it's default FALSE value.

15 years ago[clip-stack] Use signed integers while combining window space clip rectangles
Robert Bragg [Sun, 21 Jun 2009 23:58:32 +0000 (00:58 +0100)]
[clip-stack] Use signed integers while combining window space clip rectangles

Use signed integers while combining window space clip rectangles, so we avoid
arithmatic errors later resulting in glScissor getting negative width and
height arguments.

15 years ago[cogl] Remove unused ctx->polygon_vertices array
Robert Bragg [Sun, 21 Jun 2009 23:00:04 +0000 (00:00 +0100)]
[cogl] Remove unused ctx->polygon_vertices array

This array used to be used by cogl_polygon but was changed to use
ctx->logged_vertices some time ago.

15 years ago[cogl] Give the default (fallback) texture a format of RGBA_8888_PRE
Robert Bragg [Tue, 23 Jun 2009 14:24:42 +0000 (15:24 +0100)]
[cogl] Give the default (fallback) texture a format of RGBA_8888_PRE

Previously this was RGBA_8888. It souldn't really make a difference but for
consistency we expect almost all textures in use to have an internaly
premultiplied pixel format.

15 years ago[cogl-texture] use the right format when downloading sliced textures from GL
Robert Bragg [Fri, 19 Jun 2009 15:39:37 +0000 (16:39 +0100)]
[cogl-texture] use the right format when downloading sliced textures from GL

_cogl_texture_download_from_gl needs to create transient CoglBitmaps when
downloading sliced textures from GL, and then copies these as subregions
into the final target_bitmap. _cogl_texture_download_from_gl also supports
target_bitmaps with a different format to the source CoglTexture being
downloaded.

The problem was that in the case of slice textures we were always looking
at the format of the CoglTexture, not of the target_bitmap when setting
up the transient slice bitmap.

15 years ago[cogl] Adds cogl_read_pixels to replace direct use of glReadPixels
Robert Bragg [Wed, 17 Jun 2009 13:30:44 +0000 (14:30 +0100)]
[cogl] Adds cogl_read_pixels to replace direct use of glReadPixels

To allow for flushing of batched geometry within Cogl we can't support users
directly calling glReadPixels.  glReadPixels is also awkward, not least
because it returns upside down image data.

All the unit tests have been swithed over and clutter_stage_read_pixels now
sits on top of this too.

15 years ago[cogl matrix] Adds ability to dirty state cached by the client matrix apis
Robert Bragg [Wed, 17 Jun 2009 01:08:31 +0000 (02:08 +0100)]
[cogl matrix] Adds ability to dirty state cached by the client matrix apis

To be able to load matrices to GL manually within Cogl we need a way to
dirty the state cached by the client matrix stack API.

15 years ago[debug] Adds a "nop-picking" clutter debug option to NOP _clutter_do_pick()
Robert Bragg [Wed, 10 Jun 2009 23:34:00 +0000 (00:34 +0100)]
[debug] Adds a "nop-picking" clutter debug option to NOP _clutter_do_pick()

I've found this is something I do quite often when debugging rendering
problems since its a simple way to wipe out lots of geometry and removes a
lot of unpredictable noise when logging geometry passing through the Cogl
journal.

15 years ago[cogl_polygon] fixes a buffer overrun and color format bug
Robert Bragg [Tue, 16 Jun 2009 21:48:21 +0000 (22:48 +0100)]
[cogl_polygon] fixes a buffer overrun and color format bug

We were calculating our vertex stride and allocating our vertex array
differently depending on whether the user passed TRUE for use_color or not.
The problem was that we were always writting color data to the array
regardless of use_color.

There was also a bug with _cogl_texture_sliced_polygon in that it was
writing byte color components but we were expecting float components.  We
now use byte components in _cogl_multitexture_unsliced_polygon too and pass
GL_UNSIGNED_BYTE to glColorPointer.

15 years ago[test-cogl-tex-getset] Assume a premultiplied pixel format
Robert Bragg [Mon, 15 Jun 2009 23:45:44 +0000 (00:45 +0100)]
[test-cogl-tex-getset] Assume a premultiplied pixel format

test-cogl-tex-getset was assuming it was dealing with
COGL_PIXEL_FORMAT_RGBA_8888 but since merging the premultiplcation branch
the pixel format is actually COGL_PIXEL_FORMAT_RGBA_8888_PRE

15 years ago[vertex-buffer] Add cogl_vertex_buffer_indices_get_type API
Robert Bragg [Wed, 17 Jun 2009 14:03:33 +0000 (15:03 +0100)]
[vertex-buffer] Add cogl_vertex_buffer_indices_get_type API

cogl_vertex_buffer_indices lets you query back the data type used for the
given indices handle.

15 years ago[vertex-buffer] Remove the COGL_INDICES_TYPE_UNSIGNED_INT indicies type
Robert Bragg [Wed, 17 Jun 2009 14:02:56 +0000 (15:02 +0100)]
[vertex-buffer] Remove the COGL_INDICES_TYPE_UNSIGNED_INT indicies type

Since some embedded GPUs may not support 32bit integer indices we wont
include it until there is a particular need.

15 years ago[cogl] Add COGL_HAS_GL and COGL_HAS_GLES
Damien Lespiau [Thu, 25 Jun 2009 14:06:41 +0000 (16:06 +0200)]
[cogl] Add COGL_HAS_GL and COGL_HAS_GLES

Cogl already add similar defines but with the CLUTTER namespace
(CLUTTER_COGL_HAS_GL and CLUTTER_COGL_HAS_GLES). Let's just add two
similar defines with the COGL namespace. Removing the CLUTTER_COGL ones
could break applications silently for no real good reason.

15 years ago[misc] Update headers #endif comments
Damien Lespiau [Thu, 25 Jun 2009 13:59:11 +0000 (15:59 +0200)]
[misc] Update headers #endif comments

While grepping through the public headers looking for invalid use of
private HAVE_* defines, I stumbled upon two out of sync comments. Yes
it's a very minor trivial change.

15 years ago[actor] Remove unused clutter_actor_pick()
Emmanuele Bassi [Mon, 29 Jun 2009 15:34:49 +0000 (16:34 +0100)]
[actor] Remove unused clutter_actor_pick()

The clutter_actor_pick() function just emits the ::pick signal
on the actor. Nobody should be using it, since the paint() method
is already context sensitive and will result in a ::pick emission
by itself. The clutter_actor_pick() is just confusing things.

15 years agoAdd more debug notes inside the master clock
Emmanuele Bassi [Mon, 29 Jun 2009 15:33:07 +0000 (16:33 +0100)]
Add more debug notes inside the master clock

15 years ago[docs] Update after the Input API changes
Emmanuele Bassi [Tue, 23 Jun 2009 14:45:42 +0000 (15:45 +0100)]
[docs] Update after the Input API changes

15 years ago[docs] Add an initial porting guide
Emmanuele Bassi [Tue, 23 Jun 2009 14:25:16 +0000 (15:25 +0100)]
[docs] Add an initial porting guide

The Clutter API reference should have a section on how to port
applications from older version of Clutter to the new API.

The first guide deals on how to port animations created with
ClutterEffect to clutter_actor_animate().

15 years ago[docs] Fix the ActorBox annotations
Emmanuele Bassi [Tue, 23 Jun 2009 14:23:53 +0000 (15:23 +0100)]
[docs] Fix the ActorBox annotations

The ClutterActorBox API is incorrectly annotated and gtk-doc is unable
to pick it up.

15 years ago[test-shader] Fix some of the shaders to use premultiplied colors
Neil Roberts [Wed, 24 Jun 2009 11:04:55 +0000 (12:04 +0100)]
[test-shader] Fix some of the shaders to use premultiplied colors

Texture data is now in premultiplied format and the shader should
output a premultiplied color if the default blend mode is being
used. Shaders that directly manipulate the rgb values now
unpremultiply and premultiply again afterwards.

15 years agoAdd element-type annotations for animate*v functions
Tim Horton [Fri, 19 Jun 2009 02:46:48 +0000 (22:46 -0400)]
Add element-type annotations for animate*v functions

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1653

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[master clock] Fix MT safety issues
Ole André Vadla Ravnås [Thu, 18 Jun 2009 21:53:46 +0000 (23:53 +0200)]
[master clock] Fix MT safety issues

Fix MT issues when enabling threading in Clutter.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1655

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[texture] Revert to integer parameters in ::size-change
Emmanuele Bassi [Mon, 22 Jun 2009 11:07:08 +0000 (12:07 +0100)]
[texture] Revert to integer parameters in ::size-change

In the int-to-float switch for actor properties, the ::size-change signal
was moved to use floats instead of integers. Sub-pixel precision for image
size is meaningless, though, so we should revert it back to ints.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1659

15 years agoPost-release bump to 0.9.5
Emmanuele Bassi [Fri, 19 Jun 2009 17:25:25 +0000 (18:25 +0100)]
Post-release bump to 0.9.5

15 years ago[release] 0.9.4
Emmanuele Bassi [Fri, 19 Jun 2009 16:50:31 +0000 (17:50 +0100)]
[release] 0.9.4

15 years agoUpdate the NEWS file
Emmanuele Bassi [Tue, 16 Jun 2009 15:42:41 +0000 (16:42 +0100)]
Update the NEWS file

15 years ago[docs] Add new input-related accessors
Emmanuele Bassi [Fri, 19 Jun 2009 17:06:02 +0000 (18:06 +0100)]
[docs] Add new input-related accessors

Add the ClutterEvent accessors for the device pointer and type, and
the ClutterInputDevice accessors for the id and type.

15 years agoRemove the last few fixed-point entry points
Emmanuele Bassi [Fri, 19 Jun 2009 15:38:35 +0000 (16:38 +0100)]
Remove the last few fixed-point entry points

The last fixed-point entry points are just a few, and trivial. The
end user is expected to do the conversion using the CoglFixed type
and macros.

15 years ago[x11] Simplify the XInput support
Emmanuele Bassi [Fri, 19 Jun 2009 14:12:32 +0000 (15:12 +0100)]
[x11] Simplify the XInput support

Instead of using a specific function to check whether the X
server supports the XInput extension we can use the generic
Xlib function XQueryExtension(). This cuts down the extra
checks inside the configure.ac and simplifies the code inside
clutter_x11_register_xinput().

15 years ago[x11] Add a command line switch for enabling XInput
Emmanuele Bassi [Fri, 19 Jun 2009 13:32:37 +0000 (14:32 +0100)]
[x11] Add a command line switch for enabling XInput

Currently, XInput support requires a function call. In order to
make it easier for people to test it, we can also add a command
line switch that moves the pointer device detection and handling
to XInput. This should ensure that, at least for people building
Clutter with --enable-xinput, applications can be easily migrated
and regressions can be caught.

15 years ago[tests] Remove unneeded g_type_init()
Emmanuele Bassi [Fri, 19 Jun 2009 13:20:50 +0000 (14:20 +0100)]
[tests] Remove unneeded g_type_init()

Now that we can safely check for an uninitialized Clutter we
don't have side effects in calling one of the functions like
clutter_x11_enable_xinput(), which require to be called before
any other Clutter function.

15 years ago[backend] Do not store the stage manager singleton
Emmanuele Bassi [Fri, 19 Jun 2009 13:19:39 +0000 (14:19 +0100)]
[backend] Do not store the stage manager singleton

The StageManager singleton instance is already kept around
by the clutter_stage_manager_get_default() function; there is
no need to have it inside the main Clutter context as well.

15 years ago[x11] Use _clutter_context_is_initialized()
Emmanuele Bassi [Fri, 19 Jun 2009 13:12:36 +0000 (14:12 +0100)]
[x11] Use _clutter_context_is_initialized()

Instead of using _clutter_context_get_default() and checking the
is_initialized flag, we should use the newly added private function
that does not cause side effects, especially for functions that have
to be called before any other Clutter function.

15 years agoAllow checking initialization without side-effects
Emmanuele Bassi [Fri, 19 Jun 2009 13:09:42 +0000 (14:09 +0100)]
Allow checking initialization without side-effects

The _clutter_context_get_default() function will automatically
create the main Clutter context; if we just want to check whether
Clutter has been initialized this will complicate matters, by
requiring a call to g_type_init() inside the client code.

Instead, we should simply provide an internal API that checks
whether the main Clutter context exists and if it has been
initialized, without any side effect.

15 years ago[input] Rework input device API
Emmanuele Bassi [Fri, 19 Jun 2009 12:07:20 +0000 (13:07 +0100)]
[input] Rework input device API

The input device API is split halfway thorugh the backends in a very
weird way. The data structures are private, as they should, but most
of the information should be available in the main API since it's
generic enough.

The device type enumeration, for instance, should be common across
every backend; the accessors for device type and id should live in the
core API. The internal API should always use ClutterInputDevice and
not the private X11 implementation when dealing with public structures
like ClutterEvent.

By adding accessors for the device type and id, and by moving the
device type enumeration into the core API we can cut down the amount
of symbols private and/or visible only to the X11 backends; this way
when other backends start implementing multi-pointer support we can
share the same API across the code.

15 years agoPublic headers should not have #ifdefs relying on private defines
Damien Lespiau [Mon, 15 Jun 2009 13:15:27 +0000 (14:15 +0100)]
Public headers should not have #ifdefs relying on private defines

HAVE_COGL_GLES2 is defined in config.h through the configure script and
should not be used in public headers.

The patch makes configure generate the right define that can be used
later in the header.

15 years agoHide clutter_context_get_default()
Emmanuele Bassi [Wed, 17 Jun 2009 16:59:54 +0000 (17:59 +0100)]
Hide clutter_context_get_default()

The clutter_context_get_default() function is private, but shared
across Clutter. For this reason, it should be prefixed by '_' so
that the symbol is hidden from the shared object.

15 years agoRemove an unusued member from MainContext
Emmanuele Bassi [Wed, 17 Jun 2009 14:43:53 +0000 (15:43 +0100)]
Remove an unusued member from MainContext

The MainContext structure has a field for the master clock, but
clutter_master_clock_get_default() will return the same instance
from everywhere.

15 years ago[XInput] Get XInput working again.
Matthew Allum [Wed, 17 Jun 2009 14:09:16 +0000 (15:09 +0100)]
[XInput] Get XInput working again.

Check for distros shipping out of sync header vs libXi,
call in g_type_init() in test-devices, fix ifdef so
XInput events get correctly selected.

15 years agoDo not use the --pkd switch for g-ir-scanner
Emmanuele Bassi [Tue, 16 Jun 2009 17:08:52 +0000 (18:08 +0100)]
Do not use the --pkd switch for g-ir-scanner

Revert commit 8aacff0e0f38d2cdfae841f6a154baa793ea7739

15 years ago[docs] Update the backends hacking reference
Emmanuele Bassi [Tue, 16 Jun 2009 15:42:07 +0000 (16:42 +0100)]
[docs] Update the backends hacking reference

15 years ago[docs] Update the release notes
Emmanuele Bassi [Tue, 16 Jun 2009 15:41:46 +0000 (16:41 +0100)]
[docs] Update the release notes

15 years ago[docs] Update the HACKING file
Emmanuele Bassi [Tue, 16 Jun 2009 15:41:29 +0000 (16:41 +0100)]
[docs] Update the HACKING file

15 years ago[introspection] Add --pkg switch pointing at Clutter
Emmanuele Bassi [Tue, 16 Jun 2009 15:40:36 +0000 (16:40 +0100)]
[introspection] Add --pkg switch pointing at Clutter

Add a <package/> element pointing to Clutter's pkg-config
file name.

15 years ago[stage] Remove an assertion
Emmanuele Bassi [Tue, 16 Jun 2009 15:38:01 +0000 (16:38 +0100)]
[stage] Remove an assertion

We might get a size request on destruction, so it should be safe
to avoid an assertion failure because we don't have the stage
implementation anymore.

15 years agoAdd more ActorBox utility methods
Emmanuele Bassi [Tue, 16 Jun 2009 15:30:41 +0000 (16:30 +0100)]
Add more ActorBox utility methods

ActorBox should have methods for easily extracting the X and Y
coordinates of the origin, and the width and height separately.

These methods will make it easier for high-level language bindings
to manipulate ActorBox instances and avoid the Geometry type.

15 years ago[doap] Add branches for past releases
Emmanuele Bassi [Tue, 16 Jun 2009 12:48:11 +0000 (13:48 +0100)]
[doap] Add branches for past releases

15 years agoAdd accessors for the boxed types
Emmanuele Bassi [Tue, 16 Jun 2009 11:47:19 +0000 (12:47 +0100)]
Add accessors for the boxed types

The Vertex and ActorBox boxed types are meant to be used across
the API, but are fairly difficult to bind. Their memory management
is also unclear, and has to go through the indirection of
g_boxed_copy() and g_boxed_free().

15 years agoPlug minor memory leak in cogl_vertex_buffer_submit_real
Colin Walters [Tue, 16 Jun 2009 14:34:13 +0000 (10:34 -0400)]
Plug minor memory leak in cogl_vertex_buffer_submit_real

Free a temporary list.

15 years ago[tests] Beautify the bouncing actor
Emmanuele Bassi [Mon, 15 Jun 2009 14:08:59 +0000 (15:08 +0100)]
[tests] Beautify the bouncing actor

The test-easing interactive demo for the high-level animation API
is a bit "flat". Instead of using a Rectangle actor we should
probably be using something more "interesting" -- like a CairoTexture
with a gradient.

15 years ago[ClutterCairoTexture] Use the right component ordering when uploading data
Neil Roberts [Mon, 15 Jun 2009 11:41:13 +0000 (12:41 +0100)]
[ClutterCairoTexture] Use the right component ordering when uploading data

Cairo stores the image data in ARGB native byte order so we need to
upload this as BGRA on little endian architectures and ARGB on big
endian. ClutterTexture doesn't currently expose any flags to describe
ARGB format so until we can fix the Clutter API it now uses the Cogl
API directly.

15 years ago[cairo-texture] Clean up and whitespace fixes
Emmanuele Bassi [Mon, 15 Jun 2009 10:50:23 +0000 (11:50 +0100)]
[cairo-texture] Clean up and whitespace fixes

Simple clean up of the CairoTexture to remove unneeded checks,
redundant variables and white space.

15 years ago[animation] Rework animation chaining
Emmanuele Bassi [Mon, 15 Jun 2009 09:53:43 +0000 (10:53 +0100)]
[animation] Rework animation chaining

In order to chain up animations using clutter_actor_animate() and
friends you have to use an idle handler that guarantees that the
main loop spins at least once after the animation pointer has been
detached from the actor.

This has several drawbacks, first and foremost the fact that the
slice of the main loop for the idle handler might be starved by
other operations, like redrawing. This inevitably leads to tricks
with priorities and the like, contributing to the overall complexity.

Instead, we should guarantee that the animation instance created by
clutter_actor_animate() is valid for the ::completed signal until
it reaches its default handler; after that, the animation is detached
from the actor and destroyed. This means that it's possible to
create a new animation after the first is complete by simply using
g_signal_connect_after().

This unfortunately makes it impossible to keep a reference to the
animation pointer attached to the actor by using g_object_ref(); a
way to "fix" this would be to have a clutter_animation_attach()
and a clutter_animation_detach() pair of methods that allow attaching
any animation to an actor. This might overcomplicate what it is
the simple animation API, though, so it's currently not implemented
and left for future versions.

The test-easing interactive demo has been modified to show how
the animation queuing works by adding a command line switch that
recenters the animated actor once the first animation has ended.

15 years ago[animation] Allow swapped/after signal variants
Emmanuele Bassi [Mon, 15 Jun 2009 10:24:54 +0000 (11:24 +0100)]
[animation] Allow swapped/after signal variants

Continuing in the tradition on making clutter_actor_animate() the
next g_object_connect(), here's the addition of the signal-after::
and signal-swapped:: modifiers for the automagic signal connection
arguments.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1646

15 years agoDisable single header inclusion for GLib
Emmanuele Bassi [Mon, 15 Jun 2009 09:48:56 +0000 (10:48 +0100)]
Disable single header inclusion for GLib

In order to be ready for the next major version of GLib we need to
disable single header inclusion by using the G_DISABLE_SINGLE_INCLUDES
define in the build process.

15 years agoFix redraw queueing in the presence of cloning
Owen W. Taylor [Thu, 11 Jun 2009 22:56:27 +0000 (18:56 -0400)]
Fix redraw queueing in the presence of cloning

We can't short-circuit the emission of ::queue-redraw for not-visible
actors, since ClutterClone uses that signal to know when things need
to be redrawn.

Calling clutter_actor_queue_redraw() out of clutter_actor_real_map() /
clutter_actor_real_unmap() was causing the flag state to get set
incorrectly from _clutter_actor_set_enable_paint_unmapped(), because
a paint queueing a redraw was not expected.

Moving queuing the redraw to clutter_actor_hide()/show() fixes this, and
also fixes a problem where showing a child of a cloned actor wouldn't
cause the clone to be repainted.

http://bugzilla.openedhand.com/show_bug.cgi?id=1484

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[tests] Add unit for Clone behaviour
Emmanuele Bassi [Fri, 12 Jun 2009 02:46:38 +0000 (03:46 +0100)]
[tests] Add unit for Clone behaviour

A clone actor should not modify the state of its source, so we need
to check that it's not breaking any invariant.

15 years agoFix handling of not-visible texture pixmaps
Owen W. Taylor [Thu, 11 Jun 2009 22:46:44 +0000 (18:46 -0400)]
Fix handling of not-visible texture pixmaps

If we have an not-visible texture pixmap, we need to:

 - Still update it if it is realized, since it won't be
   updated when shown. And it might be also be cloned.

 - Queue a redraw if even if not visible, since it
   it might be cloned.

http://bugzilla.openedhand.com/show_bug.cgi?id=1647

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[gitignore] ignore TAGS and new test
Damien Lespiau [Sun, 14 Jun 2009 00:16:30 +0000 (01:16 +0100)]
[gitignore] ignore TAGS and new test

* ignore files generated by make tags
* ignore the newly introduced premult test

15 years ago[test-cogl-tex-tile] Fix breakages from ClutterFixed removal and timelines
Neil Roberts [Fri, 12 Jun 2009 10:05:26 +0000 (11:05 +0100)]
[test-cogl-tex-tile] Fix breakages from ClutterFixed removal and timelines

The test has been broken since the change to use floats instead of
fixed point because it was passing degrees to sin and cos but they
expect radians.

It was further broken since the timeline changes because it was
directly using the parameter of the new-frame signal as a frame number
but it now represents the elapsed time.

15 years ago[_cogl_texture_bitmap_prepare] use bitmap format for FORMAT_ANY + no alpha
Robert Bragg [Mon, 8 Jun 2009 16:43:34 +0000 (17:43 +0100)]
[_cogl_texture_bitmap_prepare] use bitmap format for FORMAT_ANY + no alpha

My patch to choose a premultiplied format when the user gives
COGL_PIXEL_FORMAT_ANY for the internal_format broke the case where the data
in question doesn't have and alpha channel.

This was accidentally missed when merging the premultiplication branch
since I merged a local version of the branch that missed this commit.

15 years ago[tests] Fix the cogl_polygon() interactive test
Emmanuele Bassi [Thu, 11 Jun 2009 15:59:50 +0000 (16:59 +0100)]
[tests] Fix the cogl_polygon() interactive test

We need to premultiply the alpha, and we also need to change the
frame painting to use the frame-less Timeline.

15 years ago[tests] Fix the VBO interactive test
Emmanuele Bassi [Thu, 11 Jun 2009 15:53:52 +0000 (16:53 +0100)]
[tests] Fix the VBO interactive test

We need to fix the VBO premultiplication; we also do not need to
forcibly queue a redraw in an idle handler: the timeline and the
master clock will do that for us.

15 years ago[tests] Update test-actors (and clones)
Emmanuele Bassi [Thu, 11 Jun 2009 15:23:26 +0000 (16:23 +0100)]
[tests] Update test-actors (and clones)

The test-actors test (and its clones, test-actor-clone and
test-paint-wrapper) was written a long time ago for a different API
and has been tweaked to bits. We should probably have something a
little bit more complicated, but at least we should not use semantics
and coding patterns from Clutter 0.2, otherwise we won't be testing
anything except that Clutter 0.2 worked.

15 years ago[cogl] Don't allow calling cogl_set_source_texture with an INVALID_HANDLE
Robert Bragg [Mon, 8 Jun 2009 11:18:34 +0000 (12:18 +0100)]
[cogl] Don't allow calling cogl_set_source_texture with an INVALID_HANDLE

Although the underlying materials should allow layers with INVALID_HANDLES
it shouldn't be necissary to expose that via cogl_set_source_texture() and
it's easier to resolve a warning/crash here than odd artefacts/crashes later
in the pipeline.

15 years agoBug 1406 - Handling of premultiplication in clutter
Robert Bragg [Thu, 11 Jun 2009 14:16:27 +0000 (15:16 +0100)]
Bug 1406 - Handling of premultiplication in clutter

Merge branch 'premultiplication'

[cogl-texture docs] Improves the documentation of the internal_format args
[test-premult] Adds a unit test for texture upload premultiplication semantics
[fog] Document that fogging only works with opaque or unmultipled colors
[test-blend-strings] Explicitly request RGBA_888 tex format for test textures
[premultiplication] Be more conservative with what data gets premultiplied
[bitmap] Fixes _cogl_bitmap_fallback_unpremult
[cogl-bitmap] Fix minor copy and paste error in _cogl_bitmap_fallback_premult
Avoid unnecesary unpremultiplication when saving to local data
Don't unpremultiply Cairo data
Default to a blend function that expects premultiplied colors
Implement premultiplication for CoglBitmap
Use correct texture format for pixmap textures and FBO's
Add cogl_color_premultiply()

15 years ago[cogl-texture docs] Improves the documentation of the internal_format args
Robert Bragg [Thu, 11 Jun 2009 13:31:01 +0000 (14:31 +0100)]
[cogl-texture docs] Improves the documentation of the internal_format args

Clarifies that if you give COGL_PIXEL_FORMAT_ANY as the internal format for
cogl_texture_new_from_file or cogl_texture_new_from_data then Cogl will
choose a premultiplied internal format.

15 years ago[test-premult] Adds a unit test for texture upload premultiplication semantics
Robert Bragg [Sun, 7 Jun 2009 15:31:12 +0000 (16:31 +0100)]
[test-premult] Adds a unit test for texture upload premultiplication semantics

cogl_texture_new_from_data lets you specify a source format for the users given
data, and an internal format which the user wants the GPU to see. This unit
test verifies that the users data is premultiplied, un-premultiplied or
left alone for a number of (source format, internal format) pairs.

cogl_texture_set_region allows specifying a source format, and the internal
format is determined from the texture being updated. As above we test
a number of format pairs and check Cogl is converting data correctly.

The test verifies that if the user allows COGL_FORMAT_ANY for the
internal_format then by default Cogl will choose a premultipled format for
RGBA textures.

Note: Currently this only tests cogl_texture_new_from_data and
cogl_texture_set_region, we should also test cogl_texture_new_from_file,
cogl_texture_new_from_bitmap and cogl_texture_new_from_foreign.

15 years ago[fog] Document that fogging only works with opaque or unmultipled colors
Robert Bragg [Sun, 7 Jun 2009 10:54:05 +0000 (11:54 +0100)]
[fog] Document that fogging only works with opaque or unmultipled colors

The fixed function fogging provided by OpenGL only works with unmultiplied
colors (or if the color has an alpha of 1.0) so since we now premultiply
textures and colors by default a note to this affect has been added to
clutter_stage_set_fog and cogl_set_fog.

test-depth.c no longer uses clutter_stage_set_fog for this reason.

In the future when we can depend on fragment shaders we should also be
able to support fogging of premultiplied primitives.

15 years ago[test-blend-strings] Explicitly request RGBA_888 tex format for test textures
Robert Bragg [Sat, 6 Jun 2009 20:55:05 +0000 (21:55 +0100)]
[test-blend-strings] Explicitly request RGBA_888 tex format for test textures

This test assumes that the textures will be stored internally with exactly
the color given so that specific texture combining arithmetic can be
tested. Using COGL_PIXEL_FORMAT_ANY allows Cogl to internally premultiply
the textures, so we have to explicitly request an unmultiplied format.