[Cogl] [PATCH 00/13] Allocate textures lazily

Robert Bragg robert at sixbynine.org
Wed Dec 11 10:31:21 PST 2013


From: Robert Bragg <robert at linux.intel.com>

This patch series updates all of the CoglTexture implementations to
support lazy storage allocation. Previously we had updated the API
in preparation for this change by adding an explicit
cogl_texture_allocate() api but in practice most implementations
allocated resources before the constructor functions returned.

This series also removes the use of CoglPixelFormat for describing
the internal format of textures. CoglPixelFormat is overly specific
about the internal format which is misleading given that we build on
OpenGL which doesn't always provide that level of control and even if
it did it would take away the drivers ability to choose the most
optimal format.

These changes make texture construction much more extensible now since
we can add any number of configuration apis that can affect how a
texture is allocated to be used before cogl_texture_allocate() is
called.

To replace the internal_format argument that we used to give to
constructors there are new cogl_texture_set_components() and
cogl_texture_set_premultiplied() functions.

Since none of the constructors actually allocate any resources any
more we have also removed the CoglError arguments given to
texture constructors.

Overall these changes simplify the texture construction apis, give us
extensibility for controlling texture allocation and they lay the ground
work for also supporting asynchronous file loading.

kind regards,
Robert

Robert Bragg (13):
  framebuffer: make format internal
  offscreen: allocate texture before querying slicing
  framebuffer: if size unknown; allocate for size/vp queries
  framebuffer: defer calculating level size until allocation
  ensure texture allocated in _get_gl_texture() in preparation
  texture: allocate on slicing/hw repeat queries
  atlas: make zero size a programmer error
  atlas: defer checks until allocation
  texture: make cogl_texture_get_format api private
  texture: return ints from _get_width/height
  get_texture_bits_via_offscreen(): use meta texture format
  introduce texture loaders to make allocations lazy
  remove internal_format and redundant error arguments

 cogl-gst/cogl-gst-video-sink.c                     |  40 +--
 cogl-pango/cogl-pango-glyph-cache.c                |   7 +-
 cogl-pango/cogl-pango-pipeline-cache.c             |   2 +-
 cogl-pango/cogl-pango-render.c                     |   2 +-
 cogl/Makefile.am                                   |   2 +-
 cogl/cogl-atlas-texture-private.h                  |   8 +-
 cogl/cogl-atlas-texture.c                          | 281 +++++++++------
 cogl/cogl-atlas-texture.h                          |  92 ++---
 cogl/cogl-atlas.c                                  |  40 ++-
 cogl/cogl-blit.c                                   |   6 +-
 cogl/cogl-context.c                                |  52 +--
 cogl/cogl-driver.h                                 |  25 --
 cogl/cogl-framebuffer-private.h                    |  21 +-
 cogl/cogl-framebuffer.c                            |  90 +++--
 cogl/cogl-gles2-context.c                          |  22 +-
 cogl/cogl-gles2.h                                  |   6 +-
 cogl/cogl-onscreen.c                               |   1 -
 cogl/cogl-pipeline-layer.c                         |   2 +-
 cogl/cogl-sub-texture.c                            |  11 +-
 cogl/cogl-texture-2d-gl.h                          |  13 +-
 cogl/cogl-texture-2d-private.h                     |   9 +-
 cogl/cogl-texture-2d-sliced-private.h              |   8 +-
 cogl/cogl-texture-2d-sliced.c                      | 397 +++++++++++----------
 cogl/cogl-texture-2d-sliced.h                      |  64 ++--
 cogl/cogl-texture-2d.c                             | 179 ++++------
 cogl/cogl-texture-2d.h                             | 107 +++---
 cogl/cogl-texture-3d.c                             | 351 ++++++++++--------
 cogl/cogl-texture-3d.h                             |  81 +++--
 cogl/cogl-texture-private.h                        | 100 +++++-
 cogl/cogl-texture-rectangle.c                      | 250 ++++++++-----
 cogl/cogl-texture-rectangle.h                      |  52 ++-
 cogl/cogl-texture.c                                | 313 ++++++++++++----
 cogl/cogl-texture.h                                |  37 +-
 cogl/cogl.symbols                                  |   1 -
 cogl/driver/gl/cogl-framebuffer-gl.c               |  71 ++--
 cogl/driver/gl/cogl-texture-2d-gl.c                | 357 ++++++++++--------
 cogl/driver/gl/gl/cogl-driver-gl.c                 |   4 -
 cogl/driver/gl/gles/cogl-driver-gles.c             |   4 -
 cogl/driver/nop/cogl-driver-nop.c                  |   4 -
 cogl/driver/nop/cogl-texture-2d-nop-private.h      |  16 -
 cogl/driver/nop/cogl-texture-2d-nop.c              |  30 --
 cogl/winsys/cogl-texture-pixmap-x11.c              |  29 +-
 cogl/winsys/cogl-winsys-glx.c                      |  10 +-
 doc/reference/cogl2/cogl2-sections.txt             |   2 -
 examples/cogl-basic-video-player.c                 |   1 +
 examples/cogl-crate.c                              |   1 -
 examples/cogl-gles2-context.c                      |   3 +-
 examples/cogl-msaa.c                               |   4 +-
 examples/cogl-point-sprites.c                      |   1 -
 test-fixtures/test-utils.c                         |  49 ++-
 test-fixtures/test-utils.h                         |  32 +-
 tests/conform/test-alpha-test.c                    |   1 -
 tests/conform/test-alpha-textures.c                |   1 -
 tests/conform/test-atlas-migration.c               |   6 +-
 tests/conform/test-backface-culling.c              |   4 +-
 tests/conform/test-blend-strings.c                 |   7 +-
 tests/conform/test-color-mask.c                    |   2 +-
 tests/conform/test-copy-replace-texture.c          |   1 -
 tests/conform/test-framebuffer-get-bits.c          |   8 +-
 tests/conform/test-gles2-context.c                 |   6 +-
 tests/conform/test-just-vertex-shader.c            |   1 -
 tests/conform/test-map-buffer-range.c              |   1 -
 tests/conform/test-npot-texture.c                  |   1 -
 tests/conform/test-offscreen.c                     |   6 +-
 tests/conform/test-pipeline-cache-unrefs-texture.c |   1 -
 tests/conform/test-pipeline-shader-state.c         |   3 +-
 tests/conform/test-pixel-buffer.c                  |   5 +-
 tests/conform/test-point-sprite.c                  |   1 -
 tests/conform/test-premult.c                       |  57 +--
 tests/conform/test-primitive.c                     |   1 -
 tests/conform/test-read-texture-formats.c          |   1 -
 tests/conform/test-snippets.c                      |   1 -
 tests/conform/test-sub-texture.c                   |   2 -
 tests/conform/test-texture-3d.c                    |   3 -
 tests/conform/test-texture-get-set-data.c          |  16 +-
 tests/conform/test-texture-mipmap-get-set.c        |   1 -
 tests/conform/test-texture-no-allocate.c           |  14 +-
 tests/conform/test-wrap-modes.c                    |   1 -
 tests/conform/test-wrap-rectangle-textures.c       |   5 +-
 79 files changed, 1989 insertions(+), 1458 deletions(-)

-- 
1.8.3.1



More information about the Cogl mailing list