mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
abd6832dd9
* clutter/clutter-actor.c: * clutter/clutter-backend.c: * clutter/clutter-behaviour-depth.c: * clutter/clutter-box.c: * clutter/clutter-clone-texture.c: * clutter/clutter-container.c: * clutter/clutter-entry.c: * clutter/clutter-feature.c: * clutter/clutter-fixed.c: * clutter/clutter-group.c: * clutter/clutter-hbox.c: * clutter/clutter-label.c: * clutter/clutter-layout.c: * clutter/clutter-media.c: * clutter/clutter-rectangle.c: * clutter/clutter-score.c: * clutter/clutter-script.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: * clutter/clutter-timeline.c: * clutter/clutter-timeout-pool.c: * clutter/clutter-vbox.c: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: * clutter/eglnative/clutter-backend-egl.c: * clutter/eglnative/clutter-event-egl.c: * clutter/eglnative/clutter-stage-egl.c: * clutter/eglx/clutter-backend-egl.c: * clutter/eglx/clutter-event-egl.c: * clutter/eglx/clutter-stage-egl.c: * clutter/glx/clutter-event-glx.c: * clutter/json/json-array.c: * clutter/json/json-generator.c: * clutter/json/json-node.c: * clutter/json/json-object.c: * clutter/json/json-parser.c: * clutter/sdl/clutter-backend-sdl.c: * clutter/sdl/clutter-event-sdl.c: * clutter/sdl/clutter-stage-sdl.c: Fixedup config.h inclusion (must always be bracketed with #ifdef HAVE_CONFIG_H).
118 lines
2.7 KiB
C
118 lines
2.7 KiB
C
/*
|
|
* Clutter.
|
|
*
|
|
* An OpenGL based 'interactive canvas' library.
|
|
*
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
*
|
|
* Copyright (C) 2006 OpenedHand
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
/**
|
|
* SECTION:clutter-feature
|
|
* @short_description: Query GL features at runtime
|
|
*
|
|
* Functions to query available GL features ay runtime
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
|
|
#include "clutter-feature.h"
|
|
#include "clutter-main.h"
|
|
#include "clutter-private.h"
|
|
#include "clutter-debug.h"
|
|
|
|
#include "cogl.h"
|
|
|
|
typedef struct ClutterFeatures
|
|
{
|
|
ClutterFeatureFlags flags;
|
|
guint features_set : 1;
|
|
} ClutterFeatures;
|
|
|
|
static ClutterFeatures* __features = NULL;
|
|
|
|
void
|
|
_clutter_feature_init (void)
|
|
{
|
|
ClutterMainContext *context;
|
|
|
|
CLUTTER_NOTE (MISC, "checking features");
|
|
|
|
if (!__features)
|
|
{
|
|
CLUTTER_NOTE (MISC, "allocating features data");
|
|
__features = g_new0 (ClutterFeatures, 1);
|
|
__features->features_set = FALSE; /* don't rely on zero-ing */
|
|
}
|
|
|
|
if (__features->features_set)
|
|
return;
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
__features->flags = cogl_get_features()
|
|
|_clutter_backend_get_features (context->backend);
|
|
|
|
__features->features_set = TRUE;
|
|
|
|
CLUTTER_NOTE (MISC, "features checked");
|
|
}
|
|
|
|
/**
|
|
* clutter_feature_available:
|
|
* @feature: a #ClutterFeatureFlags
|
|
*
|
|
* Checks whether @feature is available. @feature can be a logical
|
|
* OR of #ClutterFeatureFlags.
|
|
*
|
|
* Return value: %TRUE if a feature is available
|
|
*
|
|
* Since: 0.1.1
|
|
*/
|
|
gboolean
|
|
clutter_feature_available (ClutterFeatureFlags feature)
|
|
{
|
|
if (G_UNLIKELY (!__features))
|
|
return FALSE;
|
|
|
|
return (__features->flags & feature);
|
|
}
|
|
|
|
/**
|
|
* clutter_feature_get_all:
|
|
*
|
|
* Returns all the supported features.
|
|
*
|
|
* Return value: a logical OR of all the supported features.
|
|
*
|
|
* Since: 0.1.1
|
|
*/
|
|
ClutterFeatureFlags
|
|
clutter_feature_get_all (void)
|
|
{
|
|
return __features->flags;
|
|
}
|
|
|