From c2faaa4f39d3ad69523e806bffe4651545c0bdea Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 9 Mar 2010 16:37:52 -0800 Subject: [PATCH] cogl-texture-2d: Determine format before checking texture support When entering cogl_texture_2d_new_from_bitmap the internal format can be COGL_PIXEL_FORMAT_ANY. This was causing _cogl_texture_2d_can_create to use an invalid GL format type. Mesa apparently ignores this but it was causing errors when Cogl is compiled with debugging under NVidia. http://bugzilla.openedhand.com/show_bug.cgi?id=2026 --- clutter/cogl/cogl/cogl-texture-2d.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clutter/cogl/cogl/cogl-texture-2d.c b/clutter/cogl/cogl/cogl-texture-2d.c index b5bbbdf1f..f1ab08023 100644 --- a/clutter/cogl/cogl/cogl-texture-2d.c +++ b/clutter/cogl/cogl/cogl-texture-2d.c @@ -286,6 +286,9 @@ _cogl_texture_2d_new_from_bitmap (CoglHandle bmp_handle, g_return_val_if_fail (bmp_handle != COGL_INVALID_HANDLE, COGL_INVALID_HANDLE); + internal_format = _cogl_texture_determine_internal_format (bmp->format, + internal_format); + if (!_cogl_texture_2d_can_create (bmp->width, bmp->height, internal_format)) return COGL_INVALID_HANDLE;