diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-10-10 01:32:40 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-10-24 03:30:51 +0200 |
commit | 53df67376de96904f0174fc9d4a35940b87652b7 (patch) | |
tree | 1df791299f3c84ac2e786540365d8a9f72b7d6d9 /src | |
parent | Externals: Regenerate GLAD with GL_KHR_debug support. (diff) | |
download | yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar.gz yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar.bz2 yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar.lz yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar.xz yuzu-53df67376de96904f0174fc9d4a35940b87652b7.tar.zst yuzu-53df67376de96904f0174fc9d4a35940b87652b7.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index f1313b54f..4202d828c 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -369,6 +369,58 @@ void RendererOpenGL::SetWindow(EmuWindow* window) { render_window = window; } +static const char* GetSource(GLenum source) { +#define RET(s) case GL_DEBUG_SOURCE_##s: return #s + switch (source) { + RET(API); + RET(WINDOW_SYSTEM); + RET(SHADER_COMPILER); + RET(THIRD_PARTY); + RET(APPLICATION); + RET(OTHER); + default: + UNREACHABLE(); + } +#undef RET +} + +static const char* GetType(GLenum type) { +#define RET(t) case GL_DEBUG_TYPE_##t: return #t + switch (type) { + RET(ERROR); + RET(DEPRECATED_BEHAVIOR); + RET(UNDEFINED_BEHAVIOR); + RET(PORTABILITY); + RET(PERFORMANCE); + RET(OTHER); + RET(MARKER); + default: + UNREACHABLE(); + } +#undef RET +} + +static void DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, + const GLchar* message, const void* user_param) { + Log::Level level; + switch (severity) { + case GL_DEBUG_SEVERITY_HIGH: + level = Log::Level::Error; + break; + case GL_DEBUG_SEVERITY_MEDIUM: + level = Log::Level::Warning; + break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + level = Log::Level::Info; + break; + case GL_DEBUG_SEVERITY_LOW: + level = Log::Level::Debug; + break; + } + LOG_GENERIC(Log::Class::Render_OpenGL, level, "%s %s %d: %s", + GetSource(source), GetType(type), id, message); +} + /// Initialize the renderer void RendererOpenGL::Init() { render_window->MakeCurrent(); @@ -379,6 +431,11 @@ void RendererOpenGL::Init() { exit(-1); } + if (GLAD_GL_KHR_debug) { + glEnable(GL_DEBUG_OUTPUT); + glDebugMessageCallback(DebugHandler, nullptr); + } + LOG_INFO(Render_OpenGL, "GL_VERSION: %s", glGetString(GL_VERSION)); LOG_INFO(Render_OpenGL, "GL_VENDOR: %s", glGetString(GL_VENDOR)); LOG_INFO(Render_OpenGL, "GL_RENDERER: %s", glGetString(GL_RENDERER)); |