diff options
Diffstat (limited to 'cogl/cogl-texture.h')
-rw-r--r-- | cogl/cogl-texture.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h index 17658ead..b744babe 100644 --- a/cogl/cogl-texture.h +++ b/cogl/cogl-texture.h @@ -112,7 +112,14 @@ uint32_t cogl_texture_error_quark (void); * * Creates a new #CoglTexture with the specified dimensions and pixel format. * - * Return value: A newly created #CoglTexture or %NULL on failure + * The storage for the texture is not necesarily created before this + * function returns. The storage can be explicitly allocated using + * cogl_texture_allocate() or preferably you can let Cogl + * automatically allocate the storage lazily when uploading data when + * Cogl may know more about how the texture will be used and can + * optimize how it is allocated. + * + * Return value: A newly created #CoglTexture * * Since: 0.8 */ @@ -517,6 +524,28 @@ cogl_texture_unref (void *texture) G_GNUC_DEPRECATED; #endif /* COGL_DISABLE_DEPRECATED */ +/** + * cogl_texture_allocate: + * @texture: A #CoglTexture + * @error: A #CoglError to return exceptional errors or %NULL + * + * Explicitly allocates the storage for the given @texture which + * allows you to be sure that there is enough memory for the + * texture and if not then the error can be handled gracefully. + * + * <note>Normally applications don't need to use this api directly + * since the texture will be implicitly allocated when data is set on + * the texture, or if the texture is attached to a #CoglOffscreen + * framebuffer and rendered too.</note> + * + * Return value: %TRUE if the texture was successfully allocated, + * otherwise %FALSE and @error will be updated if it + * wasn't %NULL. + */ +CoglBool +cogl_texture_allocate (CoglTexture *texture, + CoglError **error); + COGL_END_DECLS #endif /* __COGL_TEXTURE_H__ */ |