diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c index 070be8d0e..2f98e275a 100644 --- a/cogl/cogl-feature-private.c +++ b/cogl/cogl-feature-private.c @@ -84,8 +84,8 @@ _cogl_feature_check (const CoglFeatureData *data, namespace, namespace_len); g_string_append_c (full_extension_name, '_'); g_string_append (full_extension_name, extension); - if (!cogl_check_extension (full_extension_name->str, - extensions_string)) + if (!_cogl_check_extension (full_extension_name->str, + extensions_string)) break; } diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h index 2645f7e87..61de4fe5a 100644 --- a/cogl/cogl-internal.h +++ b/cogl/cogl-internal.h @@ -98,6 +98,7 @@ const gchar *cogl_gl_error_to_string (GLenum error_code); #define COGL_ENABLE_BACKFACE_CULLING (1<<5) void _cogl_features_init (void); + gint _cogl_get_format_bpp (CoglPixelFormat format); void cogl_enable (gulong flags); diff --git a/cogl/cogl.c b/cogl/cogl.c index e66f997ed..15812b924 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -112,6 +112,38 @@ cogl_get_proc_address (const gchar* name) return NULL; } +gboolean +_cogl_check_extension (const gchar *name, const gchar *ext) +{ + gchar *end; + gint name_len, n; + + if (name == NULL || ext == NULL) + return FALSE; + + end = (gchar*)(ext + strlen(ext)); + + name_len = strlen(name); + + while (ext < end) + { + n = strcspn(ext, " "); + + if ((name_len == n) && (!strncmp(name, ext, n))) + return TRUE; + ext += (n + 1); + } + + return FALSE; +} + +/* XXX: This has been deprecated as public API */ +gboolean +cogl_check_extension (const char *name, const char *ext) +{ + return _cogl_check_extension (name, ext); +} + void cogl_clear (const CoglColor *color, gulong buffers) { diff --git a/cogl/cogl.h b/cogl/cogl.h index 284666ff3..1fb5567af 100644 --- a/cogl/cogl.h +++ b/cogl/cogl.h @@ -113,6 +113,8 @@ gboolean cogl_features_available (CoglFeatureFlags features); */ CoglFuncPtr cogl_get_proc_address (const gchar *name); +#ifndef COGL_DISABLE_DEPRECATED + /** * cogl_check_extension: * @name: extension to check for @@ -121,9 +123,15 @@ CoglFuncPtr cogl_get_proc_address (const gchar *name); * Check whether @name occurs in list of extensions in @ext. * * Return value: %TRUE if the extension occurs in the list, %FALSE otherwize. + * + * Deprecated: 1.2: OpenGL is an implementation detail for Cogl and so it's not + * appropriate to expose OpenGL extensions through the Cogl + * API. */ gboolean cogl_check_extension (const gchar *name, - const gchar *ext); + const gchar *ext) G_GNUC_DEPRECATED; + +#endif /* COGL_DISABLE_DEPRECATED */ /** * cogl_get_bitmasks: @@ -1016,6 +1024,7 @@ typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/ COGL_DRIVER_ERROR_INVALID_VERSION } CoglDriverError; +gboolean _cogl_check_extension (const char *name, const char *ext); void _cogl_set_indirect_context (gboolean indirect); void _cogl_set_viewport (int x, int y, int width, int height); gboolean _cogl_check_driver_valid (GError **error); diff --git a/cogl/driver/gl/cogl.c b/cogl/driver/gl/cogl.c index 1e40c5f38..f6a3b5c41 100644 --- a/cogl/driver/gl/cogl.c +++ b/cogl/driver/gl/cogl.c @@ -33,31 +33,6 @@ #include "cogl-context.h" #include "cogl-feature-private.h" -gboolean -cogl_check_extension (const gchar *name, const gchar *ext) -{ - gchar *end; - gint name_len, n; - - if (name == NULL || ext == NULL) - return FALSE; - - end = (gchar*)(ext + strlen(ext)); - - name_len = strlen(name); - - while (ext < end) - { - n = strcspn(ext, " "); - - if ((name_len == n) && (!strncmp(name, ext, n))) - return TRUE; - ext += (n + 1); - } - - return FALSE; -} - #ifdef HAVE_CLUTTER_OSX static gboolean really_enable_npot (void) @@ -142,7 +117,7 @@ _cogl_check_driver_valid (GError **error) /* OpenGL 1.2 is only supported if we have the multitexturing extension */ - if (!cogl_check_extension ("GL_ARB_multitexture", gl_extensions)) + if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions)) { g_set_error (error, COGL_DRIVER_ERROR, @@ -215,7 +190,7 @@ _cogl_features_init (void) gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS); if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) || - cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions)) + _cogl_check_extension ("GL_ARB_texture_non_power_of_two", gl_extensions)) { #ifdef HAVE_CLUTTER_OSX if (really_enable_npot ()) @@ -224,7 +199,7 @@ _cogl_features_init (void) } #ifdef GL_YCBCR_MESA - if (cogl_check_extension ("GL_MESA_ycbcr_texture", gl_extensions)) + if (_cogl_check_extension ("GL_MESA_ycbcr_texture", gl_extensions)) { flags |= COGL_FEATURE_TEXTURE_YUV; } diff --git a/cogl/driver/gles/cogl.c b/cogl/driver/gles/cogl.c index 21d5c268f..cc5f7c180 100644 --- a/cogl/driver/gles/cogl.c +++ b/cogl/driver/gles/cogl.c @@ -32,31 +32,6 @@ #include "cogl-context.h" #include "cogl-feature-private.h" -gboolean -cogl_check_extension (const gchar *name, const gchar *ext) -{ - gchar *end; - gint name_len, n; - - if (name == NULL || ext == NULL) - return FALSE; - - end = (gchar*)(ext + strlen(ext)); - - name_len = strlen(name); - - while (ext < end) - { - n = strcspn(ext, " "); - - if ((name_len == n) && (!strncmp(name, ext, n))) - return TRUE; - ext += (n + 1); - } - - return FALSE; -} - gboolean _cogl_check_driver_valid (GError **error) {