mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
b499696d83
This uses actor paint volumes to perform culling during clutter_actor_paint. When performing a clipped redraw (because only a few localized actors changed) then as we traverse the scenegraph painting the actors we can now ignore actors that don't intersect the clip region. Early testing shows this can have a big performance benefit; e.g. 100% fps improvement for test-state with culling enabled and we hope that there are even much more compelling examples than that in the real world, Most Clutter applications are 2Dish interfaces and have quite a lot of actors that get continuously painted when anything is animated. The dynamic actors are often localized to an area of user focus though so with culling we can completely avoid painting any of the static actors outside the current clip region. Obviously the cost of culling has to be offset against the cost of painting to determine if it's a win, but our (limited) testing suggests it should be a win for most applications. Note: we hope we will be able to also bring another performance bump from culling with another iteration - hopefully in the 1.6 cycle - to avoid doing the culling in screen space and instead do it in the stage's model space. This will hopefully let us minimize the cost of transforming the actor volumes for culling.
116 lines
4.7 KiB
C
116 lines
4.7 KiB
C
#ifndef __CLUTTER_DEBUG_H__
|
|
#define __CLUTTER_DEBUG_H__
|
|
|
|
#include <glib.h>
|
|
#include "clutter-main.h"
|
|
#include "clutter-profile.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
typedef enum {
|
|
CLUTTER_DEBUG_MISC = 1 << 0,
|
|
CLUTTER_DEBUG_ACTOR = 1 << 1,
|
|
CLUTTER_DEBUG_TEXTURE = 1 << 2,
|
|
CLUTTER_DEBUG_EVENT = 1 << 3,
|
|
CLUTTER_DEBUG_PAINT = 1 << 4,
|
|
CLUTTER_DEBUG_GL = 1 << 5,
|
|
CLUTTER_DEBUG_ALPHA = 1 << 6,
|
|
CLUTTER_DEBUG_BEHAVIOUR = 1 << 7,
|
|
CLUTTER_DEBUG_PANGO = 1 << 8,
|
|
CLUTTER_DEBUG_BACKEND = 1 << 9,
|
|
CLUTTER_DEBUG_SCHEDULER = 1 << 10,
|
|
CLUTTER_DEBUG_SCRIPT = 1 << 11,
|
|
CLUTTER_DEBUG_SHADER = 1 << 12,
|
|
CLUTTER_DEBUG_MULTISTAGE = 1 << 13,
|
|
CLUTTER_DEBUG_ANIMATION = 1 << 14,
|
|
CLUTTER_DEBUG_LAYOUT = 1 << 15,
|
|
CLUTTER_DEBUG_PICK = 1 << 16
|
|
} ClutterDebugFlag;
|
|
|
|
typedef enum {
|
|
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
|
|
CLUTTER_DEBUG_DUMP_PICK_BUFFERS = 1 << 1
|
|
} ClutterPickDebugFlag;
|
|
|
|
typedef enum {
|
|
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
|
|
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
|
|
CLUTTER_DEBUG_REDRAWS = 1 << 2,
|
|
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
|
|
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4
|
|
} ClutterDrawDebugFlag;
|
|
|
|
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
|
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)
|
|
|
|
#ifdef __GNUC__
|
|
|
|
/* Try the GCC extension for valists in macros */
|
|
#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \
|
|
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
|
|
{ _clutter_profile_trace_message ("[" #type "] " \
|
|
G_STRLOC " & " x, ##a); } \
|
|
} G_STMT_END
|
|
|
|
#define CLUTTER_TIMESTAMP(type,x,a...) G_STMT_START { \
|
|
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
|
|
{ g_message ("[" #type "]" " %li:" G_STRLOC ": " \
|
|
x, clutter_get_timestamp(), ##a); } \
|
|
} G_STMT_END
|
|
#else /* !__GNUC__ */
|
|
/* Try the C99 version; unfortunately, this does not allow us to pass
|
|
* empty arguments to the macro, which means we have to
|
|
* do an intemediate printf.
|
|
*/
|
|
#define CLUTTER_NOTE(type,...) G_STMT_START { \
|
|
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
|
|
{ \
|
|
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
|
_clutter_profile_trace_message ("[" #type "] " \
|
|
G_STRLOC " & %s",_fmt); \
|
|
g_free (_fmt); \
|
|
} \
|
|
} G_STMT_END
|
|
|
|
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { \
|
|
if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \
|
|
{ \
|
|
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
|
|
g_message ("[" #type "]" " %li:" G_STRLOC ": %s", \
|
|
clutter_get_timestamp(), _fmt); \
|
|
g_free (_fmt); \
|
|
} \
|
|
} G_STMT_END
|
|
#endif
|
|
|
|
#define CLUTTER_MARK() CLUTTER_NOTE(MISC, "== mark ==")
|
|
#define CLUTTER_DBG(x) { a }
|
|
|
|
#define CLUTTER_GLERR() G_STMT_START { \
|
|
if (clutter_debug_flags & CLUTTER_DEBUG_GL) { \
|
|
GLenum _err = glGetError (); /* roundtrip */ \
|
|
if (_err != GL_NO_ERROR) \
|
|
g_warning (G_STRLOC ": GL Error %x", _err); \
|
|
} } G_STMT_END
|
|
|
|
|
|
#else /* !CLUTTER_ENABLE_DEBUG */
|
|
|
|
#define CLUTTER_NOTE(type,...) G_STMT_START { } G_STMT_END
|
|
#define CLUTTER_MARK() G_STMT_START { } G_STMT_END
|
|
#define CLUTTER_DBG(x) G_STMT_START { } G_STMT_END
|
|
#define CLUTTER_GLERR() G_STMT_START { } G_STMT_END
|
|
#define CLUTTER_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END
|
|
#define CLUTTER_HAS_DEBUG(type) FALSE
|
|
|
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
|
|
|
extern guint clutter_debug_flags;
|
|
extern guint clutter_pick_debug_flags;
|
|
extern guint clutter_paint_debug_flags;
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __CLUTTER_DEBUG_H__ */
|