[Libreoffice-commits] core.git: include/vcl vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Mon Jul 25 14:35:48 UTC 2016
include/vcl/opengl/OpenGLHelper.hxx | 14 +++++++++++++-
vcl/source/opengl/OpenGLHelper.cxx | 19 +++++++++++++++----
2 files changed, 28 insertions(+), 5 deletions(-)
New commits:
commit 1b7ef90fba218b27f3757d117f5e2d3c872c5da8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Jul 25 13:58:44 2016 +0900
opengl: add VCL_GL_WARN to write warnings into api trace file
Change-Id: I416de926a769dccdf1c53072c1f7dda817c5402a
Reviewed-on: https://gerrit.libreoffice.org/27496
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index b2989b8..97db306 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -28,6 +28,17 @@
} \
} while (false)
+/// Helper to do a SAL_WARN as well as a GL log.
+#define VCL_GL_WARN(stream) \
+ do { \
+ if (SAL_DETAIL_ENABLE_LOG_INFO && OpenGLHelper::isVCLOpenGLEnabled()) \
+ { \
+ ::std::ostringstream detail_stream; \
+ detail_stream << stream; \
+ OpenGLHelper::debugMsgStreamWarn(detail_stream); \
+ } \
+ } while (false)
+
// All member functions static and VCL_DLLPUBLIC. Basically a glorified namespace.
struct VCL_DLLPUBLIC OpenGLHelper
{
@@ -77,8 +88,9 @@ public:
* Insert a glDebugMessage into the queue - helpful for debugging
* with apitrace to annotate the output and correlate it with code.
*/
- static void debugMsgPrint(const char *pFormat, ...);
+ static void debugMsgPrint(const int nType, const char *pFormat, ...);
static void debugMsgStream(std::ostringstream const &pStream);
+ static void debugMsgStreamWarn(std::ostringstream const &pStream);
/**
* checks if the device/driver pair is on our OpenGL blacklist
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 5dff689..2060b35 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -1018,11 +1018,15 @@ bool OpenGLWrapper::isVCLOpenGLEnabled()
void OpenGLHelper::debugMsgStream(std::ostringstream const &pStream)
{
- debugMsgPrint ("%x: %s", osl_getThreadIdentifier(nullptr),
- pStream.str().c_str());
+ debugMsgPrint(0, "%x: %s", osl_getThreadIdentifier(nullptr), pStream.str().c_str());
}
-void OpenGLHelper::debugMsgPrint(const char *pFormat, ...)
+void OpenGLHelper::debugMsgStreamWarn(std::ostringstream const &pStream)
+{
+ debugMsgPrint(1, "%x: %s", osl_getThreadIdentifier(nullptr), pStream.str().c_str());
+}
+
+void OpenGLHelper::debugMsgPrint(const int nType, const char *pFormat, ...)
{
va_list aArgs;
va_start (aArgs, pFormat);
@@ -1038,7 +1042,14 @@ void OpenGLHelper::debugMsgPrint(const char *pFormat, ...)
if (!bHasContext)
strcat(pStr, "- no GL context");
- SAL_INFO("vcl.opengl", pStr);
+ if (nType == 0)
+ {
+ SAL_INFO("vcl.opengl", pStr);
+ }
+ else if (nType == 1)
+ {
+ SAL_WARN("vcl.opengl", pStr);
+ }
if (bHasContext)
{
More information about the Libreoffice-commits
mailing list