summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-07 21:57:33 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-07 21:57:33 +0300
commitcf24722d84c7e4fd1d32365d720c291a48b9f9c8 (patch)
tree05f2bd60e8199d5fec00507f4fef95c51dab0873
parente786bcdc61657e4b2e2cae4bf6f44bb70a14587a (diff)
downloadmanaverse-cf24722d84c7e4fd1d32365d720c291a48b9f9c8.tar.gz
manaverse-cf24722d84c7e4fd1d32365d720c291a48b9f9c8.tar.bz2
manaverse-cf24722d84c7e4fd1d32365d720c291a48b9f9c8.tar.xz
manaverse-cf24722d84c7e4fd1d32365d720c291a48b9f9c8.zip
Add support for OpenGL extension GL_EXT_debug_label.
-rw-r--r--src/graphicsmanager.cpp12
-rw-r--r--src/render/mgl.cpp2
-rw-r--r--src/render/mgl.h15
-rw-r--r--src/resources/openglimagehelper.cpp8
4 files changed, 37 insertions, 0 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index d158527e1..e1c5bf35d 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -821,6 +821,18 @@ void GraphicsManager::initOpenGLFunctions()
logger->log1("found GL_GREMEDY_frame_terminator");
assignFunction(glFrameTerminator, "glFrameTerminatorGREMEDY");
}
+ if (supportExtension("GL_EXT_debug_label"))
+ {
+ logger->log1("found GL_EXT_debug_label");
+ assignFunction(glLabelObject, "glLabelObjectEXT");
+ if (!mglLabelObject)
+ assignFunction(glLabelObject, "glLabelObject");
+ if (!mglLabelObject)
+ assignFunction(glLabelObject, "glObjectLabel");
+ assignFunction(glGetObjectLabel, "glGetObjectLabelEXT");
+ if (!mglGetObjectLabel)
+ assignFunction(glGetObjectLabel, "glGetObjectLabel");
+ }
#ifdef WIN32
assignFunction(wglGetExtensionsString, "wglGetExtensionsStringARB");
diff --git a/src/render/mgl.cpp b/src/render/mgl.cpp
index bd67c2f0e..ff51c659d 100644
--- a/src/render/mgl.cpp
+++ b/src/render/mgl.cpp
@@ -43,6 +43,8 @@ defName(glSamplerParameteri);
defName(glDebugMessageControl);
defName(glDebugMessageCallback);
defName(glFrameTerminator);
+defName(glLabelObject);
+defName(glGetObjectLabel);
#ifdef WIN32
defName(wglGetExtensionsString);
diff --git a/src/render/mgl.h b/src/render/mgl.h
index e2e710029..8fc98f8fe 100644
--- a/src/render/mgl.h
+++ b/src/render/mgl.h
@@ -74,6 +74,15 @@
#define GL_DEBUG_SEVERITY_LOW 0x9148
#endif
+#ifndef GL_EXT_debug_label
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+#define GL_PROGRAM_OBJECT_EXT 0x8B40
+#define GL_SHADER_OBJECT_EXT 0x8B48
+#define GL_BUFFER_OBJECT_EXT 0x9151
+#define GL_QUERY_OBJECT_EXT 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+#endif
+
#define defNameE(name) extern name##_t m##name
typedef void (APIENTRY *glGenRenderbuffers_t)(GLsizei, GLuint *);
@@ -100,6 +109,10 @@ typedef void (APIENTRY *glSamplerParameteri_t)
typedef void (APIENTRY *glDebugMessageControl_t) (GLenum source, GLenum type,
GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
typedef void (APIENTRY *glFrameTerminator_t) (void);
+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);
// callback
typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id,
@@ -125,6 +138,8 @@ defNameE(glSamplerParameteri);
defNameE(glDebugMessageControl);
defNameE(glDebugMessageCallback);
defNameE(glFrameTerminator);
+defNameE(glLabelObject);
+defNameE(glGetObjectLabel);
#ifdef WIN32
typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc);
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 262d839f7..ae67904f9 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -244,6 +244,14 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
tmpImage->w, tmpImage->h,
0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels);
+#ifdef DEBUG_OPENGL
+ if (mglLabelObject)
+ {
+ const char *const text = "image text";
+// mglLabelObject(GL_TEXTURE, texture, strlen(text), text);
+ }
+#endif
+
/*
GLint compressed;
glGetTexLevelParameteriv(mTextureType, 0,