_clutter_backend_get_features (ClutterBackend *backend)
{
ClutterBackendClass *klass;
+ GError *error;
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), 0);
* GL context first and the ask for features. if the
* context already exists this should be a no-op
*/
+ error = NULL;
if (klass->create_context)
- klass->create_context (backend, NULL);
+ {
+ gboolean res;
+
+ res = klass->create_context (backend, &error);
+ if (!res)
+ {
+ if (error)
+ {
+ g_critical ("Unable to create a context: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ g_critical ("Unable to create a context: unknown error");
+
+ return 0;
+ }
+ }
if (klass->get_features)
return klass->get_features (backend);
return clutter_flags;
}
-void
-_clutter_feature_init (void)
+gboolean
+_clutter_feature_init (GError **error)
{
ClutterMainContext *context;
}
if (__features->features_set)
- return;
+ return TRUE;
context = _clutter_context_get_default ();
/* makes sure we have a GL context; if we have, this is a no-op */
- _clutter_backend_create_context (context->backend, NULL);
+ if (!_clutter_backend_create_context (context->backend, error))
+ return FALSE;
__features->flags = (_clutter_features_from_cogl (cogl_get_features ())
| _clutter_backend_get_features (context->backend));
__features->features_set = TRUE;
CLUTTER_NOTE (MISC, "features checked");
+
+ return TRUE;
}
/**
/* this will take care of initializing Cogl's state and
* query the GL machinery for features
*/
- _clutter_feature_init ();
+ if (!_clutter_feature_init (error))
+ return CLUTTER_INIT_ERROR_BACKEND;
#ifdef CLUTTER_ENABLE_PROFILE
{
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc);
-void _clutter_feature_init (void);
+gboolean _clutter_feature_init (GError **error);
/* Reinjecting queued events for processing */
void _clutter_process_event (ClutterEvent *event);