diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-23 00:41:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-23 00:41:25 +0300 |
commit | 89106a96cd86042415d19f307a4ade5f1fae8b5d (patch) | |
tree | 6308feb8da3c753ae6815eda963b1b994c0d3e95 /src | |
parent | ad0c5a085c3c6531db2a84a77d590311ed1d2d8f (diff) | |
download | mv-89106a96cd86042415d19f307a4ade5f1fae8b5d.tar.gz mv-89106a96cd86042415d19f307a4ade5f1fae8b5d.tar.bz2 mv-89106a96cd86042415d19f307a4ade5f1fae8b5d.tar.xz mv-89106a96cd86042415d19f307a4ade5f1fae8b5d.zip |
Add OpenGL debug extensions bindings.
Also show in log information about known extensions.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphicsmanager.cpp | 45 | ||||
-rw-r--r-- | src/mgl.cpp | 2 | ||||
-rw-r--r-- | src/mgl.h | 12 |
3 files changed, 47 insertions, 12 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 15768fcb0..d746cb199 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -578,11 +578,31 @@ void GraphicsManager::deleteFBO(FBOInfo *fbo) void GraphicsManager::initOpenGLFunctions() { + // Texture sampler + if (checkGLVersion(1, 0) && supportExtension("GL_ARB_sampler_objects")) + { + logger->log("found GL_ARB_sampler_objects"); + assignFunction(glGenSamplers, "glGenSamplers"); + assignFunction(glDeleteSamplers, "glDeleteSamplers"); + assignFunction(glBindSampler, "glBindSampler"); + assignFunction(glSamplerParameteri, "glSamplerParameteri"); + if (mglGenSamplers && config.getBoolValue("useTextureSampler")) + mUseTextureSampler &= true; + else + mUseTextureSampler = false; + } + else + { + logger->log("texture sampler not found"); + mUseTextureSampler = false; + } + if (!checkGLVersion(1, 1)) return; if (supportExtension("GL_ARB_framebuffer_object")) { // frame buffer supported + logger->log("found GL_ARB_framebuffer_object"); assignFunction(glGenRenderbuffers, "glGenRenderbuffers"); assignFunction(glBindRenderbuffer, "glBindRenderbuffer"); assignFunction(glRenderbufferStorage, "glRenderbufferStorage"); @@ -595,6 +615,7 @@ void GraphicsManager::initOpenGLFunctions() } else if (supportExtension("GL_EXT_framebuffer_object")) { // old frame buffer extension + logger->log("found GL_EXT_framebuffer_object"); assignFunction(glGenRenderbuffers, "glGenRenderbuffersEXT"); assignFunction(glBindRenderbuffer, "glBindRenderbufferEXT"); assignFunction(glRenderbufferStorage, "glRenderbufferStorageEXT"); @@ -608,24 +629,26 @@ void GraphicsManager::initOpenGLFunctions() } else { // no frame buffer support + logger->log("frame buffer not found"); config.setValue("usefbo", false); } - // Texture sampler - if (checkGLVersion(1, 0) && supportExtension("GL_ARB_sampler_objects")) + // debug extensions + if (supportExtension("GL_KHR_debug")) { - assignFunction(glGenSamplers, "glGenSamplers"); - assignFunction(glDeleteSamplers, "glDeleteSamplers"); - assignFunction(glBindSampler, "glBindSampler"); - assignFunction(glSamplerParameteri, "glSamplerParameteri"); - if (mglGenSamplers && config.getBoolValue("useTextureSampler")) - mUseTextureSampler &= true; - else - mUseTextureSampler = false; + logger->log("found GL_KHR_debug"); + assignFunction(glDebugMessageControl, "glDebugMessageControl"); + assignFunction(glDebugMessageCallback, "glDebugMessageCallback"); + } + else if (supportExtension("GL_ARB_debug_output")) + { + logger->log("found GL_ARB_debug_output"); + assignFunction(glDebugMessageControl, "glDebugMessageControlARB"); + assignFunction(glDebugMessageCallback, "glDebugMessageCallbackARB"); } else { - mUseTextureSampler = false; + logger->log("debug extensions not found"); } #ifdef WIN32 diff --git a/src/mgl.cpp b/src/mgl.cpp index 54ac6c199..56d3b94c2 100644 --- a/src/mgl.cpp +++ b/src/mgl.cpp @@ -40,6 +40,8 @@ defName(glGenSamplers); defName(glDeleteSamplers); defName(glBindSampler); defName(glSamplerParameteri); +defName(glDebugMessageControl); +defName(glDebugMessageCallback); #ifdef WIN32 defName(wglGetExtensionsString); @@ -67,13 +67,21 @@ typedef void (APIENTRY *glFramebufferRenderbuffer_t)(GLenum target, typedef void (APIENTRY *glDeleteFramebuffers_t) (GLsizei, const GLuint *); typedef void (APIENTRY *glDeleteRenderbuffers_t) (GLsizei, const GLuint *); typedef const GLubyte *(APIENTRY *glGetStringi_t) (GLenum, GLuint); - typedef void (APIENTRY *glGenSamplers_t) (GLsizei count, GLuint *samplers); typedef void (APIENTRY *glDeleteSamplers_t) (GLsizei count, const GLuint * samplers); typedef void (APIENTRY *glBindSampler_t) (GLuint unit, GLuint sampler); typedef void (APIENTRY *glSamplerParameteri_t) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRY *glDebugMessageControl_t) (GLenum source, GLenum type, + GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); + +// callback +typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam); + +typedef void (APIENTRY *glDebugMessageCallback_t) (GLDEBUGPROC_t callback, + const void *userParam); defNameE(glGenRenderbuffers); defNameE(glBindRenderbuffer); @@ -89,6 +97,8 @@ defNameE(glGenSamplers); defNameE(glDeleteSamplers); defNameE(glBindSampler); defNameE(glSamplerParameteri); +defNameE(glDebugMessageControl); +defNameE(glDebugMessageCallback); #ifdef WIN32 typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc); |