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>
This commit is contained in:
parent
beebbfc625
commit
ad9db72f74
@ -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 >*/
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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->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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user