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 b898f0e227
commit 8c9472bc4c
8 changed files with 54 additions and 61 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)
{

View File

@ -307,7 +307,7 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
* no effect.
*/
if (!check_vblank_env ("dri") &&
cogl_check_extension ("GLX_SGI_swap_control", glx_extensions))
_cogl_check_extension ("GLX_SGI_swap_control", glx_extensions))
{
backend_glx->swap_interval =
(SwapIntervalProc) cogl_get_proc_address ("glXSwapIntervalSGI");
@ -332,7 +332,7 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
* we wait for glXSwapBuffers to complete, and instead we get an X
* event notifying us of completion... */
if (!(clutter_debug_flags & CLUTTER_DEBUG_DISABLE_SWAP_EVENTS) &&
cogl_check_extension ("GLX_INTEL_swap_event", glx_extensions) &&
_cogl_check_extension ("GLX_INTEL_swap_event", glx_extensions) &&
flags & CLUTTER_FEATURE_SYNC_TO_VBLANK)
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
#endif /* GLX_INTEL_swap_event */
@ -340,7 +340,7 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
if (!check_vblank_env ("dri") &&
!(flags & CLUTTER_FEATURE_SYNC_TO_VBLANK) &&
cogl_check_extension ("GLX_SGI_video_sync", glx_extensions))
_cogl_check_extension ("GLX_SGI_video_sync", glx_extensions))
{
CLUTTER_NOTE (BACKEND, "attempting glXGetVideoSyncSGI vblank setup");

View File

@ -198,7 +198,8 @@ clutter_glx_texture_pixmap_init (ClutterGLXTexturePixmap *self)
clutter_x11_get_default_screen ());
/* Check for the texture from pixmap extension */
if (cogl_check_extension ("GLX_EXT_texture_from_pixmap", glx_extensions))
if (_cogl_check_extension ("GLX_EXT_texture_from_pixmap",
glx_extensions))
{
_gl_bind_tex_image =
(BindTexImage)cogl_get_proc_address ("glXBindTexImageEXT");
@ -213,7 +214,7 @@ clutter_glx_texture_pixmap_init (ClutterGLXTexturePixmap *self)
(GenerateMipmap)cogl_get_proc_address ("glGenerateMipmapEXT");
gl_extensions = (char *) glGetString (GL_EXTENSIONS);
_have_tex_rectangle = cogl_check_extension ("GL_ARB_texture_rectangle",
_have_tex_rectangle = _cogl_check_extension ("GL_ARB_texture_rectangle",
gl_extensions);
if ((rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))