Commit Graph

1631 Commits

Author SHA1 Message Date
Damien Lespiau
4316c3c9e1 doc: Use Docbook's <constant> for external constants
For external (non gtk-doc even) constants, we can use <constant> to
correctly tag those without gtk-doc trying to cross-reference them.

(cherry picked from commit 78d22c6cd44a2279adcd2b94c3317292af861c70)
2013-01-22 17:48:16 +00:00
Damien Lespiau
ec6a713fcc doc: Add a missing '*' to the documentation of CoglFilterReturn
(cherry picked from commit 0b9bdd5aaf2616993c4c20c7d7317daf178b19fd)
2013-01-22 17:48:16 +00:00
Damien Lespiau
c0a024f81d doc: Put the opening '{' at the end of combined typedefs
gtk-doc is not smart enough to parse things like:

  typedef struct
  {
    ...
  } CoglFoo;

but needs the '{' at the end of the first line.

(cherry picked from commit d1187550ef547305fdeb8a22a7e39a95611a0e1d)
2013-01-22 17:48:15 +00:00
Damien Lespiau
bde1d2e661 doc: Fix FALSE documentation
Typo with the copy & paste from TRUE.

(cherry picked from commit c7d4a13889ee5681a237a0d2a0fbbdca79120f17)
2013-01-22 17:48:15 +00:00
Damien Lespiau
9401cb044e doc: Fixup type references
gtk-doc needs the types in -sections.txt to be able to do
cross-references. Add all those currently generating warnings.

(cherry picked from commit e57a21d2608f0885e6f2eb3a017feb7dffb7a63c)
2013-01-22 17:48:15 +00:00
Damien Lespiau
55d2a039c6 doc: Don't use '::' to denote an object property
That's actually for signals in gtk-doc and we're not dealing with
GObjects so it's not really appropriate. Used <structfield> as it's the
closest tag I could find to describe a 'property' of a CoglObject and
gives a generic style in the produced HTML.

(cherry picked from commit 8b485d57577cff227a0c7a2e6c06d8d277821374)
2013-01-22 17:48:15 +00:00
Damien Lespiau
780b01f1c8 doc: Populate cogl-types a bit more and move it to the general section
I just added the general types creating warnings in the current state of the
documentation (ie the ones references by already documented functions)
and moved the section from the 'Utility' section to the 'General'
section which I believe is a better fit as they are used by more than
one type and not really utilities.

(cherry picked from commit c51b147789763863ef32482d7ffa936160ed7c93)
2013-01-22 17:48:15 +00:00
Damien Lespiau
5c12c36c58 doc: Don't use the HTML <ul> but the DocBook equivalent
Of course, this confused gtk-doc.

(cherry picked from commit be512104784a9200a2e98a75d16a56e3897a8845)
2013-01-22 17:48:15 +00:00
Damien Lespiau
f1f1e876f1 doc: Fix the remaining warning around the depth state
Various changes have led to the current, separate from the pipeline,
depth state, this commit fixes the remaining waring around that.

(cherry picked from commit 111e687e722ad67a0e1c09f881c6282ccb06410b)
2013-01-22 17:48:15 +00:00
Damien Lespiau
9ae9602047 doc: Expose CoglDepthState
It wasn't included to the documention up to now.

(cherry picked from commit 826c0d5c8333ad31595d690d7c8753f84d12b2ad)
2013-01-22 17:48:14 +00:00
Damien Lespiau
17333d3f10 doc: Use <ulink> to make Gimbal Lock reactive
Instead of just having the reference at the end of the paragraph.
Usually seen as more usable.

(cherry picked from commit 6988d3ae61ab16fb298b34d2bd31860833f04186)
2013-01-22 17:48:14 +00:00
Damien Lespiau
61e1206d33 doc: Unhide cogl-matrix-stack.h
The documentation welcomes a new 2.0 API.

