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
This commit is contained in:
Neil Roberts 2010-03-09 16:37:52 -08:00
parent 770ca1311d
commit 9fc9aa562e

View File

@ -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;