[Cogl] [PATCH 3/3] Allow propogation of OOM errors to apps

Neil Roberts neil at linux.intel.com
Mon Nov 19 11:37:33 PST 2012


I think it would be more useful if cogl_attribute_buffer_new aborted if
there was an error instead of silently ignoring it. The comment says
that it will return NULL if there was an error but it doesn't look like
that is actually true. At the very least it should be updated to match
the comment.

cogl_buffer_map_range() is checking whether the access mode is supported
and then returning NULL without setting an error. I think this should be
removed, because the map_range virtual implementation in the GL driver
also checks the access and sets an error. We effectively always support
mapping malloc'd buffers so I don't think we need to check this higher
up. Or at least if we do it should probably set an error rather than
just returning NULL.

_cogl_buffer_gl_map_range doesn't unbind the buffer if a
glMapBufferRange throws an out of memory error. Maybe it should because
all of the other error conditions do.

It might make sense to make cogl_pixel_buffer_new not take a CoglError
and make it behave the same was as cogl_attribute_buffer_new. Then we
can add a cogl_pixel_buffer_new_with_size and you could catch the error
when you set the data. cogl_bitmap_new_with_size probably also shouldn't
take a CoglError because the bitmap's buffer isn't allocated until data
is set on it so it can't throw an error.

- Neil
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the Cogl mailing list