diff --git a/cogl/cogl/cogl-debug-options.h b/cogl/cogl/cogl-debug-options.h index 8450becd1..f6cda51a2 100644 --- a/cogl/cogl/cogl-debug-options.h +++ b/cogl/cogl/cogl-debug-options.h @@ -184,3 +184,8 @@ OPT (SYNC_FRAME, N_("Call glFinish after rendering each frame, so profilers can measure " "the total render time (as a portion of the stage update time) more " "accurately.")) +OPT (TEXTURES, + N_("Cogl Tracing"), + "textures", + N_("Debug texture management"), + N_("Logs information about texture management")) diff --git a/cogl/cogl/cogl-debug.c b/cogl/cogl/cogl-debug.c index 800f448df..2d2420ffd 100644 --- a/cogl/cogl/cogl-debug.c +++ b/cogl/cogl/cogl-debug.c @@ -62,7 +62,8 @@ static const GDebugKey cogl_log_debug_keys[] = { { "bitmap", COGL_DEBUG_BITMAP }, { "clipping", COGL_DEBUG_CLIPPING }, { "winsys", COGL_DEBUG_WINSYS }, - { "performance", COGL_DEBUG_PERFORMANCE } + { "performance", COGL_DEBUG_PERFORMANCE }, + { "textures", COGL_DEBUG_TEXTURES }, }; static const int n_cogl_log_debug_keys = G_N_ELEMENTS (cogl_log_debug_keys); diff --git a/cogl/cogl/cogl-debug.h b/cogl/cogl/cogl-debug.h index d6bc358b5..09a356edd 100644 --- a/cogl/cogl/cogl-debug.h +++ b/cogl/cogl/cogl-debug.h @@ -73,6 +73,7 @@ typedef enum COGL_DEBUG_PERFORMANCE, COGL_DEBUG_SYNC_PRIMITIVE, COGL_DEBUG_SYNC_FRAME, + COGL_DEBUG_TEXTURES, COGL_DEBUG_N_FLAGS } CoglDebugFlags; diff --git a/cogl/cogl/deprecated/cogl-auto-texture.c b/cogl/cogl/deprecated/cogl-auto-texture.c index ca009ee9a..99431a5c2 100644 --- a/cogl/cogl/deprecated/cogl-auto-texture.c +++ b/cogl/cogl/deprecated/cogl-auto-texture.c @@ -177,7 +177,7 @@ cogl_texture_new_from_data (int width, int rowstride, const uint8_t *data) { - GError *ignore_error = NULL; + g_autoptr (GError) error = NULL; CoglTexture *tex; _COGL_GET_CONTEXT (ctx, NULL); @@ -188,9 +188,17 @@ cogl_texture_new_from_data (int width, format, internal_format, rowstride, data, - &ignore_error); + &error); if (!tex) - g_error_free (ignore_error); + { + COGL_NOTE (TEXTURES, "Failed to create texture with size %dx%d and " + "format %s (internal: %s) from data: %s", + width, height, + cogl_pixel_format_to_string (format), + cogl_pixel_format_to_string (internal_format), + error->message); + return NULL; + } return tex; } @@ -231,6 +239,15 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap, if (!cogl_texture_allocate (tex, &internal_error)) { + COGL_NOTE (TEXTURES, + "Failed to allocate texture from bitmap with size " + "%dx%d and format %s (internal: %s), " + "falling back on slicing: %s", + cogl_bitmap_get_width (bitmap), + cogl_bitmap_get_height (bitmap), + cogl_pixel_format_to_string (cogl_bitmap_get_format (bitmap)), + cogl_pixel_format_to_string (internal_format), + internal_error->message); g_error_free (internal_error); internal_error = NULL; cogl_object_unref (tex); @@ -273,15 +290,20 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap, CoglTextureFlags flags, CoglPixelFormat internal_format) { - GError *ignore_error = NULL; + g_autoptr (GError) error = NULL; + CoglTexture *tex = _cogl_texture_new_from_bitmap (bitmap, flags, internal_format, FALSE, /* can't convert in-place */ - &ignore_error); + &error); if (!tex) - g_error_free (ignore_error); + { + COGL_NOTE (TEXTURES, "Failed to create texture from bitmap: %s", + error->message); + return NULL; + } return tex; }