[Cogl] Out of graphics memory resizing or packing atlas

Robert Bragg robert at sixbynine.org
Mon Oct 29 12:34:15 PDT 2012


Thanks Roy.

If you're interested, you can also take a look at the branch I started
called wip/out-of-memory-checks though things are a bit different in
master compared to the 1.x branches you are currently using.

kind regards,
- Robert

On Mon, Oct 29, 2012 at 7:26 PM, Roy Amodeo <roy.amodeo at gmail.com> wrote:
> Hi Robert,
>
> I just wanted to thank you again for your quick response.
>
> I also thought I'd share the workaround that we used to move forward. At
> best it's only part of the solution, but it was enough for us to recover
> somewhat gracefully.
>
> The patch was generated from commit 13861b710fc2e78e9f3c6042967817d5da7df9a0
> (tag: 1.10.4).
>
> ---
>  cogl/cogl-texture-2d.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
> index dad1eac..0d7662c 100644
> --- a/cogl/cogl-texture-2d.c
> +++ b/cogl/cogl-texture-2d.c
> @@ -178,6 +178,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
>    GLenum                 gl_intformat;
>    GLenum                 gl_format;
>    GLenum                 gl_type;
> +  GLenum                 gl_err;
>
>    /* Since no data, we need some internal format */
>    if (internal_format == COGL_PIXEL_FORMAT_ANY)
> @@ -207,6 +208,19 @@ cogl_texture_2d_new_with_size (CoglContext *ctx,
>    GE( ctx, glTexImage2D (GL_TEXTURE_2D, 0, gl_intformat,
>                           width, height, 0, gl_format, gl_type, NULL) );
>
> +  while ((gl_err = (ctx)->glGetError ()) != GL_NO_ERROR)
> +    {
> +      g_warning ("%s: GL error creating 2d texture (%d)\n",
> +                 G_STRLOC,
> +                 gl_err);
> +      if (tex_2d != NULL) {
> +           _cogl_texture_2d_free (tex_2d);
> +           tex_2d = NULL;
> +      }
> +    }
> +  if (tex_2d == NULL) {
> +      return NULL;
> +  }
>    return _cogl_texture_2d_handle_new (tex_2d);
>  }
>
> --
> 1.7.3.2
>
>
>
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
>


More information about the Cogl mailing list