diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-09-02 17:28:39 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-09-02 18:29:37 +0000 |
commit | 39312d64b5e135159b80f0b65282dd977d31d3d7 (patch) | |
tree | 99c91034c5af8b2e7d62ff168a5baf5185088d65 /vcl/source/opengl/OpenGLHelper.cxx | |
parent | a4cd1c4f5aff66ecdfffc083dcf4dac947b055e5 (diff) |
Don't call GL debugging methods if there is no context.
Change-Id: Ie6b824953b8ad19fd1b6a146cb6bf52bbb152ef7
Reviewed-on: https://gerrit.libreoffice.org/18277
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl/source/opengl/OpenGLHelper.cxx')
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index ad90e1abac79..d2a917fb962a 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -32,6 +32,7 @@ #include "opengl/zone.hxx" #include "opengl/watchdog.hxx" #include <osl/conditn.h> +#include <vcl/opengl/OpenGLContext.hxx> #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID #include "opengl/x11/X11DeviceInfo.hxx" @@ -690,29 +691,36 @@ void OpenGLHelper::debugMsgPrint(const char *pArea, const char *pFormat, ...) va_list aArgs; va_start (aArgs, pFormat); - char pStr[1024]; + char pStr[1044]; #ifdef _WIN32 #define vsnprintf _vsnprintf #endif vsnprintf(pStr, sizeof(pStr), pFormat, aArgs); - pStr[sizeof(pStr)-1] = '\0'; + pStr[sizeof(pStr)-20] = '\0'; + + bool bHasContext = !OpenGLContext::hasCurrent(); + if (!bHasContext) + strcat(pStr, "- no GL context"); SAL_INFO(pArea, pStr); - OpenGLZone aZone; + if (bHasContext) + { + OpenGLZone aZone; - if (GLEW_KHR_debug) - glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, - GL_DEBUG_TYPE_OTHER, - 1, // one[sic] id is as good as another ? - // GL_DEBUG_SEVERITY_NOTIFICATION for >= GL4.3 ? - GL_DEBUG_SEVERITY_LOW, - strlen(pStr), pStr); - else if (GLEW_AMD_debug_output) - glDebugMessageInsertAMD(GL_DEBUG_CATEGORY_APPLICATION_AMD, - GL_DEBUG_SEVERITY_LOW_AMD, - 1, // one[sic] id is as good as another ? - strlen(pStr), pStr); + if (GLEW_KHR_debug) + glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, + GL_DEBUG_TYPE_OTHER, + 1, // one[sic] id is as good as another ? + // GL_DEBUG_SEVERITY_NOTIFICATION for >= GL4.3 ? + GL_DEBUG_SEVERITY_LOW, + strlen(pStr), pStr); + else if (GLEW_AMD_debug_output) + glDebugMessageInsertAMD(GL_DEBUG_CATEGORY_APPLICATION_AMD, + GL_DEBUG_SEVERITY_LOW_AMD, + 1, // one[sic] id is as good as another ? + strlen(pStr), pStr); + } va_end (aArgs); } |