summaryrefslogtreecommitdiff
path: root/cogl/cogl-feature-private.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-05-24 01:38:48 +0100
committerRobert Bragg <robert@linux.intel.com>2011-06-01 20:44:41 +0100
commitbe15bf75e44bcab213e840f26b0347f6eb50f393 (patch)
tree0769569d7ea010c5034f7e0c9086ee29d4397fce /cogl/cogl-feature-private.c
parent32e7c93aff3d1b396bd7c63008212acd63e9eb94 (diff)
downloadcogl-be15bf75e44bcab213e840f26b0347f6eb50f393.tar.gz
Add internal _cogl_get_proc_address
This adds an internal _cogl_get_proc_address that doesn't need a CoglContext. This will enable us to check driver features earlier.
Diffstat (limited to 'cogl/cogl-feature-private.c')
-rw-r--r--cogl/cogl-feature-private.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c
index d3904b48..1b60afd7 100644
--- a/cogl/cogl-feature-private.c
+++ b/cogl/cogl-feature-private.c
@@ -33,7 +33,8 @@
#include "cogl-feature-private.h"
gboolean
-_cogl_feature_check (const char *driver_prefix,
+_cogl_feature_check (const CoglWinsysVtable *winsys,
+ const char *driver_prefix,
const CoglFeatureData *data,
unsigned int gl_major,
unsigned int gl_minor,
@@ -44,8 +45,6 @@ _cogl_feature_check (const char *driver_prefix,
const char *suffix = NULL;
int func_num;
- _COGL_GET_CONTEXT (ctx, FALSE);
-
/* First check whether the functions should be directly provided by
GL */
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor,
@@ -107,7 +106,7 @@ _cogl_feature_check (const char *driver_prefix,
/* If we couldn't find anything that provides the functions then
give up */
if (suffix == NULL)
- return FALSE;
+ goto error;
/* Try to get all of the entry points */
for (func_num = 0; data->functions[func_num].name; func_num++)
@@ -117,28 +116,26 @@ _cogl_feature_check (const char *driver_prefix,
full_function_name = g_strconcat (data->functions[func_num].name,
suffix, NULL);
- func = cogl_get_proc_address (full_function_name);
+ func = _cogl_get_proc_address (winsys, full_function_name);
g_free (full_function_name);
if (func == NULL)
- break;
+ goto error;
/* Set the function pointer in the context */
*(void **) ((guint8 *) function_table +
data->functions[func_num].pointer_offset) = func;
}
- /* If one of the functions wasn't found then we should set all of
- the function pointers back to NULL so that the rest of Cogl can
- safely do feature testing by just looking at the function
- pointers */
- if (data->functions[func_num].name)
- {
- while (func_num-- > 0)
- *(void **) ((guint8 *) ctx +
- data->functions[func_num].pointer_offset) = NULL;
- return FALSE;
- }
- else
- return TRUE;
+ return TRUE;
+
+ /* If the extension isn't found or one of the functions wasn't found
+ * then set all of the functions pointers to NULL so Cogl can safely
+ * do feature testing by just looking at the function pointers */
+error:
+ for (func_num = 0; data->functions[func_num].name; func_num++)
+ *(void **) ((guint8 *) function_table +
+ data->functions[func_num].pointer_offset) = NULL;
+
+ return FALSE;
}