Go to file
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
common [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
doc/reference/cogl [cogl] Adds cogl_read_pixels to replace direct use of glReadPixels 2009-06-29 23:49:06 +01:00
gl [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
gles [cogl] Add COGL_HAS_GL and COGL_HAS_GLES 2009-06-29 21:37:02 +02:00
cogl-bitmap.h [docs] Various gtk-doc fixes for COGL 2009-06-10 12:57:36 +01:00
cogl-color.h Add cogl_color_premultiply() 2009-06-11 14:17:51 +01:00
cogl-debug.h [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-deprecated.h [cogl deprecated] Add backface culling deprecation 2009-05-28 14:14:50 +01:00
cogl-fixed.h [cogl] Updates all file headers and removes lots of trailing white space 2009-05-02 04:12:25 +01:00
cogl-material.h [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl-matrix.h [docs] Various gtk-doc fixes for COGL 2009-06-10 12:57:36 +01:00
cogl-offscreen.h [docs] Various gtk-doc fixes for COGL 2009-06-10 12:57:36 +01:00
cogl-path.h [cogl] Updates all file headers and removes lots of trailing white space 2009-05-02 04:12:25 +01:00
cogl-shader.h [cogl-shader] Make get_info_log() slightly nicer 2009-06-01 17:40:23 +01:00
cogl-texture.h [cogl-texture docs] Improves the documentation of the internal_format args 2009-06-11 14:31:01 +01:00
cogl-types.h [cogl] Move the texture filters to be a property of the material layer 2009-06-04 19:03:40 +01:00
cogl-vertex-buffer.h [vertex-buffer] Add cogl_vertex_buffer_indices_get_type API 2009-06-29 23:49:05 +01:00
cogl.h.in [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes 2009-06-30 17:13:34 +01:00
cogl.pc.in [cogl] Fix hardcoded paths in the pc file 2009-03-10 12:38:04 +00:00
Makefile.am [introspection] Add --c-include to g-ir-scanner 2009-06-09 12:45:23 +01:00
TODO Merged clutter-ivan branch into trunk. 2008-04-25 13:37:36 +00:00