[Cogl] [PATCH] Don't handle the out-of-memory error specially for auto-textures

Neil Roberts neil at linux.intel.com
Thu Jun 13 09:27:40 PDT 2013


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.
---
 cogl/cogl-auto-texture.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/cogl/cogl-auto-texture.c b/cogl/cogl-auto-texture.c
index 6df3fc2..402cfb9 100644
--- a/cogl/cogl-auto-texture.c
+++ b/cogl/cogl-auto-texture.c
@@ -152,14 +152,6 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
                                                         &internal_error)))
     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);
   internal_error = NULL;
 
@@ -173,14 +165,6 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
                                                            internal_format,
                                                            &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)
         {
           cogl_error_free (internal_error);
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list