mutter/common
Robert Bragg 2b9478a665 [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.
2009-06-30 17:13:34 +01:00
..
cogl-bitmap-fallback.c [bitmap] Fixes _cogl_bitmap_fallback_unpremult 2009-06-11 14:17:52 +01:00
cogl-bitmap-pixbuf.c Implement premultiplication for CoglBitmap 2009-06-11 14:17:51 +01:00
cogl-bitmap-private.h Implement premultiplication for CoglBitmap 2009-06-11 14:17:51 +01:00
cogl-bitmap.c Implement premultiplication for CoglBitmap 2009-06-11 14:17:51 +01:00
cogl-blend-string.c [build] Fix compiler warnings 2009-06-05 16:46:12 +01:00
cogl-blend-string.h [cogl-material] Support string based blending and layer combine descriptions 2009-05-28 02:43:28 +01:00
cogl-clip-stack.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-clip-stack.h [cogl] Updates all file headers and removes lots of trailing white space 2009-05-02 04:12:25 +01:00
cogl-color.c Add cogl_color_premultiply() 2009-06-11 14:17:51 +01:00
cogl-current-matrix.c [cogl matrix] Adds ability to dirty state cached by the client matrix apis 2009-06-29 23:49:06 +01:00
cogl-current-matrix.h [cogl matrix] Adds ability to dirty state cached by the client matrix apis 2009-06-29 23:49:06 +01:00
cogl-debug.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-enum-types.c.in Use g_once when registering enumeration types 2009-05-29 12:40:23 +01:00
cogl-enum-types.h.in [cogl] Generate enumeration GTypes 2009-05-29 12:31:47 +01:00
cogl-fixed.c [cogl] Updates all file headers and removes lots of trailing white space 2009-05-02 04:12:25 +01:00
cogl-handle.h [material] Reduce the material API in preperation for releasing Clutter 1.0 2009-05-28 02:43:34 +01:00
cogl-internal.h [build] The cogl GE macro wasn't passing an int according to the format string 2009-05-21 15:10:38 +01:00
cogl-material-private.h [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-material.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-matrix-stack.c [cogl matrix] Adds ability to dirty state cached by the client matrix apis 2009-06-29 23:49:06 +01:00
cogl-matrix-stack.h [cogl matrix] Adds ability to dirty state cached by the client matrix apis 2009-06-29 23:49:06 +01:00
cogl-matrix.c [cogl matrix] Support ortho and perspective projections. 2009-05-28 02:43:35 +01:00
cogl-primitives.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-primitives.h [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-util.c [cogl] Generate enumeration GTypes 2009-05-29 12:31:47 +01:00
cogl-util.h [cogl] Updates all file headers and removes lots of trailing white space 2009-05-02 04:12:25 +01:00
cogl-vertex-buffer-private.h Use GL_QUADS for flushing a quad batch 2009-06-01 17:29:01 +01:00
cogl-vertex-buffer.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl.c [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
Makefile.am Disable single header inclusion for GLib 2009-06-15 11:29:37 +01:00
stb_image.c Merged clutter-ivan branch into trunk. 2008-04-25 13:37:36 +00:00