(cherry picked from commit 8d78957c8d29b89c7bf352131d84c9755083eed9)
2013-01-22 17:48:14 +00:00
Damien Lespiau
f2b0dac871 doc: Document CoglColor
(cherry picked from commit a0dfba1eb1c541490611a021799e656bf43a04fe)
2013-01-22 17:48:14 +00:00
Damien Lespiau
cfcb440d70 doc: Document the members of CoglPollFDEvent
(cherry picked from commit 7cc94c2a994a774f0d8db172c9e0bec506bd2287)
2013-01-22 17:48:14 +00:00
Damien Lespiau
864e5562df doc: Fix various mismatches between arguments and their documentation
Argument names and @$arg suffered from various little mismatches, fix
them in a batch commit.

(cherry picked from commit d2ac3c5a88d980e7519c98bd261111b93cf73a6e)
2013-01-22 17:48:13 +00:00
Damien Lespiau
6aadb4a0db doc: Make a pass on CoglRenderer argument documentation
Various arguments where missing, added them.

(cherry picked from commit 6e6ee4acb5524ced2f82d42d9c6a706f84f8184c)
2013-01-22 17:48:13 +00:00
Damien Lespiau
f63b4597f7 doc: Finish describing the arguments of cogl_error_matches()
(cherry picked from commit 8f429d9ce45e3df204db0bdc0d988fd07f103282)
2013-01-22 17:48:13 +00:00
Damien Lespiau
532cd9bf9f doc: Fix small typo of sequence
(cherry picked from commit 09706dc78178d022b4313572600a245112d23fd9)
2013-01-22 17:48:13 +00:00
Damien Lespiau
0142d027d7 doc: Update the section name and description of CoglIndices
cogl-index-range was the old API, update the section name to match what
is declared in the documentation. Also update the short description to
better match the new API.

(cherry picked from commit d73df38ff2a8ebe477e139e5ac20838c8f4364bb)
2013-01-22 17:48:13 +00:00
Damien Lespiau
e4ca3cb039 doc: s/Fuction/Function/
(cherry picked from commit 8e62a12cff9ba0a267d199c359fdc8e591f65264)
2013-01-22 17:48:12 +00:00
Damien Lespiau
8c1708ec93 doc: Fix argument syntax of existing commment blocks
Fixes:
  Parsing comment block file : parameter expecter

by correctly declaring parameters.

(cherry picked from commit 2fe9bc2017fa966ab445674a530aac0c17204040)
2013-01-22 17:48:12 +00:00
Damien Lespiau
388e589ac4 doc: Fix a typo in the description of cogl-bitmap
(cherry picked from commit 423b8f8c62b1f73d6b0e24a5689428821e154703)
2013-01-22 17:48:12 +00:00
Damien Lespiau
81a94a7849 doc: Expose the Cogl GLES 2.0 facilities in the documentation
(cherry picked from commit 0c2344b9aafe4afdf7782fd9badc451de79b7a63)
2013-01-22 17:48:12 +00:00
Damien Lespiau
37cc715269 doc: Add missing symbol in cogl_framebuffer_get_context() documentation
(cherry picked from commit 146a1bfc2655c7e7ed0a5a4fd64b490385159f49)
2013-01-22 17:48:12 +00:00
Damien Lespiau
7b43289ec9 doc: Use Returns: to annotate return values
gtk-doc complains that having a sentence starting by Return is a bit
ambiguous and it'd rather see 'Returns:' spelled out.

