cogl: deprecates cogl_check_extension

OpenGL is an implementation detail for Cogl so it's not appropriate to
expose OpenGL extensions through the Cogl API.

Note: Clutter is currently still using this API, because it is still
doing raw GL calls in ClutterGLXTexturePixmap, so this introduces a
couple of (legitimate) build warnings while compiling Clutter.
This commit is contained in:
Robert Bragg 2010-02-05 16:32:19 +00:00
parent f74f4bdc2b
commit 10fa7c7ce9
6 changed files with 48 additions and 56 deletions

View File

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

View File

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

View File

@ -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)
{

View File

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

View File

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

View File

@ -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)
{