[cogl/fosdem-2012: 8/20] cogl-info: print out the chosen renderer name
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/fosdem-2012: 8/20] cogl-info: print out the chosen renderer name
- Date: Mon, 16 Jan 2012 13:11:34 +0000 (UTC)
commit 8bda65686f02526a0e3b5352c5ba4623136a4abf
Author: Robert Bragg <robert linux intel com>
Date: Fri Jan 13 16:46:07 2012 +0000
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.
examples/cogl-info.c | 91 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 82 insertions(+), 9 deletions(-)
---
diff --git a/examples/cogl-info.c b/examples/cogl-info.c
index 6279db9..73b1d86 100644
--- a/examples/cogl-info.c
+++ b/examples/cogl-info.c
@@ -106,6 +106,57 @@ struct {
}
};
+struct {
+ CoglWinsysID id;
+ const char *name;
+} winsys_names[] =
+{
+ {
+ COGL_WINSYS_ID_STUB,
+ "Stub"
+ },
+ {
+ COGL_WINSYS_ID_GLX,
+ "GLX"
+ },
+ {
+ COGL_WINSYS_ID_EGL_XLIB,
+ "EGL + Xlib platform"
+ },
+ {
+ COGL_WINSYS_ID_EGL_NULL,
+ "EGL + NULL window system platform"
+ },
+ {
+ COGL_WINSYS_ID_EGL_GDL,
+ "EGL + GDL platform"
+ },
+ {
+ COGL_WINSYS_ID_EGL_WAYLAND,
+ "EGL + Wayland platform"
+ },
+ {
+ COGL_WINSYS_ID_EGL_KMS,
+ "EGL + KMS platform"
+ },
+ {
+ COGL_WINSYS_ID_EGL_ANDROID,
+ "EGL + Android platform"
+ },
+ {
+ COGL_WINSYS_ID_WGL,
+ "EGL + Windows WGL platform"
+ },
+ {
+ COGL_WINSYS_ID_SDL,
+ "EGL + SDL platform"
+ },
+ {
+ 0,
+ NULL
+ }
+};
+
static void
feature_cb (CoglFeatureID feature, void *user_data)
{
@@ -124,17 +175,39 @@ feature_cb (CoglFeatureID feature, void *user_data)
int
main (int argc, char **argv)
{
- CoglContext *ctx;
- GError *error = NULL;
+ CoglRenderer *renderer;
+ CoglDisplay *display;
+ CoglContext *ctx;
+ GError *error = NULL;
+ CoglWinsysID winsys_id;
+ int i;
- ctx = cogl_context_new (NULL, &error);
- if (!ctx) {
- fprintf (stderr, "Failed to create context: %s\n", error->message);
- return 1;
+ ctx = cogl_context_new (NULL, &error);
+ if (!ctx) {
+ fprintf (stderr, "Failed to create context: %s\n", error->message);
+ return 1;
+ }
+
+ display = cogl_context_get_display (ctx);
+ renderer = cogl_display_get_renderer (display);
+ winsys_id = cogl_renderer_get_winsys_id (renderer);
+ for (i = 0; winsys_names[i].name; i++)
+ {
+ if (winsys_names[i].id == winsys_id)
+ {
+ g_print ("Renderer: %s\n\n", winsys_names[i].name);
+ break;
+ }
+ }
+
+ if (!winsys_names[i].name)
+ {
+ g_warning ("cogl-info needs updating: Unknown renderer");
+ g_print ("Renderer: Unknown\n\n");
}
- g_print ("Features:\n");
- cogl_foreach_feature (ctx, feature_cb, NULL);
+ g_print ("Features:\n");
+ cogl_foreach_feature (ctx, feature_cb, NULL);
- return 0;
+ return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]