2006-07-24 17:15:19 -04:00
|
|
|
/*
|
|
|
|
* 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: functions to query available GL features ay runtime
|
|
|
|
*
|
|
|
|
* Functions to query available GL features ay runtime
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2006-11-15 16:19:01 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 16:27:53 -05:00
|
|
|
|
|
|
|
#include "clutter-feature.h"
|
|
|
|
#include "clutter-main.h"
|
|
|
|
#include "clutter-private.h"
|
|
|
|
#include "clutter-debug.h"
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-16 05:08:30 -04:00
|
|
|
#include "cogl.h"
|
2006-11-15 16:19:01 -05:00
|
|
|
|
|
|
|
typedef struct ClutterFeatures
|
|
|
|
{
|
|
|
|
ClutterFeatureFlags flags;
|
2006-12-04 14:19:53 -05:00
|
|
|
guint features_set : 1;
|
2006-11-15 16:19:01 -05:00
|
|
|
} ClutterFeatures;
|
|
|
|
|
|
|
|
static ClutterFeatures* __features = NULL;
|
2006-12-04 14:19:53 -05:00
|
|
|
G_LOCK_DEFINE_STATIC (__features);
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-16 05:08:30 -04:00
|
|
|
void
|
|
|
|
_clutter_feature_init (void)
|
2006-07-24 17:15:19 -04:00
|
|
|
{
|
2007-05-16 05:08:30 -04:00
|
|
|
ClutterMainContext *context;
|
2006-12-04 14:19:53 -05:00
|
|
|
|
|
|
|
CLUTTER_NOTE (MISC, "checking features");
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2006-12-04 14:19:53 -05:00
|
|
|
if (!__features)
|
2006-07-27 13:10:33 -04:00
|
|
|
{
|
2006-12-04 14:19:53 -05:00
|
|
|
CLUTTER_NOTE (MISC, "allocating features data");
|
|
|
|
__features = g_new0 (ClutterFeatures, 1);
|
|
|
|
__features->features_set = FALSE; /* don't rely on zero-ing */
|
2006-07-27 13:10:33 -04:00
|
|
|
}
|
2006-07-24 17:15:19 -04:00
|
|
|
|
2006-12-04 14:19:53 -05:00
|
|
|
if (__features->features_set)
|
|
|
|
return;
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-16 05:08:30 -04:00
|
|
|
context = clutter_context_get_default ();
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-16 05:08:30 -04:00
|
|
|
__features->flags = cogl_get_features()
|
|
|
|
|_clutter_backend_get_features (context->backend);
|
2006-12-04 14:19:53 -05:00
|
|
|
|
|
|
|
__features->features_set = TRUE;
|
|
|
|
|
2007-05-16 05:08:30 -04:00
|
|
|
CLUTTER_NOTE (MISC, "features checked");
|
2006-07-27 12:09:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
2007-05-16 11:00:41 -04:00
|
|
|
if (G_UNLIKELY (!__features))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return (__features->flags & feature);
|
2006-07-27 12:09:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-11-15 18:37:53 -05:00
|
|
|
* clutter_feature_get_all:
|
2006-07-27 12:09:25 -04:00
|
|
|
*
|
2006-12-04 14:19:53 -05:00
|
|
|
* Returns all the supported features.
|
2006-07-27 12:09:25 -04:00
|
|
|
*
|
|
|
|
* Return value: a logical OR of all the supported features.
|
|
|
|
*
|
|
|
|
* Since: 0.1.1
|
|
|
|
*/
|
|
|
|
ClutterFeatureFlags
|
2006-11-15 18:37:53 -05:00
|
|
|
clutter_feature_get_all (void)
|
2006-07-27 12:09:25 -04:00
|
|
|
{
|
2006-11-15 16:19:01 -05:00
|
|
|
return __features->flags;
|
|
|
|
}
|
|
|
|
|