[Cogl] Out of graphics memory resizing or packing atlas
Roy Amodeo
roy.amodeo at gmail.com
Mon Oct 29 12:26:43 PDT 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/cogl/attachments/20121029/3bd516c6/attachment.html>
More information about the Cogl
mailing list