[gtk/wip/chergert/gdk-macos-gl-renderer] macos: provide GL driver information to debug message
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/gdk-macos-gl-renderer] macos: provide GL driver information to debug message
- Date: Wed, 28 Oct 2020 21:53:07 +0000 (UTC)
commit 96722a9ebcb1861c11691e5d6dff1eb5efacd60f
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 28 14:54:27 2020 -0700
macos: provide GL driver information to debug message
This can be useful to be sure you're using the right renderer to drive
the GL context.
gdk/macos/gdkmacosglcontext.c | 44 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacosglcontext.c b/gdk/macos/gdkmacosglcontext.c
index 9ecef3dafa..fab6cfde42 100644
--- a/gdk/macos/gdkmacosglcontext.c
+++ b/gdk/macos/gdkmacosglcontext.c
@@ -33,6 +33,44 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_DEFINE_TYPE (GdkMacosGLContext, gdk_macos_gl_context, GDK_TYPE_GL_CONTEXT)
+static const char *
+get_renderer_name (GLint id)
+{
+ static char renderer_name[32];
+
+ switch (id & kCGLRendererIDMatchingMask)
+ {
+ case kCGLRendererGenericID: return "Generic";
+ case kCGLRendererGenericFloatID: return "Generic Float";
+ case kCGLRendererAppleSWID: return "Apple Software Renderer";
+ case kCGLRendererATIRage128ID: return "ATI Rage 128";
+ case kCGLRendererATIRadeonID: return "ATI Radeon";
+ case kCGLRendererATIRageProID: return "ATI Rage Pro";
+ case kCGLRendererATIRadeon8500ID: return "ATI Radeon 8500";
+ case kCGLRendererATIRadeon9700ID: return "ATI Radeon 9700";
+ case kCGLRendererATIRadeonX1000ID: return "ATI Radeon X1000";
+ case kCGLRendererATIRadeonX2000ID: return "ATI Radeon X2000";
+ case kCGLRendererATIRadeonX3000ID: return "ATI Radeon X3000";
+ case kCGLRendererATIRadeonX4000ID: return "ATI Radeon X4000";
+ case kCGLRendererGeForce2MXID: return "GeForce 2 MX";
+ case kCGLRendererGeForce3ID: return "GeForce 3";
+ case kCGLRendererGeForceFXID: return "GeForce FX";
+ case kCGLRendererGeForce8xxxID: return "GeForce 8xxx";
+ case kCGLRendererGeForceID: return "GeForce";
+ case kCGLRendererVTBladeXP2ID: return "VT Blade XP 2";
+ case kCGLRendererIntel900ID: return "Intel 900";
+ case kCGLRendererIntelX3100ID: return "Intel X3100";
+ case kCGLRendererIntelHDID: return "Intel HD";
+ case kCGLRendererIntelHD4000ID: return "Intel HD 4000";
+ case kCGLRendererIntelHD5000ID: return "Intel HD 5000";
+ case kCGLRendererMesa3DFXID: return "Mesa 3DFX";
+
+ default:
+ snprintf (renderer_name, sizeof renderer_name, "0x%08x", id & kCGLRendererIDMatchingMask);
+ renderer_name[sizeof renderer_name-1] = 0;
+ return renderer_name;
+ }
+}
static NSOpenGLContext *
get_ns_open_gl_context (GdkMacosGLContext *self,
@@ -199,9 +237,13 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
[gl_context makeCurrentContext];
+ GLint renderer_id = 0;
+ [gl_context getValues:&renderer_id forParameter:NSOpenGLContextParameterCurrentRendererID];
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)),
OPENGL,
- g_message ("Created NSOpenGLContext[%p]", gl_context));
+ g_message ("Created NSOpenGLContext[%p] using %s",
+ gl_context,
+ get_renderer_name (renderer_id)));
self->gl_context = g_steal_pointer (&gl_context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]