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

Robert Bragg robert at sixbynine.org
Thu Jun 13 11:38:00 PDT 2013


Yeah, this makes sense and looks good to land to me:

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

thanks,
- Robert


On Thu, Jun 13, 2013 at 5:27 PM, Neil Roberts <neil at linux.intel.com> wrote:
> 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
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list