Fixes 2 warnings:

 warning: Free-form return value description in $symbol. Use `Returns:'
 to avoid ambiguities

(cherry picked from commit 9718f31717b3a0e01b7c4c69cea138f39d23c0e0)
2013-01-22 17:48:11 +00:00
Damien Lespiau
b8d9bbed1a Don't use #if with defines that are either defined or not
COGL_HAS_* and COGL_ENABLE_DEBUG are either defined in config.h or not.

So let's test against this, not against their truth value, this allow us
to use -Wundef to catch undefined macros in preprocessor directives.

(cherry picked from commit 73b62832f24711073b0876a6c0f5c61727842c1c)
2013-01-22 17:48:11 +00:00
Neil Roberts
1f0b432a25 sdl: Bind the default window when currently bound window is destroyed
Cogl always needs to have the context bound to something so that it
can freely create resources such as textures even if there is no
current window. When the currently bound SDLWindow is destroyed, SDL
apparently explicitly unbinds the GL context. If something then later
for example tries to create a texture Cogl would start getting GL
errors and fail. To fix this the SDL winsys now just binds the dummy
window before deiniting the currently bound onscreen.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 2c0cfdefbb9d1ac5097d98887d3581b67a324fae)
2013-01-22 17:48:11 +00:00
Robert Bragg
cab4622eb3 matrix-stack: make CoglMatrixStack public
We have found several times now when writing code using Cogl that it
would really help if Cogl's matrix stack api was public as a utility
api. In Rig for example we want to avoid redundant arithmetic when
deriving the matrices of entities used to render and we aren't able
to simply use the framebuffer's matrix stack to achieve this. Also when
implementing cairo-cogl we found that it would be really useful if we
could have a matrix stack utility api.

(cherry picked from commit d17a01fd935d88fab96fe6cc0b906c84026c0067)
2013-01-22 17:48:11 +00:00
Robert Bragg
3e33c00c84 matrix-stack: only maintain composite_gets in debug builds
At times there can be huge numbers of CoglMatrixEntry structures
allocated if they are being used to track the transform of many drawing
commands or objects in a scenegraph. Therefore the size of a
CoglMatrixEntry should be kept as small as possible both to help reduce
the memory usage of applications but also to improve cache usage since
matrix stack manipulations are performance critical at times.

This reduces the size of CoglMatrixEntry structures for non-debug builds
by removing the composite_gets counter used to sanity check how often
the transform for an entry is resolved.

(cherry picked from commit c400b86681a328b1e12b7e120e9c3f4f12c356e0)
2013-01-22 17:48:10 +00:00
Robert Bragg
f5b95e8087 matrix-stack: move pointer to top of CoglMatrixEntry
This moves the parent pointer member to the top of the CoglMatrixEntry
structure since it will lead to wasted padding when we build for 64bit
cpus.

(cherry picked from commit 42b4750070286a6404b103d8a827a46efb6b344c)
2013-01-22 17:48:10 +00:00
Robert Bragg
9eb816bc7e matrix-stack: getting parent ptr before freeing
When unrefing a CoglMatrixEntry we walk up the ancestry unrefing and
freeing entries until we find an entry that doesn't need to be freed.
The problem fixed by this patch was that we didn't dereference the
parent member of each entry until after the entry was freed and so there
was the potential for reading a junk parent pointer back.

(cherry picked from commit e5d836b84acb35a009854a0cc0892320023789d1)
2013-01-22 17:48:10 +00:00
Robert Bragg
5bc6121cbf journal: don't call cogl_attribute_buffer_new with NULL
It is considered an error to pass a NULL data pointer to
cogl_attribute_buffer_new so we now call
cogl_attribute_buffer_new_with_size instead.

(cherry picked from commit 8e201574b9c35847aa4e999a391741538a0b356b)
2013-01-22 17:48:10 +00:00
Damien Lespiau
5d796f0a4c x11: Replace all internal usage of cogl_xlib_get_display()
And use the renderer replacement, cogl_xlib_renderer_get_display()

(cherry picked from commit ea355792e88b09b0b0afa6fb5c5acc311d41688e)
2013-01-22 17:48:09 +00:00
Neil Roberts
6bcfc8342a Fix handling of binding errors when uploading a full texture
Both the texture drivers weren't handling errors correctly when a
CoglPixelBuffer was used to set the contents of an entire texture.
This was causing it to hit an assertion failure in the pixel buffer
tests.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 888733d3c3b24080d2f136cedb3876a41312e4cf)
2013-01-22 17:48:09 +00:00
Robert Bragg
7011eb5db4 texture: expose mipmap level in set region apis
cogl_texture_set_region() and cogl_texture_set_region_from_bitmap() now
have a level argument so image data can be uploaded to a specific mipmap
level.

The prototype for cogl_texture_set_region was also updated to simplify
the arguments.

The arguments for cogl_texture_set_region_from_bitmap were reordered to
be consistent with cogl_texture_set_region with the source related
arguments listed first followed by the destination arguments.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 3a336a8adcd406b53731a6de0e7d97ba7932c1a8)

Note: Public API changes were reverted in cherry-picking this patch
2013-01-22 17:48:09 +00:00
Robert Bragg
fa5a9c88fe atlas-texture: remove some use of _COGL_GET_CONTEXT
This removes several uses of _COGL_GET_CONTEXT in cogl-atlas-texture.c.
Notably this involved making CoglPangoGlyphCache track an associated
CoglContext pointer which cogl-pango can pass to
_cogl_atlas_texture_new_with_size().

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit d66afbd0758539330490945c699a05c0749c76aa)
2013-01-22 17:48:09 +00:00
Robert Bragg
cd7b15b7df glx: avoid use of _COGL_GET_CONTEXT()
Removes some (not all) use of _COGL_GET_CONTEXT() from cogl-winsys-glx.c

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 698a131c4991e4393ce966b968637fba194f252c)
2013-01-22 17:48:09 +00:00
Robert Bragg
110a7d0ed7 framebuffer: remove use of _COGL_GET_CONTEXT
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit b8755a98e4139b6a077ff329b9c5900292d3a1d3)
2013-01-22 17:48:08 +00:00
Robert Bragg
7941357e73 journal: don't reference global context
This removes all use of _COGL_GET_CONTEXT from cogl-journal.c

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit b5c8ec5db52a6cb71f29b338a59fb3772506fef7)
2013-01-22 17:48:08 +00:00
Neil Roberts
ca5197a70c error: Don't allocate a new CoglError when propagating
The _cogl_propagate_error() function takes ownership of the incoming
error pointer so there's no need to allocate a new error when passing
it on. The errors can potentially be passed up from a number of layers
so it seems worthwhile to avoid the allocation.

The _cogl_propagate_gerror() function was previously using
_cogl_propagate_error(). Presumably this would not have worked because
that function would try to free the error from glib using
cogl_error_free but that would use the wrong free function and thus
the wrong slice allocator. The GError propagating function is only
used when gdk-pixbuf is enabled which now requires glib support anyway
so we can just avoid defining the function when compiling without
glib.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 91266162bef9f89fb42c01be0f929d5079758096)
2013-01-22 17:48:08 +00:00
Neil Roberts
af0dc3431d Fix spelling of _cogl_propagate_error
‘Propagate’ was misspelled as ‘propogate’.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 5fb4a6178c3e64371c01510690d9de1e8a740bde)
2013-01-22 17:48:08 +00:00
Robert Bragg
38921701e5 blit: avoid referring to framebuffer stack
This make _cogl_framebuffer_blit take explicit src and dest framebuffer
pointers and updates all the texture blitting strategies in cogl-blit.c
to avoid pushing/popping to/from the the framebuffer stack.

The removes the last user of the framebuffer stack which we've been
aiming to remove before Cogl 2.0

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 598ca33950a93dd7a201045c4abccda2a855e936)
2013-01-22 17:48:08 +00:00
Robert Bragg
e8eb9793e6 moves some gl texture code too cogl-texture-gl.c
This adds a driver/gl/cogl-texture-gl.c file and moves some gl specific
bits from cogl-texture.c into it. The moved symbols were also given a
_gl_ infix and the calling code was updated accordingly.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 2c9e81de70cc02d72b1ce9013c49e39300a05b6a)
2013-01-22 17:48:08 +00:00
Robert Bragg
6941ff2c71 matrix-stack: init cache->flipped
This ensures we initialize the value of cache->flipped in
_cogl_matrix_entry_cache_init()

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 507814d27298231c9ae50d74b386fb00f0909922)
2013-01-22 17:48:08 +00:00
Robert Bragg
da9f5e6179 bitmap: ret CoglError from _new_with_malloc_buffer
_cogl_bitmap_new_with_malloc_buffer() now takes a CoglError for throwing
exceptional errors and all callers have been updated to pass through
any application error pointer as appropriate.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 67cad9c0eb5e2650b75aff16abde49f23aabd0cc)
2013-01-22 17:48:08 +00:00
Robert Bragg
07d47eadd3 texture: split out high-level texture constructors
This splits out the very high level texture constructors that may
internally construct one of several types of lower level texture due to
various constraints.

This also updates the prototypes for these constructors to take an
explicit context pointer and return a CoglError consistent with other
texture constructors.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a1cabfae6ad50c51006c608cdde7d631b7832e71)
2013-01-22 17:48:07 +00:00
Robert Bragg
e439bdd12f atlas: catch _create_texture errors
Previously we were passing NULL to
cogl_texture_2d_new_{from_bitmap,with_size} so if there was an error the
application would be aborted. This ensures we pass an internal CoglError
so errors can be caught and suppressed instead.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit b8d1a1db482e1417979df9f88f92da47aa954bd0)
2013-01-22 17:48:07 +00:00
Robert Bragg
f53fb5e2e0 Allow propogation of OOM errors to apps
This allows apps to catch out-of-memory errors when allocating textures.

Textures can be pretty huge at times and so it's quite possible for an
application to try and allocate more memory than is available. It's also
very possible that the application can take some action in response to
reduce memory pressure (such as freeing up texture caches perhaps) so
we shouldn't just automatically abort like we do for trivial heap
allocations.

These public functions now take a CoglError argument so applications can
catch out of memory errors:

cogl_buffer_map
cogl_buffer_map_range
cogl_buffer_set_data
cogl_framebuffer_read_pixels_into_bitmap
cogl_pixel_buffer_new
cogl_texture_new_from_data
cogl_texture_new_from_bitmap

Note: we've been quite conservative with how many apis we let throw OOM
CoglErrors since we don't really want to put a burdon on developers to
be checking for errors with every cogl api call. So long as there is
some lower level api for apps to use that let them catch OOM errors
for everything necessary that's enough and we don't have to make more
convenient apis more awkward to use.

The main focus is on bitmaps and texture allocations since they
can be particularly large and prone to failing.

A new cogl_attribute_buffer_new_with_size() function has been added in
case developers need to catch OOM errors when allocating attribute buffers
whereby they can first use _buffer_new_with_size() (which doesn't take a
CoglError) followed by cogl_buffer_set_data() which will lazily allocate
the buffer storage and report OOM errors.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit f7735e141ad537a253b02afa2a8238f96340b978)

Note: since we can't break the API for Cogl 1.x then actually the main
purpose of cherry picking this patch is to keep in-line with changes
on the master branch so that we can easily cherry-pick patches.

All the api changes relating stable apis released on the 1.12 branch
have been reverted as part of cherry-picking this patch so this most
just applies all the internal plumbing changes that enable us to
correctly propagate OOM errors.
2013-01-22 17:48:07 +00:00
Robert Bragg
63db64f426 attribute: Only unref buffer for buffered attributes
constant attributes don't have a corresponding buffer so
_cogl_attribute_free shouldn't try to unref it. Also, for good measure,
in the case of constant attributes we should call
_cogl_boxed_value_destroy() (although currently we know there is no
dynamic data associated with the boxed values).

(cherry picked from commit 89d6dc90d10c59676e0deed87c2c15a0c9712737)
2013-01-22 17:48:07 +00:00
Robert Bragg
6e379fb54e attribute: Adds support for constant CoglAttributes
This makes it possible to create vertex attributes that efficiently
represent constant values without duplicating the constant for every
vertex. This adds the following new constructors for constant
attributes:

  cogl_attribute_new_const_1f
  cogl_attribute_new_const_2fv
  cogl_attribute_new_const_3fv
  cogl_attribute_new_const_4fv
  cogl_attribute_new_const_2f
  cogl_attribute_new_const_3f
  cogl_attribute_new_const_4f
  cogl_attribute_new_const_2x2fv
  cogl_attribute_new_const_3x3fv
  cogl_attribute_new_const_4x4fv

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6507216f8030e84dcf2e63b8ecfe906ac47f2ca7)
2013-01-22 17:48:07 +00:00