From 6ed137dc9cb45c9e3165514bc6aab86d94033dba Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 13 Jul 2015 12:35:55 +0200 Subject: [PATCH] gsdx-ogl: log openGL driver version --- plugins/GSdx/GLLoader.cpp | 18 +++++++++--------- plugins/GSdx/GLLoader.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 36d56a7dbc..8ce51f1e01 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -382,16 +382,18 @@ namespace GLLoader { return true; } - bool check_gl_version(uint32 major, uint32 minor) { + bool check_gl_version(int major, int minor) { const GLubyte* s = glGetString(GL_VERSION); if (s == NULL) { fprintf(stderr, "Error: GLLoader failed to get GL version\n"); return false; } + GLuint v = 1; + while (s[v] != '\0' && s[v-1] != ' ') v++; const char* vendor = (const char*)glGetString(GL_VENDOR); - fprintf(stderr, "OpenGL information. GPU: %s. Vendor: %s\n", glGetString(GL_RENDERER), vendor); + fprintf(stderr, "OpenGL information. GPU: %s. Vendor: %s. Driver: %s\n", glGetString(GL_RENDERER), vendor, &s[v]); // Name change but driver is still bad! if (strstr(vendor, "ATI") || strstr(vendor, "Advanced Micro Devices")) @@ -409,13 +411,6 @@ namespace GLLoader { return false; // too much buggy no need to check anything. #endif - GLuint dot = 0; - while (s[dot] != '\0' && s[dot] != '.') dot++; - if (dot == 0) return false; - - GLuint major_gl = s[dot-1]-'0'; - GLuint minor_gl = s[dot+1]-'0'; - if (mesa_amd_buggy_driver) { fprintf(stderr, "Buggy driver detected. Geometry shaders will be disabled\n"); found_geometry_shader = false; @@ -424,6 +419,11 @@ namespace GLLoader { found_geometry_shader = !!theApp.GetConfig("override_geometry_shader", -1); fprintf(stderr, "Overriding geometry shaders detection\n"); } + + GLint major_gl = 0; + GLint minor_gl = 0; + glGetIntegerv(GL_MAJOR_VERSION, &major_gl); + glGetIntegerv(GL_MINOR_VERSION, &minor_gl); if ( (major_gl < major) || ( major_gl == major && minor_gl < minor ) ) { fprintf(stderr, "OpenGL %d.%d is not supported. Only OpenGL %d.%d\n was found", major, minor, major_gl, minor_gl); return false; diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index 4ca96cd61a..c87a2b3560 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -342,7 +342,7 @@ namespace Emulate_DSA { } namespace GLLoader { - bool check_gl_version(uint32 major, uint32 minor); + bool check_gl_version(int major, int minor); void init_gl_function(); bool check_gl_supported_extension();