From cbbac5a2f5e4a15c7207b70066ba0162ca9b967d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Mon, 19 Dec 2011 19:22:58 +0000 Subject: [PATCH] Add a feature ID for the swap event notification Previously the swap event notification feature was only accessible as a winsys feature using the semi-internal cogl_clutter_winsys_has_feature. This just adds a feature ID for it so it can also be accessed via cogl_has_feature. Reviewed-by: Robert Bragg --- cogl/cogl.h | 5 ++++- cogl/winsys/cogl-winsys-glx.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cogl/cogl.h b/cogl/cogl.h index 4ac29ac6d..ff03b2251 100644 --- a/cogl/cogl.h +++ b/cogl/cogl.h @@ -204,7 +204,9 @@ cogl_features_available (CoglFeatureFlags features); * supported with CoglBufferAccess including write support. * @COGL_FEATURE_ID_MIRRORED_REPEAT: Whether * %COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT is supported. - * + * @COGL_FEATURE_ID_SWAP_BUFFERS_EVENT: + * Available if the window system supports reporting an event + * for swap buffer completions. * * All the capabilities that can vary between different GPUs supported * by Cogl. Applications that depend on any of these features should explicitly @@ -231,6 +233,7 @@ typedef enum _CoglFeatureID COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, COGL_FEATURE_ID_MIRRORED_REPEAT, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, /*< private > */ _COGL_N_FEATURE_IDS diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index 113d4d965..ccc746af2 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/winsys/cogl-winsys-glx.c @@ -438,6 +438,11 @@ update_winsys_features (CoglContext *context, GError **error) COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_REGION_THROTTLE, TRUE); + if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT)) + COGL_FLAGS_SET (context->features, + COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, + TRUE); + return TRUE; }