mirror of
https://github.com/brl/mutter.git
synced 2025-01-22 17:38:56 +00:00
cogl-context: Add a cogl_get_graphics_reset_status API
If the driver supports the GL_ARB_robustness extension we can expose the graphics reset status this way. https://bugzilla.gnome.org/show_bug.cgi?id=739178
This commit is contained in:
parent
87f9927375
commit
0f2be43af4
@ -76,6 +76,11 @@
|
|||||||
#define GL_NUM_EXTENSIONS 0x821D
|
#define GL_NUM_EXTENSIONS 0x821D
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* This is a relatively new extension */
|
||||||
|
#ifndef GL_PURGED_CONTEXT_RESET_NV
|
||||||
|
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
|
||||||
|
#endif
|
||||||
|
|
||||||
static void _cogl_context_free (CoglContext *context);
|
static void _cogl_context_free (CoglContext *context);
|
||||||
|
|
||||||
COGL_OBJECT_DEFINE (Context, context);
|
COGL_OBJECT_DEFINE (Context, context);
|
||||||
@ -784,3 +789,28 @@ cogl_get_clock_time (CoglContext *context)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoglGraphicsResetStatus
|
||||||
|
cogl_get_graphics_reset_status (CoglContext *context)
|
||||||
|
{
|
||||||
|
if (!context->glGetGraphicsResetStatus)
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_NO_ERROR;
|
||||||
|
|
||||||
|
switch (context->glGetGraphicsResetStatus ())
|
||||||
|
{
|
||||||
|
case GL_GUILTY_CONTEXT_RESET_ARB:
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET;
|
||||||
|
|
||||||
|
case GL_INNOCENT_CONTEXT_RESET_ARB:
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET;
|
||||||
|
|
||||||
|
case GL_UNKNOWN_CONTEXT_RESET_ARB:
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET;
|
||||||
|
|
||||||
|
case GL_PURGED_CONTEXT_RESET_NV:
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return COGL_GRAPHICS_RESET_STATUS_NO_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -373,6 +373,48 @@ cogl_foreach_feature (CoglContext *context,
|
|||||||
int64_t
|
int64_t
|
||||||
cogl_get_clock_time (CoglContext *context);
|
cogl_get_clock_time (CoglContext *context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CoglGraphicsResetStatus:
|
||||||
|
* @COGL_GRAPHICS_RESET_STATUS_NO_ERROR:
|
||||||
|
* @COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET:
|
||||||
|
* @COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET:
|
||||||
|
* @COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET:
|
||||||
|
* @COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET:
|
||||||
|
*
|
||||||
|
* All the error values that might be returned by
|
||||||
|
* cogl_get_graphics_reset_status(). Each value's meaning corresponds
|
||||||
|
* to the similarly named value defined in the ARB_robustness and
|
||||||
|
* NV_robustness_video_memory_purge extensions.
|
||||||
|
*/
|
||||||
|
typedef enum _CoglGraphicsResetStatus
|
||||||
|
{
|
||||||
|
COGL_GRAPHICS_RESET_STATUS_NO_ERROR,
|
||||||
|
COGL_GRAPHICS_RESET_STATUS_GUILTY_CONTEXT_RESET,
|
||||||
|
COGL_GRAPHICS_RESET_STATUS_INNOCENT_CONTEXT_RESET,
|
||||||
|
COGL_GRAPHICS_RESET_STATUS_UNKNOWN_CONTEXT_RESET,
|
||||||
|
COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET,
|
||||||
|
} CoglGraphicsResetStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_get_graphics_reset_status:
|
||||||
|
* @context: a #CoglContext pointer
|
||||||
|
*
|
||||||
|
* Returns the graphics reset status as reported by
|
||||||
|
* GetGraphicsResetStatusARB defined in the ARB_robustness extension.
|
||||||
|
*
|
||||||
|
* Note that Cogl doesn't normally enable the ARB_robustness
|
||||||
|
* extension in which case this will only ever return
|
||||||
|
* #COGL_GRAPHICS_RESET_STATUS_NO_ERROR.
|
||||||
|
*
|
||||||
|
* Applications must explicitly use a backend specific method to
|
||||||
|
* request that errors get reported such as X11's
|
||||||
|
* cogl_xlib_renderer_request_reset_on_video_memory_purge().
|
||||||
|
*
|
||||||
|
* Return value: a #CoglGraphicsResetStatus
|
||||||
|
*/
|
||||||
|
CoglGraphicsResetStatus
|
||||||
|
cogl_get_graphics_reset_status (CoglContext *context);
|
||||||
|
|
||||||
#endif /* COGL_ENABLE_EXPERIMENTAL_API */
|
#endif /* COGL_ENABLE_EXPERIMENTAL_API */
|
||||||
|
|
||||||
COGL_END_DECLS
|
COGL_END_DECLS
|
||||||
|
@ -330,6 +330,7 @@ cogl_get_clock_time
|
|||||||
cogl_get_depth_test_enabled
|
cogl_get_depth_test_enabled
|
||||||
cogl_get_draw_framebuffer
|
cogl_get_draw_framebuffer
|
||||||
cogl_get_features
|
cogl_get_features
|
||||||
|
cogl_get_graphics_reset_status
|
||||||
cogl_get_modelview_matrix
|
cogl_get_modelview_matrix
|
||||||
cogl_get_option_group
|
cogl_get_option_group
|
||||||
cogl_get_proc_address
|
cogl_get_proc_address
|
||||||
|
Loading…
x
Reference in New Issue
Block a user