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:
parent
b898f0e227
commit
8c9472bc4c
@ -84,7 +84,7 @@ _cogl_feature_check (const CoglFeatureData *data,
|
|||||||
namespace, namespace_len);
|
namespace, namespace_len);
|
||||||
g_string_append_c (full_extension_name, '_');
|
g_string_append_c (full_extension_name, '_');
|
||||||
g_string_append (full_extension_name, extension);
|
g_string_append (full_extension_name, extension);
|
||||||
if (!cogl_check_extension (full_extension_name->str,
|
if (!_cogl_check_extension (full_extension_name->str,
|
||||||
extensions_string))
|
extensions_string))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ const gchar *cogl_gl_error_to_string (GLenum error_code);
|
|||||||
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
#define COGL_ENABLE_BACKFACE_CULLING (1<<5)
|
||||||
|
|
||||||
void _cogl_features_init (void);
|
void _cogl_features_init (void);
|
||||||
|
|
||||||
gint _cogl_get_format_bpp (CoglPixelFormat format);
|
gint _cogl_get_format_bpp (CoglPixelFormat format);
|
||||||
|
|
||||||
void cogl_enable (gulong flags);
|
void cogl_enable (gulong flags);
|
||||||
|
@ -112,6 +112,38 @@ cogl_get_proc_address (const gchar* name)
|
|||||||
return NULL;
|
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
|
void
|
||||||
cogl_clear (const CoglColor *color, gulong buffers)
|
cogl_clear (const CoglColor *color, gulong buffers)
|
||||||
{
|
{
|
||||||
|
@ -113,6 +113,8 @@ gboolean cogl_features_available (CoglFeatureFlags features);
|
|||||||
*/
|
*/
|
||||||
CoglFuncPtr cogl_get_proc_address (const gchar *name);
|
CoglFuncPtr cogl_get_proc_address (const gchar *name);
|
||||||
|
|
||||||
|
#ifndef COGL_DISABLE_DEPRECATED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_check_extension:
|
* cogl_check_extension:
|
||||||
* @name: extension to check for
|
* @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.
|
* Check whether @name occurs in list of extensions in @ext.
|
||||||
*
|
*
|
||||||
* Return value: %TRUE if the extension occurs in the list, %FALSE otherwize.
|
* 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,
|
gboolean cogl_check_extension (const gchar *name,
|
||||||
const gchar *ext);
|
const gchar *ext) G_GNUC_DEPRECATED;
|
||||||
|
|
||||||
|
#endif /* COGL_DISABLE_DEPRECATED */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_get_bitmasks:
|
* cogl_get_bitmasks:
|
||||||
@ -1016,6 +1024,7 @@ typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/
|
|||||||
COGL_DRIVER_ERROR_INVALID_VERSION
|
COGL_DRIVER_ERROR_INVALID_VERSION
|
||||||
} CoglDriverError;
|
} CoglDriverError;
|
||||||
|
|
||||||
|
gboolean _cogl_check_extension (const char *name, const char *ext);
|
||||||
void _cogl_set_indirect_context (gboolean indirect);
|
void _cogl_set_indirect_context (gboolean indirect);
|
||||||
void _cogl_set_viewport (int x, int y, int width, int height);
|
void _cogl_set_viewport (int x, int y, int width, int height);
|
||||||
gboolean _cogl_check_driver_valid (GError **error);
|
gboolean _cogl_check_driver_valid (GError **error);
|
||||||
|
@ -33,31 +33,6 @@
|
|||||||
#include "cogl-context.h"
|
#include "cogl-context.h"
|
||||||
#include "cogl-feature-private.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
|
#ifdef HAVE_CLUTTER_OSX
|
||||||
static gboolean
|
static gboolean
|
||||||
really_enable_npot (void)
|
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
|
/* OpenGL 1.2 is only supported if we have the multitexturing
|
||||||
extension */
|
extension */
|
||||||
if (!cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
|
if (!_cogl_check_extension ("GL_ARB_multitexture", gl_extensions))
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
COGL_DRIVER_ERROR,
|
COGL_DRIVER_ERROR,
|
||||||
@ -215,7 +190,7 @@ _cogl_features_init (void)
|
|||||||
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
|
||||||
|
|
||||||
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0) ||
|
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
|
#ifdef HAVE_CLUTTER_OSX
|
||||||
if (really_enable_npot ())
|
if (really_enable_npot ())
|
||||||
@ -224,7 +199,7 @@ _cogl_features_init (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GL_YCBCR_MESA
|
#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;
|
flags |= COGL_FEATURE_TEXTURE_YUV;
|
||||||
}
|
}
|
||||||
|
@ -32,31 +32,6 @@
|
|||||||
#include "cogl-context.h"
|
#include "cogl-context.h"
|
||||||
#include "cogl-feature-private.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
|
gboolean
|
||||||
_cogl_check_driver_valid (GError **error)
|
_cogl_check_driver_valid (GError **error)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,7 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
|
|||||||
* no effect.
|
* no effect.
|
||||||
*/
|
*/
|
||||||
if (!check_vblank_env ("dri") &&
|
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 =
|
backend_glx->swap_interval =
|
||||||
(SwapIntervalProc) cogl_get_proc_address ("glXSwapIntervalSGI");
|
(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
|
* we wait for glXSwapBuffers to complete, and instead we get an X
|
||||||
* event notifying us of completion... */
|
* event notifying us of completion... */
|
||||||
if (!(clutter_debug_flags & CLUTTER_DEBUG_DISABLE_SWAP_EVENTS) &&
|
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_SYNC_TO_VBLANK)
|
||||||
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
|
flags |= CLUTTER_FEATURE_SWAP_EVENTS;
|
||||||
#endif /* GLX_INTEL_swap_event */
|
#endif /* GLX_INTEL_swap_event */
|
||||||
@ -340,7 +340,7 @@ clutter_backend_glx_get_features (ClutterBackend *backend)
|
|||||||
|
|
||||||
if (!check_vblank_env ("dri") &&
|
if (!check_vblank_env ("dri") &&
|
||||||
!(flags & CLUTTER_FEATURE_SYNC_TO_VBLANK) &&
|
!(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");
|
CLUTTER_NOTE (BACKEND, "attempting glXGetVideoSyncSGI vblank setup");
|
||||||
|
|
||||||
|
@ -198,7 +198,8 @@ clutter_glx_texture_pixmap_init (ClutterGLXTexturePixmap *self)
|
|||||||
clutter_x11_get_default_screen ());
|
clutter_x11_get_default_screen ());
|
||||||
|
|
||||||
/* Check for the texture from pixmap extension */
|
/* 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 =
|
_gl_bind_tex_image =
|
||||||
(BindTexImage)cogl_get_proc_address ("glXBindTexImageEXT");
|
(BindTexImage)cogl_get_proc_address ("glXBindTexImageEXT");
|
||||||
@ -213,7 +214,7 @@ clutter_glx_texture_pixmap_init (ClutterGLXTexturePixmap *self)
|
|||||||
(GenerateMipmap)cogl_get_proc_address ("glGenerateMipmapEXT");
|
(GenerateMipmap)cogl_get_proc_address ("glGenerateMipmapEXT");
|
||||||
|
|
||||||
gl_extensions = (char *) glGetString (GL_EXTENSIONS);
|
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);
|
gl_extensions);
|
||||||
|
|
||||||
if ((rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
|
if ((rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
|
||||||
|
Loading…
Reference in New Issue
Block a user