summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-08 01:21:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-08 01:21:55 +0300
commit8781220335a1f7b8b60122df13fedba23bef9b35 (patch)
tree89785ca78b67731683e76e4ad6de62078e54c74e /src
parentcf24722d84c7e4fd1d32365d720c291a48b9f9c8 (diff)
downloadmv-8781220335a1f7b8b60122df13fedba23bef9b35.tar.gz
mv-8781220335a1f7b8b60122df13fedba23bef9b35.tar.bz2
mv-8781220335a1f7b8b60122df13fedba23bef9b35.tar.xz
mv-8781220335a1f7b8b60122df13fedba23bef9b35.zip
Add support for OpenGL extension GL_EXT_debug_marker.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/graphicsmanager.cpp13
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/windows/chatwindow.cpp6
-rw-r--r--src/render/mgl.cpp3
-rw-r--r--src/render/mgl.h8
-rw-r--r--src/render/opengldebug.h36
8 files changed, 72 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 961fb7abd..20500cdcb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -726,6 +726,7 @@ SET(SRCS
render/graphics_drawImageRect.hpp
render/nullopenglgraphics.cpp
render/nullopenglgraphics.h
+ render/opengldebug.h
render/openglgraphicsdef.hpp
render/openglgraphicsdefadvanced.hpp
render/renderers.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 942ac7244..72a28fb0b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -806,6 +806,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
render/graphics_drawImageRect.hpp \
render/nullopenglgraphics.cpp \
render/nullopenglgraphics.h \
+ render/opengldebug.h \
render/openglgraphicsdef.hpp \
render/openglgraphicsdefadvanced.hpp \
render/renderers.cpp \
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index e1c5bf35d..4817ecb03 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -833,6 +833,19 @@ void GraphicsManager::initOpenGLFunctions()
if (!mglGetObjectLabel)
assignFunction(glGetObjectLabel, "glGetObjectLabel");
}
+ if (supportExtension("GL_EXT_debug_marker"))
+ {
+ logger->log1("found GL_EXT_debug_marker");
+ assignFunction(glInsertEventMarker, "glInsertEventMarkerEXT");
+ if (!mglInsertEventMarker)
+ assignFunction(glInsertEventMarker, "glInsertEventMarker");
+ assignFunction(glPushGroupMarker, "glPushGroupMarkerEXT");
+ if (!mglPushGroupMarker)
+ assignFunction(glPushGroupMarker, "glPushGroupMarker");
+ assignFunction(glPopGroupMarker, "glPopGroupMarkerEXT");
+ if (!mglPopGroupMarker)
+ assignFunction(glPopGroupMarker, "glPopGroupMarker");
+ }
#ifdef WIN32
assignFunction(wglGetExtensionsString, "wglGetExtensionsStringARB");
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 6ae892c81..3e77a65a5 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -28,6 +28,8 @@
#include "input/inputmanager.h"
+#include "render/opengldebug.h"
+
#include "resources/image.h"
#include "resources/imagehelper.h"
#include "resources/resourcemanager.h"
@@ -111,6 +113,7 @@ void Desktop::widgetResized(const Event &event A_UNUSED)
void Desktop::draw(Graphics *graphics)
{
BLOCK_START("Desktop::draw")
+ GLDEBUG_START("Desktop::draw")
const Rect &rect = mDimension;
const int width = rect.width;
@@ -144,6 +147,7 @@ void Desktop::draw(Graphics *graphics)
}
Container::draw(graphics);
+ GLDEBUG_END()
BLOCK_END("Desktop::draw")
}
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 05ee56356..c3a3569f7 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -62,6 +62,8 @@
#include "gui/widgets/tabs/tradetab.h"
#include "gui/widgets/tabs/whispertab.h"
+#include "render/opengldebug.h"
+
#include "net/chathandler.h"
#include "net/playerhandler.h"
#include "net/net.h"
@@ -1867,7 +1869,11 @@ void ChatWindow::draw(Graphics* graphics)
{
BLOCK_START("ChatWindow::draw")
if (!mAutoHide || mHaveMouse)
+ {
+ GLDEBUG_START("ChatWindow::draw");
Window::draw(graphics);
+ GLDEBUG_END();
+ }
BLOCK_END("ChatWindow::draw")
}
diff --git a/src/render/mgl.cpp b/src/render/mgl.cpp
index ff51c659d..bf8483a67 100644
--- a/src/render/mgl.cpp
+++ b/src/render/mgl.cpp
@@ -45,6 +45,9 @@ defName(glDebugMessageCallback);
defName(glFrameTerminator);
defName(glLabelObject);
defName(glGetObjectLabel);
+defName(glInsertEventMarker);
+defName(glPushGroupMarker);
+defName(glPopGroupMarker);
#ifdef WIN32
defName(wglGetExtensionsString);
diff --git a/src/render/mgl.h b/src/render/mgl.h
index 8fc98f8fe..b612c5e03 100644
--- a/src/render/mgl.h
+++ b/src/render/mgl.h
@@ -113,6 +113,11 @@ typedef void (APIENTRY *glLabelObject_t) (GLenum type, GLuint object,
GLsizei length, const GLchar *label);
typedef void (APIENTRY *glGetObjectLabel_t) (GLenum type, GLuint object,
GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (APIENTRY *glInsertEventMarker_t)
+ (GLsizei length, const char *marker);
+typedef void (APIENTRY *glPushGroupMarker_t)
+ (GLsizei length, const char *marker);
+typedef void (APIENTRY *glPopGroupMarker_t) (void);
// callback
typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id,
@@ -140,6 +145,9 @@ defNameE(glDebugMessageCallback);
defNameE(glFrameTerminator);
defNameE(glLabelObject);
defNameE(glGetObjectLabel);
+defNameE(glInsertEventMarker);
+defNameE(glPushGroupMarker);
+defNameE(glPopGroupMarker);
#ifdef WIN32
typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc);
diff --git a/src/render/opengldebug.h b/src/render/opengldebug.h
new file mode 100644
index 000000000..82b151cc8
--- /dev/null
+++ b/src/render/opengldebug.h
@@ -0,0 +1,36 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RENDER_OPENGLDEBUG_H
+#define RENDER_OPENGLDEBUG_H
+
+#include "render/mgl.h"
+
+#if defined(DEBUG_OPENGL) && defined(USE_OPENGL)
+#define GLDEBUG_START(text) if (mglPushGroupMarker) \
+ mglPushGroupMarker(sizeof(text), text);
+#define GLDEBUG_END() if (mglPopGroupMarker) \
+ mglPopGroupMarker();
+#else
+#define GLDEBUG_START(text)
+#define GLDEBUG_END()
+#endif
+
+#endif // RENDER_OPENGLDEBUG_H