Don't handle the out-of-memory error specially for auto-textures

Previously when trying the three different texture types to create an
automagic texture it would handle the out-of-memory error specially
and bypass trying the remaining texture types. Presumably the idea is
that out-of-memory is a serious error and it can't be recovered from.
However, in the case of atlas textures, this error will be thrown if
the texture is too large to fit into an atlas. In that case it makes
sense to try another texture type so that it can fallback to using a
sliced texture. I think conceptually each different texture type will
have different memory requirements so it seems reasonable to try the
others if there is not enough memory for one of them.

This was causing cogl_texture_new_from_data to break when loading very
large textures because it wouldn't end up slicing them.

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

(cherry picked from commit ad6968135a01823eb6a94668dd22c7a4df6f9327)
This commit is contained in:
Neil Roberts 2013-06-13 17:18:18 +01:00
parent 534e535a28
commit 1b1713625c

View File

@ -179,14 +179,6 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
&internal_error))) &internal_error)))
return COGL_TEXTURE (atlas_tex); return COGL_TEXTURE (atlas_tex);
if (cogl_error_matches (internal_error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY))
{
_cogl_propagate_error (error, internal_error);
return NULL;
}
cogl_error_free (internal_error); cogl_error_free (internal_error);
internal_error = NULL; internal_error = NULL;
@ -200,14 +192,6 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
internal_format, internal_format,
&internal_error)); &internal_error));
if (cogl_error_matches (internal_error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY))
{
_cogl_propagate_error (error, internal_error);
return NULL;
}
if (!tex) if (!tex)
{ {
cogl_error_free (internal_error); cogl_error_free (internal_error);