summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert.bragg@intel.com>2014-03-14 15:06:39 +0000
committerRobert Bragg <robert.bragg@intel.com>2014-03-20 17:34:04 +0000
commitad9db72f7410da6888d15232d1644d3f676831fe (patch)
treeb62ab3301f2bb2645bd363bf2c994e47b2ecc1e9
parentbeebbfc625a0e8065ea776cfff81a9a90516bda1 (diff)
Expose COGL_FEATURE_ID_BUFFER_AGE feature id
This adds a new COGL_FEATURE_ID_BUFFER_AGE feature id that can be used to determine if cogl_onscreen_get_buffer_age() will ever return an age other than 0. This should be used instead of querying the winsys feature via cogl_clutter_winsys_has_feature(). Reviewed-by: Neil Roberts <neil@linux.intel.com>
-rw-r--r--cogl/cogl-context.h4
-rw-r--r--cogl/cogl-onscreen.h5
-rw-r--r--cogl/winsys/cogl-winsys-egl.c9
-rw-r--r--cogl/winsys/cogl-winsys-glx.c3
4 files changed, 18 insertions, 3 deletions
diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h
index 3fd03ee0..f7cd2e8a 100644
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -234,6 +234,9 @@ cogl_is_context (void *object);
* @COGL_FEATURE_ID_SWAP_BUFFERS_EVENT:
* Available if the window system supports reporting an event
* for swap buffer completions.
+ * @COGL_FEATURE_ID_BUFFER_AGE: Available if the age of #CoglOnscreen back
+ * buffers are tracked and so cogl_onscreen_get_buffer_age() can be
+ * expected to return age values other than 0.
* @COGL_FEATURE_ID_GLES2_CONTEXT: Whether creating new GLES2 contexts is
* suported.
* @COGL_FEATURE_ID_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering
@@ -273,6 +276,7 @@ typedef enum _CoglFeatureID
COGL_FEATURE_ID_FENCE,
COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
COGL_FEATURE_ID_TEXTURE_RG,
+ COGL_FEATURE_ID_BUFFER_AGE,
/*< private >*/
_COGL_N_FEATURE_IDS /*< skip >*/
diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h
index 40166d1a..867d6f42 100644
--- a/cogl/cogl-onscreen.h
+++ b/cogl/cogl-onscreen.h
@@ -390,6 +390,11 @@ cogl_onscreen_swap_buffers (CoglOnscreen *onscreen);
* of back buffers then this function will always return 0 which
* implies that the contents are undefined.</note>
*
+ * <note>The %COGL_FEATURE_ID_BUFFER_AGE feature can optionally be
+ * explicitly checked to determine if Cogl is currently tracking the
+ * age of #CoglOnscreen back buffer contents. If this feature is
+ * missing then this function will always return 0.</note>
+ *
* Return value: The age of the buffer contents or 0 when the buffer
* contents are undefined.
*
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 2bb5e2b7..fbdadfb1 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -515,9 +515,12 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_FENCE, TRUE);
if (egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_BUFFER_AGE)
- COGL_FLAGS_SET (context->winsys_features,
- COGL_WINSYS_FEATURE_BUFFER_AGE,
- TRUE);
+ {
+ COGL_FLAGS_SET (context->winsys_features,
+ COGL_WINSYS_FEATURE_BUFFER_AGE,
+ TRUE);
+ COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE);
+ }
/* NB: We currently only support creating standalone GLES2 contexts
* for offscreen rendering and so we need a dummy (non-visible)
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index e6441c23..2b135be8 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -873,6 +873,9 @@ update_winsys_features (CoglContext *context, CoglError **error)
COGL_PRIVATE_FEATURE_DIRTY_EVENTS,
TRUE);
+ if (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE))
+ COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE);
+
return TRUE;
}