cogl-info: print out the chosen renderer name

This updates cogl-info to use cogl_renderer_get_winsys_id() so it can
print out the name of the chosen renderer winsys.
This commit is contained in:
Robert Bragg 2012-01-13 16:46:07 +00:00
parent 50d1285ba1
commit 7d38d9bdf2

View File

@ -106,6 +106,37 @@ struct {
}
};
static const char *
get_winsys_name_for_id (CoglWinsysID winsys_id)
{
switch (winsys_id)
{
case COGL_WINSYS_ID_ANY:
g_return_val_if_reached ("ERROR");
case COGL_WINSYS_ID_STUB:
return "Stub";
case COGL_WINSYS_ID_GLX:
return "GLX";
case COGL_WINSYS_ID_EGL_XLIB:
return "EGL + Xlib platform";
case COGL_WINSYS_ID_EGL_NULL:
return "EGL + NULL window system platform";
case COGL_WINSYS_ID_EGL_GDL:
return "EGL + GDL platform";
case COGL_WINSYS_ID_EGL_WAYLAND:
return "EGL + Wayland platform";
case COGL_WINSYS_ID_EGL_KMS:
return "EGL + KMS platform";
case COGL_WINSYS_ID_EGL_ANDROID:
return "EGL + Android platform";
case COGL_WINSYS_ID_WGL:
return "EGL + Windows WGL platform";
case COGL_WINSYS_ID_SDL:
return "EGL + SDL platform";
}
g_return_val_if_reached ("Unknown");
}
static void
feature_cb (CoglFeatureID feature, void *user_data)
{
@ -124,8 +155,12 @@ feature_cb (CoglFeatureID feature, void *user_data)
int
main (int argc, char **argv)
{
CoglRenderer *renderer;
CoglDisplay *display;
CoglContext *ctx;
GError *error = NULL;
CoglWinsysID winsys_id;
const char *winsys_name;
ctx = cogl_context_new (NULL, &error);
if (!ctx) {
@ -133,6 +168,12 @@ main (int argc, char **argv)
return 1;
}
display = cogl_context_get_display (ctx);
renderer = cogl_display_get_renderer (display);
winsys_id = cogl_renderer_get_winsys_id (renderer);
winsys_name = get_winsys_name_for_id (winsys_id);
g_print ("Renderer: %s\n\n", winsys_name);
g_print ("Features:\n");
cogl_foreach_feature (ctx, feature_cb, NULL);