mirror of https://github.com/mosra/magnum.git
Browse Source
Previously this was done in DebugMarker only via GREMEDY_string_marker on desktop and EXT_debug_marker on ES, now supporting both three on desktop and KHR/EXT version on ES. The old DebugMarker is now only a thin wrapper around DebugMessage, is marked as deprecated and will be removed in future release.pull/38/head
12 changed files with 581 additions and 111 deletions
@ -1,64 +0,0 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "DebugMarker.h" |
||||
|
||||
#include <Utility/Debug.h> |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
DebugMarker::MarkImplementation DebugMarker::markImplementation = &DebugMarker::markImplementationDefault; |
||||
|
||||
void DebugMarker::initializeContextBasedFunctionality(Context& context) { |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
if(context.isExtensionSupported<Extensions::GL::GREMEDY::string_marker>()) { |
||||
Debug() << "DebugMarker: using" << Extensions::GL::GREMEDY::string_marker::string() << "features"; |
||||
|
||||
markImplementation = &DebugMarker::markImplementationDebugger; |
||||
} |
||||
#else |
||||
static_cast<void>(context); |
||||
#endif |
||||
} |
||||
|
||||
void DebugMarker::markImplementationDefault(const std::string&) {} |
||||
|
||||
void DebugMarker::markImplementationDebugger(const std::string& string) { |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glStringMarkerGREMEDY(string.length(), string.data()); |
||||
#else |
||||
#if 0 |
||||
glInsertEventMarkerEXT(string.length(), string.data()); |
||||
#else |
||||
static_cast<void>(string); |
||||
#endif |
||||
#endif |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,153 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "DebugMessage.h" |
||||
|
||||
#include <Utility/Assert.h> |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Implementation/State.h" |
||||
#include "Implementation/DebugState.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
Int DebugMessage::maxLoggedMessages() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) |
||||
return 0; |
||||
|
||||
GLint& value = Context::current()->state().debug->maxLoggedMessages; |
||||
|
||||
if(value == 0) { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES, &value); |
||||
#else |
||||
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES_KHR, &value); |
||||
#endif |
||||
} |
||||
|
||||
return value; |
||||
} |
||||
|
||||
Int DebugMessage::maxMessageLength() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) |
||||
return 0; |
||||
|
||||
GLint& value = Context::current()->state().debug->maxMessageLength; |
||||
|
||||
if(value == 0) { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &value); |
||||
#else |
||||
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH_KHR, &value); |
||||
#endif |
||||
} |
||||
|
||||
return value; |
||||
} |
||||
|
||||
void DebugMessage::insert(const Source source, const Type type, const UnsignedInt id, const Severity severity, const std::string& string) { |
||||
Context::current()->state().debug->messageInsertImplementation(source, type, id, severity, string); |
||||
} |
||||
|
||||
void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const std::string&) {} |
||||
|
||||
void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const Severity severity, const std::string& string) { |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data()); |
||||
#else |
||||
static_cast<void>(source); |
||||
static_cast<void>(type); |
||||
static_cast<void>(id); |
||||
static_cast<void>(severity); |
||||
static_cast<void>(string); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
//glDebugMessageInsertEXT(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
|
||||
#endif |
||||
} |
||||
|
||||
void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, Severity, const std::string& string) { |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glInsertEventMarkerEXT(string.size(), string.data()); |
||||
#else |
||||
static_cast<void>(string); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
#endif |
||||
} |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, Severity, const std::string& string) { |
||||
glStringMarkerGREMEDY(string.length(), string.data()); |
||||
} |
||||
#endif |
||||
|
||||
#ifndef DOXYGEN_GENERATING_OUTPUT |
||||
Debug operator<<(Debug debug, const DebugMessage::Source value) { |
||||
switch(value) { |
||||
#define _c(value) case DebugMessage::Source::value: return debug << "DebugMessage::Source::" #value; |
||||
_c(Api) |
||||
_c(WindowSystem) |
||||
_c(ShaderCompiler) |
||||
_c(ThirdParty) |
||||
_c(Application) |
||||
_c(Other) |
||||
#undef _c |
||||
} |
||||
|
||||
return debug << "DebugMessage::Source::(invalid)"; |
||||
} |
||||
|
||||
Debug operator<<(Debug debug, const DebugMessage::Type value) { |
||||
switch(value) { |
||||
#define _c(value) case DebugMessage::Type::value: return debug << "DebugMessage::Type::" #value; |
||||
_c(Error) |
||||
_c(DeprecatedBehavior) |
||||
_c(UndefinedBehavior) |
||||
_c(Portability) |
||||
_c(Performance) |
||||
_c(Other) |
||||
_c(Marker) |
||||
#undef _c |
||||
} |
||||
|
||||
return debug << "DebugMessage::Type::(invalid)"; |
||||
} |
||||
|
||||
Debug operator<<(Debug debug, const DebugMessage::Severity value) { |
||||
switch(value) { |
||||
#define _c(value) case DebugMessage::Severity::value: return debug << "DebugMessage::Severity::" #value; |
||||
_c(High) |
||||
_c(Medium) |
||||
_c(Low) |
||||
_c(Notification) |
||||
#undef _c |
||||
} |
||||
|
||||
return debug << "DebugMessage::Severity::(invalid)"; |
||||
} |
||||
#endif |
||||
|
||||
} |
||||
@ -0,0 +1,267 @@
|
||||
#ifndef Magnum_DebugMessage_h |
||||
#define Magnum_DebugMessage_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
/** @file
|
||||
* @brief Class @ref Magnum::DebugMessage |
||||
*/ |
||||
|
||||
#include <string> |
||||
|
||||
#include "Magnum.h" |
||||
#include "OpenGL.h" |
||||
#include "magnumVisibility.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
namespace Implementation { struct DebugState; } |
||||
|
||||
/**
|
||||
@brief Debug message |
||||
|
||||
Allows inserting debug messages into OpenGL command stream, for example with |
||||
conjunction with various debuggers, such as Apitrace or gDEBugger. |
||||
*/ |
||||
class MAGNUM_EXPORT DebugMessage { |
||||
friend class Implementation::DebugState; |
||||
|
||||
public: |
||||
/**
|
||||
* @brief Message source |
||||
* |
||||
* @see @ref insert() |
||||
*/ |
||||
enum class Source: GLenum { |
||||
/** OpenGL */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Api = GL_DEBUG_SOURCE_API, |
||||
#else |
||||
Api = GL_DEBUG_SOURCE_API_KHR, |
||||
#endif |
||||
|
||||
/** Window system (GLX, WGL) */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM, |
||||
#else |
||||
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR, |
||||
#endif |
||||
|
||||
/** %Shader compiler */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER, |
||||
#else |
||||
ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER_KHR, |
||||
#endif |
||||
|
||||
/** External debugger or third-party middleware */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, |
||||
#else |
||||
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR, |
||||
#endif |
||||
|
||||
/** The application */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Application = GL_DEBUG_SOURCE_APPLICATION, |
||||
#else |
||||
Application = GL_DEBUG_SOURCE_APPLICATION_KHR, |
||||
#endif |
||||
|
||||
/** Any other source */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Other = GL_DEBUG_SOURCE_OTHER |
||||
#else |
||||
Other = GL_DEBUG_SOURCE_OTHER_KHR |
||||
#endif |
||||
}; |
||||
|
||||
/**
|
||||
* @brief Message type |
||||
* |
||||
* @see @ref insert() |
||||
*/ |
||||
enum class Type: GLenum { |
||||
/** OpenGL error */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Error = GL_DEBUG_TYPE_ERROR, |
||||
#else |
||||
Error = GL_DEBUG_TYPE_ERROR_KHR, |
||||
#endif |
||||
|
||||
/** Behavior that has been marked for deprecation */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, |
||||
#else |
||||
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR, |
||||
#endif |
||||
|
||||
/** Behavior that is undefined according to the specification */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, |
||||
#else |
||||
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR, |
||||
#endif |
||||
|
||||
/** Non-portable usage of extensions or shaders */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Portability = GL_DEBUG_TYPE_PORTABILITY, |
||||
#else |
||||
Portability = GL_DEBUG_TYPE_PORTABILITY_KHR, |
||||
#endif |
||||
|
||||
/** Implementation-dependent performance warning */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Performance = GL_DEBUG_TYPE_PERFORMANCE, |
||||
#else |
||||
Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR, |
||||
#endif |
||||
|
||||
/** Any other type */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Other = GL_DEBUG_TYPE_OTHER, |
||||
#else |
||||
Other = GL_DEBUG_TYPE_OTHER_KHR, |
||||
#endif |
||||
|
||||
/** Annotation of the command stream */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Marker = GL_DEBUG_TYPE_MARKER |
||||
#else |
||||
Marker = GL_DEBUG_TYPE_MARKER_KHR |
||||
#endif |
||||
}; |
||||
|
||||
/**
|
||||
* @brief Message severity |
||||
* |
||||
* @see @ref insert() |
||||
*/ |
||||
enum class Severity: GLenum { |
||||
/**
|
||||
* Any OpenGL error, dangerous undefined behavior, shader |
||||
* compilation errors. |
||||
*/ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
High = GL_DEBUG_SEVERITY_HIGH, |
||||
#else |
||||
High = GL_DEBUG_SEVERITY_HIGH_KHR, |
||||
#endif |
||||
|
||||
/**
|
||||
* Severe performance warnings, shader compilation warnings, use of |
||||
* deprecated behavior. |
||||
*/ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Medium = GL_DEBUG_SEVERITY_MEDIUM, |
||||
#else |
||||
Medium = GL_DEBUG_SEVERITY_MEDIUM_KHR, |
||||
#endif |
||||
|
||||
/** Minor performance warnings, trivial undefined behavior. */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Low = GL_DEBUG_SEVERITY_LOW, |
||||
#else |
||||
Low = GL_DEBUG_SEVERITY_LOW_KHR, |
||||
#endif |
||||
|
||||
/** Any message other than error or performance warning. */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
Notification = GL_DEBUG_SEVERITY_NOTIFICATION |
||||
#else |
||||
Notification = GL_DEBUG_SEVERITY_NOTIFICATION_KHR |
||||
#endif |
||||
}; |
||||
|
||||
/**
|
||||
* @brief Max count of debug messages in log |
||||
* |
||||
* The result is cached, repeated queries don't result in repeated |
||||
* OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} |
||||
* desktop or ES extension is not available, returns `0`. |
||||
* @see @fn_gl{Get} with @def_gl{MAX_DEBUG_LOGGED_MESSAGES} |
||||
*/ |
||||
static Int maxLoggedMessages(); |
||||
|
||||
/**
|
||||
* @brief Max debug message length |
||||
* |
||||
* The result is cached, repeated queries don't result in repeated |
||||
* OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} |
||||
* desktop or ES extension is not available, returns `0`. |
||||
* @see @fn_gl{Get} with @def_gl{MAX_DEBUG_MESSAGE_LENGTH} |
||||
*/ |
||||
static Int maxMessageLength(); |
||||
|
||||
/**
|
||||
* @brief Insert message |
||||
* @param source Message source. Allowed values are |
||||
* @ref Source::ThirdParty or @ref Source::Application. |
||||
* @param type Message type |
||||
* @param id Message-specific ID |
||||
* @param severity Message severity |
||||
* @param string The actual message |
||||
* |
||||
* If OpenGL 4.3 is not supported and none of @extension{KHR,debug}, |
||||
* @extension2{EXT,debug_marker} or @extension{GREMEDY,string_marker} |
||||
* is available, this function does nothing. |
||||
* |
||||
* If @extension{KHR,debug} is not available and only @extension2{EXT,debug_marker} |
||||
* or @extension{GREMEDY,string_marker} are available, only @p string |
||||
* is used and all other parameters are ignored. The call is then |
||||
* equivalent to the following: |
||||
* @code |
||||
* DebugMessage::insert(DebugMessage::Source::Application, |
||||
* DebugMessage::Type::Marker, 0, DebugMessage::Severity::Notification, string); |
||||
* @endcode |
||||
* |
||||
* @see @ref maxMessageLength(), @fn_gl{DebugMessageInsert}, |
||||
* @fn_gl_extension2{InsertEventMarker,EXT,debug_marker} or |
||||
* @fn_gl_extension{StringMarker,GREMEDY,string_marker} |
||||
*/ |
||||
static void insert(Source source, Type type, UnsignedInt id, Severity severity, const std::string& string); |
||||
|
||||
DebugMessage() = delete; |
||||
|
||||
private: |
||||
static MAGNUM_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const std::string&); |
||||
static MAGNUM_LOCAL void insertImplementationKhr(Source source, Type type, UnsignedInt id, Severity severity, const std::string& string); |
||||
static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, Severity, const std::string& string); |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, Severity, const std::string& string); |
||||
#endif |
||||
}; |
||||
|
||||
/** @debugoperator{Magnum::DebugMessage} */ |
||||
Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Source value); |
||||
|
||||
/** @debugoperator{Magnum::DebugMessage} */ |
||||
Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Type value); |
||||
|
||||
/** @debugoperator{Magnum::DebugMessage} */ |
||||
Debug MAGNUM_EXPORT operator<<(Debug debug, DebugMessage::Severity value); |
||||
|
||||
} |
||||
|
||||
#endif |
||||
@ -0,0 +1,103 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
#include "Context.h" |
||||
#include "DebugMessage.h" |
||||
#include "Extensions.h" |
||||
|
||||
#ifdef MAGNUM_BUILD_DEPRECATED |
||||
#include "DebugMarker.h" |
||||
#endif |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class DebugGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit DebugGLTest(); |
||||
|
||||
void insertMessageNoOp(); |
||||
void insertMessage(); |
||||
void insertMessageFallback(); |
||||
|
||||
void deprecated(); |
||||
}; |
||||
|
||||
DebugGLTest::DebugGLTest() { |
||||
addTests({&DebugGLTest::insertMessageNoOp, |
||||
&DebugGLTest::insertMessage, |
||||
&DebugGLTest::insertMessageFallback, |
||||
|
||||
#ifdef MAGNUM_BUILD_DEPRECATED |
||||
&DebugGLTest::deprecated |
||||
#endif |
||||
}); |
||||
} |
||||
|
||||
void DebugGLTest::insertMessageNoOp() { |
||||
if(Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() || |
||||
Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_marker>() || |
||||
Context::current()->isExtensionSupported<Extensions::GL::GREMEDY::string_marker>()) |
||||
CORRADE_SKIP("The extensions are supported, cannot test."); |
||||
|
||||
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, |
||||
1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
void DebugGLTest::insertMessage() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) |
||||
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported")); |
||||
|
||||
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, |
||||
1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
void DebugGLTest::insertMessageFallback() { |
||||
if(Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() || |
||||
(!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_marker>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::GREMEDY::string_marker>())) |
||||
CORRADE_SKIP("No proper extension is supported"); |
||||
|
||||
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, |
||||
1337, DebugMessage::Severity::Notification, "Hello from OpenGL command stream!"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
#ifdef MAGNUM_BUILD_DEPRECATED |
||||
void DebugGLTest::deprecated() { |
||||
DebugMarker::mark("hello"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
#endif |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::DebugGLTest) |
||||
Loading…
Reference in new issue