Browse Source

Updates for debug output in ES 3.2.

pull/231/head
Vladimír Vondruš 8 years ago
parent
commit
974b0e70d7
  1. 56
      src/Magnum/AbstractObject.cpp
  2. 23
      src/Magnum/AbstractObject.h
  3. 4
      src/Magnum/AbstractQuery.cpp
  4. 17
      src/Magnum/AbstractQuery.h
  5. 4
      src/Magnum/AbstractShaderProgram.cpp
  6. 17
      src/Magnum/AbstractShaderProgram.h
  7. 17
      src/Magnum/AbstractTexture.h
  8. 4
      src/Magnum/Buffer.cpp
  9. 17
      src/Magnum/Buffer.h
  10. 4
      src/Magnum/Context.h
  11. 108
      src/Magnum/DebugOutput.cpp
  12. 192
      src/Magnum/DebugOutput.h
  13. 17
      src/Magnum/Framebuffer.h
  14. 42
      src/Magnum/Implementation/DebugState.cpp
  15. 4
      src/Magnum/Mesh.cpp
  16. 19
      src/Magnum/Mesh.h
  17. 17
      src/Magnum/Renderbuffer.h
  18. 16
      src/Magnum/Renderer.h
  19. 4
      src/Magnum/Shader.cpp
  20. 17
      src/Magnum/Shader.h
  21. 17
      src/Magnum/TransformFeedback.h

56
src/Magnum/AbstractObject.cpp

@ -42,35 +42,35 @@ namespace Magnum {
namespace {
inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) {
switch(khrIdentifier) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_BUFFER:
#else
case GL_BUFFER_KHR:
#endif
return GL_BUFFER_OBJECT_EXT;
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_SHADER:
#else
case GL_SHADER_KHR:
#endif
return GL_SHADER_OBJECT_EXT;
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_PROGRAM:
#else
case GL_PROGRAM_KHR:
#endif
return GL_PROGRAM_OBJECT_EXT;
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_VERTEX_ARRAY:
#else
case GL_VERTEX_ARRAY_KHR:
#endif
return GL_VERTEX_ARRAY_OBJECT_EXT;
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_QUERY:
#else
case GL_QUERY_KHR:
@ -78,7 +78,7 @@ namespace {
return GL_QUERY_OBJECT_EXT;
/** @todo Why isn't `GL_PROGRAM_PIPELINE_KHR` in ES's KHR_debug? */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_PROGRAM_PIPELINE:
#else
case 0x82E4: //GL_PROGRAM_PIPELINE_KHR:
@ -92,7 +92,7 @@ namespace {
* only for ES3 (i.e. no mention of @extension{EXT,transform_feedback})
*/
case GL_TRANSFORM_FEEDBACK:
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
case GL_SAMPLER:
#else
case GL_SAMPLER_KHR:
@ -114,7 +114,7 @@ Int AbstractObject::maxLabelLength() {
GLint& value = Context::current().state().debug->maxLabelLength;
if(value == 0) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_LABEL_LENGTH, &value);
#else
glGetIntegerv(GL_MAX_LABEL_LENGTH_KHR, &value);
@ -126,13 +126,17 @@ Int AbstractObject::maxLabelLength() {
void AbstractObject::labelImplementationNoOp(GLenum, GLuint, Containers::ArrayView<const char>) {}
void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
void AbstractObject::labelImplementationKhrDesktopES32(const GLenum identifier, const GLuint name, const Containers::ArrayView<const char> label) {
glObjectLabel(identifier, name, label.size(), label);
#else
}
#endif
#ifdef MAGNUM_TARGET_GLES
void AbstractObject::labelImplementationKhrES(const GLenum identifier, const GLuint name, const Containers::ArrayView<const char> label) {
glObjectLabelKHR(identifier, name, label.size(), label);
#endif
}
#endif
void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const Containers::ArrayView<const char> label) {
const GLenum type = extTypeFromKhrIdentifier(identifier);
@ -141,29 +145,41 @@ void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuin
std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return {}; }
std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) {
#ifndef MAGNUM_TARGET_GLES2
std::string AbstractObject::getLabelImplementationKhrDesktopES32(const GLenum identifier, const GLuint name) {
/* Get label size (w/o null terminator). Specifying 0 as size is not
allowed, thus we pass the maximum instead. */
GLsizei size = 0;
#ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr);
#else
glGetObjectLabelKHR(identifier, name, maxLabelLength(), &size, nullptr);
#endif
/* Make place also for the null terminator */
std::string label;
label.resize(size+1);
#ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, size+1, nullptr, &label[0]);
#else
/* Pop null terminator and return the string */
label.resize(size);
return label;
}
#endif
#ifdef MAGNUM_TARGET_GLES
std::string AbstractObject::getLabelImplementationKhrES(const GLenum identifier, const GLuint name) {
/* Get label size (w/o null terminator). Specifying 0 as size is not
allowed, thus we pass the maximum instead. */
GLsizei size = 0;
glGetObjectLabelKHR(identifier, name, maxLabelLength(), &size, nullptr);
/* Make place also for the null terminator */
std::string label;
label.resize(size+1);
glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]);
#endif
/* Pop null terminator and return the string */
label.resize(size);
return label;
}
#endif
std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) {
GLsizei size = 0;

23
src/Magnum/AbstractObject.h

@ -88,10 +88,11 @@ class MAGNUM_EXPORT AbstractObject {
* @brief Max object label 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 (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, returns `0`. Note that @extension{EXT,debug_label}
* has no such limit.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} desktop or ES extension (covered also by
* @extension{ANDROID,extension_pack_es31a}) is not available,
* returns `0`. Note that @extension{EXT,debug_label} has no such
* limit.
* @see @ref AbstractQuery::setLabel(), @ref AbstractShaderProgram::setLabel(),
* @ref AbstractTexture::setLabel(), @ref Buffer::setLabel(),
* @ref BufferTexture::setLabel(), @ref Framebuffer::setLabel(),
@ -111,10 +112,20 @@ class MAGNUM_EXPORT AbstractObject {
#ifndef MAGNUM_TARGET_WEBGL
static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, Containers::ArrayView<const char> label);
static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, Containers::ArrayView<const char> label);
static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, Containers::ArrayView<const char> label);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void labelImplementationKhrDesktopES32(GLenum identifier, GLuint name, Containers::ArrayView<const char> label);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void labelImplementationKhrES(GLenum identifier, GLuint name, Containers::ArrayView<const char> label);
#endif
static MAGNUM_LOCAL std::string getLabelImplementationNoOp(GLenum, GLuint);
static MAGNUM_LOCAL std::string getLabelImplementationExt(GLenum identifier, GLuint name);
static MAGNUM_LOCAL std::string getLabelImplementationKhr(GLenum identifier, GLuint name);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL std::string getLabelImplementationKhrDesktopES32(GLenum identifier, GLuint name);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL std::string getLabelImplementationKhrES(GLenum identifier, GLuint name);
#endif
#endif
};

4
src/Magnum/AbstractQuery.cpp

@ -72,7 +72,7 @@ void AbstractQuery::createImplementationDSA() {
#ifndef MAGNUM_TARGET_WEBGL
std::string AbstractQuery::label() const {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_QUERY, _id);
#else
return Context::current().state().debug->getLabelImplementation(GL_QUERY_KHR, _id);
@ -80,7 +80,7 @@ std::string AbstractQuery::label() const {
}
AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_QUERY, _id, label);
#else
Context::current().state().debug->labelImplementation(GL_QUERY_KHR, _id, label);

17
src/Magnum/AbstractQuery.h

@ -86,10 +86,11 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
* @brief Query label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{QUERY} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{QUERY_OBJECT_EXT}
@ -101,10 +102,10 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
* @brief Set query label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{QUERY} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{QUERY_OBJECT_EXT}

4
src/Magnum/AbstractShaderProgram.cpp

@ -301,7 +301,7 @@ AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&&
#ifndef MAGNUM_TARGET_WEBGL
std::string AbstractShaderProgram::label() const {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_PROGRAM, _id);
#else
return Context::current().state().debug->getLabelImplementation(GL_PROGRAM_KHR, _id);
@ -309,7 +309,7 @@ std::string AbstractShaderProgram::label() const {
}
AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_PROGRAM, _id, label);
#else
Context::current().state().debug->labelImplementation(GL_PROGRAM_KHR, _id, label);

17
src/Magnum/AbstractShaderProgram.h

@ -766,10 +766,11 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Shader program label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{PROGRAM} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{PROGRAM_OBJECT_EXT}
@ -781,10 +782,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Set shader program label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{PROGRAM} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{PROGRAM_OBJECT_EXT}

17
src/Magnum/AbstractTexture.h

@ -351,10 +351,11 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Texture label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{TEXTURE}
@ -366,10 +367,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Set texture label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{TEXTURE}

4
src/Magnum/Buffer.cpp

@ -202,7 +202,7 @@ inline void Buffer::createIfNotAlready() {
#ifndef MAGNUM_TARGET_WEBGL
std::string Buffer::label() {
createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_BUFFER, _id);
#else
return Context::current().state().debug->getLabelImplementation(GL_BUFFER_KHR, _id);
@ -211,7 +211,7 @@ std::string Buffer::label() {
Buffer& Buffer::setLabelInternal(const Containers::ArrayView<const char> label) {
createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_BUFFER, _id, label);
#else
Context::current().state().debug->labelImplementation(GL_BUFFER_KHR, _id, label);

17
src/Magnum/Buffer.h

@ -843,10 +843,11 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Buffer label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{BUFFER} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{BUFFER_OBJECT_EXT}
@ -858,10 +859,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Set buffer label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{BUFFER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{BUFFER_OBJECT_EXT}

4
src/Magnum/Context.h

@ -138,10 +138,10 @@ class MAGNUM_EXPORT Context {
/**
* Debug context
* @requires_gl43 Extension @extension{KHR,debug}
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a}/
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
* @extension2{KHR,debug,debug}
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Debug = GL_CONTEXT_FLAG_DEBUG_BIT,
#else
Debug = GL_CONTEXT_FLAG_DEBUG_BIT_KHR,

108
src/Magnum/DebugOutput.cpp

@ -127,7 +127,7 @@ Int DebugOutput::maxLoggedMessages() {
GLint& value = Context::current().state().debug->maxLoggedMessages;
if(value == 0) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES, &value);
#else
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES_KHR, &value);
@ -144,7 +144,7 @@ Int DebugOutput::maxMessageLength() {
GLint& value = Context::current().state().debug->maxMessageLength;
if(value == 0) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &value);
#else
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH_KHR, &value);
@ -168,41 +168,51 @@ void DebugOutput::setEnabledInternal(const GLenum source, const GLenum type, con
void DebugOutput::controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list<UnsignedInt>, bool) {}
void DebugOutput::controlImplementationKhr(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list<UnsignedInt> ids, const bool enabled) {
#ifndef MAGNUM_TARGET_GLES
glDebugMessageControl
#else
glDebugMessageControlKHR
#endif
(source, type, severity, ids.size(), ids.begin(), enabled);
#ifndef MAGNUM_TARGET_GLES2
void DebugOutput::controlImplementationKhrDesktopES32(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list<UnsignedInt> ids, const bool enabled) {
glDebugMessageControl(source, type, severity, ids.size(), ids.begin(), enabled);
}
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugOutput::controlImplementationKhrES(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list<UnsignedInt> ids, const bool enabled) {
glDebugMessageControlKHR(source, type, severity, ids.size(), ids.begin(), enabled);
}
#endif
void DebugOutput::callbackImplementationNoOp(Callback, const void*) {}
void DebugOutput::callbackImplementationKhr(const Callback callback, const void* userParam) {
#ifndef MAGNUM_TARGET_GLES2
void DebugOutput::callbackImplementationKhrDesktopES32(const Callback callback, const void* userParam) {
/* Replace the callback */
const Callback original = Context::current().state().debug->messageCallback;
Context::current().state().debug->messageCallback = callback;
/* Adding callback */
if(!original && callback) {
#ifndef MAGNUM_TARGET_GLES
glDebugMessageCallback
#else
glDebugMessageCallbackKHR
#endif
(callbackWrapper, userParam);
if(!original && callback)
glDebugMessageCallback(callbackWrapper, userParam);
/* Deleting callback */
} else if(original && !callback) {
#ifndef MAGNUM_TARGET_GLES
glDebugMessageCallback
#else
glDebugMessageCallbackKHR
#endif
(nullptr, nullptr);
}
else if(original && !callback)
glDebugMessageCallback(nullptr, nullptr);
}
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugOutput::callbackImplementationKhrES(const Callback callback, const void* userParam) {
/* Replace the callback */
const Callback original = Context::current().state().debug->messageCallback;
Context::current().state().debug->messageCallback = callback;
/* Adding callback */
if(!original && callback)
glDebugMessageCallbackKHR(callbackWrapper, userParam);
/* Deleting callback */
else if(original && !callback)
glDebugMessageCallbackKHR(nullptr, nullptr);
}
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DebugOutput::Source value) {
@ -262,14 +272,17 @@ void DebugMessage::insertInternal(const Source source, const Type type, const Un
void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView<const char>) {}
void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView<const char> string) {
#ifndef MAGNUM_TARGET_GLES
glDebugMessageInsert
#else
glDebugMessageInsertKHR
#endif
(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
#ifndef MAGNUM_TARGET_GLES2
void DebugMessage::insertImplementationKhrDesktopES32(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView<const char> string) {
glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
}
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugMessage::insertImplementationKhrES(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView<const char> string) {
glDebugMessageInsertKHR(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
}
#endif
void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView<const char> string) {
glInsertEventMarkerEXT(string.size(), string.data());
@ -319,7 +332,7 @@ Int DebugGroup::maxStackDepth() {
GLint& value = Context::current().state().debug->maxStackDepth;
if(value == 0) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_GROUP_STACK_DEPTH, &value);
#else
glGetIntegerv(GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR, &value);
@ -343,14 +356,17 @@ void DebugGroup::pop() {
void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::ArrayView<const char>) {}
void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id, const Containers::ArrayView<const char> message) {
#ifndef MAGNUM_TARGET_GLES
glPushDebugGroup
#else
glPushDebugGroupKHR
#endif
(GLenum(source), id, message.size(), message.data());
#ifndef MAGNUM_TARGET_GLES2
void DebugGroup::pushImplementationKhrDesktopES32(const Source source, const UnsignedInt id, const Containers::ArrayView<const char> message) {
glPushDebugGroup(GLenum(source), id, message.size(), message.data());
}
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugGroup::pushImplementationKhrES(const Source source, const UnsignedInt id, const Containers::ArrayView<const char> message) {
glPushDebugGroupKHR(GLenum(source), id, message.size(), message.data());
}
#endif
void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::ArrayView<const char> message) {
glPushGroupMarkerEXT(message.size(), message.data());
@ -358,13 +374,17 @@ void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::Ar
void DebugGroup::popImplementationNoOp() {}
void DebugGroup::popImplementationKhr() {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
void DebugGroup::popImplementationKhrDesktopES32() {
glPopDebugGroup();
#else
}
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugGroup::popImplementationKhrES() {
glPopDebugGroupKHR();
#endif
}
#endif
void DebugGroup::popImplementationExt() {
glPopGroupMarkerEXT();

192
src/Magnum/DebugOutput.h

@ -54,14 +54,14 @@ stream in various graphics debuggers, such as ApiTrace or gDEBugger.
@section Magnum-DebugOutput-usage Basic usage
Support for debug output is provided by OpenGL 4.3 or @extension{KHR,debug}
(desktop/ES extension, covered also by @extension{ANDROID,extension_pack_es31a}).
Subset of the functionality is provided also by @extension{EXT,debug_marker}
(desktop/ES extensions) or @extension{GREMEDY,string_marker} (desktop only
extension).
With OpenGL 4.3 or @extension{KHR,debug} desktop/ES extension, the debug output
needs to be enabled first. It can be enabled globally using
Support for debug output is provided by OpenGL 4.3 / OpenGL ES 3.2 or
@extension{KHR,debug} (desktop/ES extension, covered also by
@extension{ANDROID,extension_pack_es31a}). Subset of the functionality is
provided also by @extension{EXT,debug_marker} (desktop/ES extensions) or
@extension{GREMEDY,string_marker} (desktop only extension).
With OpenGL 4.3 / OpenGL ES 3.2 or @extension{KHR,debug} desktop/ES extension,
the debug output needs to be enabled first. It can be enabled globally using
@ref Platform::Sdl2Application::Configuration::Flag::Debug "Platform::*Application::Configuration::Flag::Debug"
when creating context or only for some portions of the code using
@ref Renderer::Feature::DebugOutput. If enabled globally, some OpenGL drivers
@ -135,42 +135,42 @@ class MAGNUM_EXPORT DebugOutput {
*/
enum class Source: GLenum {
/** OpenGL */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Api = GL_DEBUG_SOURCE_API,
#else
Api = GL_DEBUG_SOURCE_API_KHR,
#endif
/** Window system (GLX, WGL) */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM,
#else
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR,
#endif
/** Shader compiler */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
#endif
/** The application */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION,
#else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR,
#endif
/** Any other source */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_SOURCE_OTHER
#else
Other = GL_DEBUG_SOURCE_OTHER_KHR
@ -185,63 +185,63 @@ class MAGNUM_EXPORT DebugOutput {
*/
enum class Type: GLenum {
/** OpenGL error */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Error = GL_DEBUG_TYPE_ERROR,
#else
Error = GL_DEBUG_TYPE_ERROR_KHR,
#endif
/** Behavior that has been marked for deprecation */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
Portability = GL_DEBUG_TYPE_PORTABILITY,
#else
Portability = GL_DEBUG_TYPE_PORTABILITY_KHR,
#endif
/** Implementation-dependent performance warning */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Performance = GL_DEBUG_TYPE_PERFORMANCE,
#else
Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR,
#endif
/** Annotation of the command stream */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Marker = GL_DEBUG_TYPE_MARKER,
#else
Marker = GL_DEBUG_TYPE_MARKER_KHR,
#endif
/** Entering a debug group */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
PushGroup = GL_DEBUG_TYPE_PUSH_GROUP,
#else
PushGroup = GL_DEBUG_TYPE_PUSH_GROUP_KHR,
#endif
/** Leaving a debug group */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
PopGroup = GL_DEBUG_TYPE_POP_GROUP,
#else
PopGroup = GL_DEBUG_TYPE_POP_GROUP_KHR,
#endif
/** Any other type */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_TYPE_OTHER,
#else
Other = GL_DEBUG_TYPE_OTHER_KHR,
@ -259,7 +259,7 @@ class MAGNUM_EXPORT DebugOutput {
* Any OpenGL error, dangerous undefined behavior, shader
* compilation errors.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
High = GL_DEBUG_SEVERITY_HIGH,
#else
High = GL_DEBUG_SEVERITY_HIGH_KHR,
@ -269,21 +269,21 @@ class MAGNUM_EXPORT DebugOutput {
* Severe performance warnings, shader compilation warnings, use of
* deprecated behavior.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Medium = GL_DEBUG_SEVERITY_MEDIUM,
#else
Medium = GL_DEBUG_SEVERITY_MEDIUM_KHR,
#endif
/** Minor performance warnings, trivial undefined behavior. */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
Notification = GL_DEBUG_SEVERITY_NOTIFICATION
#else
Notification = GL_DEBUG_SEVERITY_NOTIFICATION_KHR
@ -301,9 +301,10 @@ class MAGNUM_EXPORT DebugOutput {
* @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 (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, returns @cpp 0 @ce.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} desktop or ES extension (covered also by
* @extension{ANDROID,extension_pack_es31a}) is not available, returns
* @cpp 0 @ce.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_LOGGED_MESSAGES}
*/
static Int maxLoggedMessages();
@ -312,9 +313,10 @@ class MAGNUM_EXPORT DebugOutput {
* @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 (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, returns @cpp 0 @ce.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} desktop or ES extension (covered also by
* @extension{ANDROID,extension_pack_es31a}) is not available, returns
* @cpp 0 @ce.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_MESSAGE_LENGTH}
*/
static Int maxMessageLength();
@ -328,9 +330,10 @@ class MAGNUM_EXPORT DebugOutput {
* set in parent debug group. See @ref DebugGroup documentation
* for more information.
*
* If OpenGL 4.3 is not supported and @extension{KHR,debug} desktop or
* ES extension (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, this function does nothing.
* If OpenGL 4.3 / OpenGL ES 3.2 is not supported and @extension{KHR,debug}
* desktop or ES extension (covered also by
* @extension{ANDROID,extension_pack_es31a}) is not available, this
* function does nothing.
* @see @ref Renderer::Feature::DebugOutput,
* @fn_gl_keyword{DebugMessageControl}
*/
@ -382,10 +385,10 @@ class MAGNUM_EXPORT DebugOutput {
* @brief Set debug message callback
*
* The messages are sent to the callback only if
* @ref Renderer::Feature::DebugOutput is enabled. If OpenGL 4.3 is not
* supported and @extension{KHR,debug} desktop or ES extension (covered
* also by @extension{ANDROID,extension_pack_es31a}) is not
* available, this function does nothing.
* @ref Renderer::Feature::DebugOutput is enabled. If OpenGL 4.3 /
* OpenGL ES 3.2 is not supported and @extension{KHR,debug} desktop or
* ES extension (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, this function does nothing.
* @see @ref setDefaultCallback(),
* @ref Renderer::Feature::DebugOutputSynchronous,
* @fn_gl_keyword{DebugMessageCallback}
@ -416,10 +419,20 @@ class MAGNUM_EXPORT DebugOutput {
private:
static void setEnabledInternal(GLenum source, GLenum type, GLenum severity, std::initializer_list<UnsignedInt> ids, bool enabled);
static MAGNUM_LOCAL void controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list<UnsignedInt>, bool);
static MAGNUM_LOCAL void controlImplementationKhr(GLenum source, GLenum type, GLenum severity, std::initializer_list<UnsignedInt> ids, bool enabled);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void controlImplementationKhrDesktopES32(GLenum source, GLenum type, GLenum severity, std::initializer_list<UnsignedInt> ids, bool enabled);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void controlImplementationKhrES(GLenum source, GLenum type, GLenum severity, std::initializer_list<UnsignedInt> ids, bool enabled);
#endif
static MAGNUM_LOCAL void callbackImplementationNoOp(Callback, const void*);
static MAGNUM_LOCAL void callbackImplementationKhr(Callback callback, const void* userParam);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void callbackImplementationKhrDesktopES32(Callback callback, const void* userParam);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void callbackImplementationKhrES(Callback callback, const void* userParam);
#endif
};
/** @debugoperatorclassenum{Magnum::DebugOutput,Magnum::DebugOutput::Source} */
@ -442,10 +455,11 @@ gDEBugger.
See @ref DebugOutput for introduction.
If OpenGL 4.3 is supported or @extension{KHR,debug} desktop or ES extension
(covered also by @extension{ANDROID,extension_pack_es31a}) is available and
default debug output callback is enabled for given kind of messages, the
inserted message will be printed on standard output in the following form:
If OpenGL 4.3 / OpenGL ES 3.2 is supported or @extension{KHR,debug} desktop or
ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) is
available and default debug output callback is enabled for given kind of
messages, the inserted message will be printed on standard output in the
following form:
@code{.cpp}
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker,
@ -488,7 +502,7 @@ class MAGNUM_EXPORT DebugMessage {
* External debugger or third-party middleware
* @m_keywords{GL_DEBUG_SOURCE_THIRD_PARTY}
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
@ -498,10 +512,10 @@ class MAGNUM_EXPORT DebugMessage {
* The application
* @m_keywords{GL_DEBUG_SOURCE_APPLICATION}
*/
#ifndef MAGNUM_TARGET_GLES
Application = GL_DEBUG_SOURCE_APPLICATION,
#ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION
#else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR,
Application = GL_DEBUG_SOURCE_APPLICATION_KHR
#endif
};
@ -513,49 +527,49 @@ class MAGNUM_EXPORT DebugMessage {
*/
enum class Type: GLenum {
/** OpenGL error */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Error = GL_DEBUG_TYPE_ERROR,
#else
Error = GL_DEBUG_TYPE_ERROR_KHR,
#endif
/** Behavior that has been marked for deprecation */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES2
Portability = GL_DEBUG_TYPE_PORTABILITY,
#else
Portability = GL_DEBUG_TYPE_PORTABILITY_KHR,
#endif
/** Implementation-dependent performance warning */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Performance = GL_DEBUG_TYPE_PERFORMANCE,
#else
Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR,
#endif
/** Annotation of the command stream */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Marker = GL_DEBUG_TYPE_MARKER,
#else
Marker = GL_DEBUG_TYPE_MARKER_KHR,
#endif
/** Any other type */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_TYPE_OTHER
#else
Other = GL_DEBUG_TYPE_OTHER_KHR
@ -570,9 +584,9 @@ class MAGNUM_EXPORT DebugMessage {
* @param severity Message severity
* @param string The actual message
*
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug}
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor
* @extension{EXT,debug_marker} (desktop or ES extensions) nor
* If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_marker} (desktop or ES extensions) nor
* @extension{GREMEDY,string_marker} (desktop only extension) are
* available, this function does nothing.
*
@ -599,7 +613,12 @@ class MAGNUM_EXPORT DebugMessage {
private:
static void insertInternal(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView<const char> string);
static MAGNUM_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView<const char>);
static MAGNUM_LOCAL void insertImplementationKhr(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView<const char> string);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void insertImplementationKhrDesktopES32(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView<const char> string);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void insertImplementationKhrES(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView<const char> string);
#endif
static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView<const char> string);
#ifndef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView<const char> string);
@ -653,11 +672,11 @@ Renderer::disable(Renderer::Feature::Blending);
group.pop();
@endcode
If OpenGL 4.3 is supported or @extension{KHR,debug} desktop or ES extension
(covered also by @extension{ANDROID,extension_pack_es31a}) is available and
the default debug output callback is enabled for these kinds of messages, the
group entering and leaving will be printed on standard output in the following
form:
If OpenGL 4.3 / OpenGL ES 3.2 is supported or @extension{KHR,debug} desktop or
ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) is
available and the default debug output callback is enabled for these kinds of
messages, the group entering and leaving will be printed on standard output in
the following form:
@code{.shell-session}
Debug output: application debug group enter (42): Scene rendering
@ -667,8 +686,8 @@ Debug output: application debug group leave (42): Scene rendering
If only @extension{EXT,debug_marker} is available, the group can be seen only
through graphics debugger.
If OpenGL 4.3 is not supported and neither @extension{KHR,debug} nor
@extension{EXT,debug_marker} are available, the functions are essentially a
If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither @extension{KHR,debug}
nor @extension{EXT,debug_marker} are available, the functions are essentially a
no-op.
@attention To avoid accidental debug group stack overflow/underflow, you cannot
@ -708,14 +727,14 @@ class MAGNUM_EXPORT DebugGroup {
*/
enum class Source: GLenum {
/** External debugger or third-party middleware */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
#endif
/** The application */
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION
#else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR
@ -726,9 +745,10 @@ class MAGNUM_EXPORT DebugGroup {
* @brief Max debug group stack depth
*
* 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 (covered also by @extension{ANDROID,extension_pack_es31a})
* is not available, returns @cpp 0 @ce.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} desktop or ES extension (covered also by
* @extension{ANDROID,extension_pack_es31a}) is not available, returns
* `0`.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_GROUP_STACK_DEPTH}
*/
static Int maxStackDepth();
@ -770,9 +790,9 @@ class MAGNUM_EXPORT DebugGroup {
* @ref DebugOutput::Type::PushGroup and
* @ref DebugOutput::Severity::Notification.
*
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug}
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor
* @extension{EXT,debug_marker} is available, this function does
* If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_marker} is available, this function does
* nothing. If @extension{KHR,debug} is not available and only
* @extension{EXT,debug_marker} is available, only @p message is used
* and all other parameters are ignored.
@ -799,9 +819,9 @@ class MAGNUM_EXPORT DebugGroup {
* @ref DebugOutput::Type::PopGroup and
* @ref DebugOutput::Severity::Notification.
*
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug}
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor
* @extension{EXT,debug_marker} is available, this function does
* If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_marker} is available, this function does
* nothing.
* @see @ref push(), @ref Renderer::Error::StackUnderflow,
* @fn_gl_keyword{PopDebugGroup} or
@ -813,11 +833,21 @@ class MAGNUM_EXPORT DebugGroup {
void pushInternal(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
static MAGNUM_LOCAL void pushImplementationNoOp(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
static MAGNUM_LOCAL void pushImplementationKhr(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void pushImplementationKhrDesktopES32(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void pushImplementationKhrES(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
#endif
static MAGNUM_LOCAL void pushImplementationExt(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
static MAGNUM_LOCAL void popImplementationNoOp();
static MAGNUM_LOCAL void popImplementationKhr();
#ifndef MAGNUM_TARGET_GLES2
static MAGNUM_LOCAL void popImplementationKhrDesktopES32();
#endif
#ifdef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void popImplementationKhrES();
#endif
static MAGNUM_LOCAL void popImplementationExt();
bool _active;

17
src/Magnum/Framebuffer.h

@ -428,10 +428,11 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* @brief Framebuffer label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{FRAMEBUFFER}
@ -443,10 +444,10 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* @brief Set framebuffer label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{FRAMEBUFFER}

42
src/Magnum/Implementation/DebugState.cpp

@ -38,18 +38,42 @@ DebugState::DebugState(Context& context, std::vector<std::string>& extensions):
maxStackDepth{0},
messageCallback(nullptr)
{
if(context.isExtensionSupported<Extensions::GL::KHR::debug>()) {
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::KHR::debug>())
#else
if(context.isVersionSupported(Version::GLES320))
#endif
{
#ifndef MAGNUM_TARGET_GLES
extensions.emplace_back(Extensions::GL::KHR::debug::string());
#endif
getLabelImplementation = &AbstractObject::getLabelImplementationKhr;
labelImplementation = &AbstractObject::labelImplementationKhr;
controlImplementation = &DebugOutput::controlImplementationKhr;
callbackImplementation = &DebugOutput::callbackImplementationKhr;
messageInsertImplementation = &DebugMessage::insertImplementationKhr;
pushGroupImplementation = &DebugGroup::pushImplementationKhr;
popGroupImplementation = &DebugGroup::popImplementationKhr;
getLabelImplementation = &AbstractObject::getLabelImplementationKhrDesktopES32;
labelImplementation = &AbstractObject::labelImplementationKhrDesktopES32;
controlImplementation = &DebugOutput::controlImplementationKhrDesktopES32;
callbackImplementation = &DebugOutput::callbackImplementationKhrDesktopES32;
messageInsertImplementation = &DebugMessage::insertImplementationKhrDesktopES32;
pushGroupImplementation = &DebugGroup::pushImplementationKhrDesktopES32;
popGroupImplementation = &DebugGroup::popImplementationKhrDesktopES32;
} else
#endif
#ifdef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::KHR::debug>()) {
extensions.emplace_back(Extensions::GL::KHR::debug::string());
} else {
getLabelImplementation = &AbstractObject::getLabelImplementationKhrES;
labelImplementation = &AbstractObject::labelImplementationKhrES;
controlImplementation = &DebugOutput::controlImplementationKhrES;
callbackImplementation = &DebugOutput::callbackImplementationKhrES;
messageInsertImplementation = &DebugMessage::insertImplementationKhrES;
pushGroupImplementation = &DebugGroup::pushImplementationKhrES;
popGroupImplementation = &DebugGroup::popImplementationKhrES;
} else
#endif
{
if(context.isExtensionSupported<Extensions::GL::EXT::debug_label>()) {
extensions.emplace_back(Extensions::GL::EXT::debug_label::string());

4
src/Magnum/Mesh.cpp

@ -205,7 +205,7 @@ inline void Mesh::createIfNotAlready() {
#ifndef MAGNUM_TARGET_WEBGL
std::string Mesh::label() {
createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_VERTEX_ARRAY, _id);
#else
return Context::current().state().debug->getLabelImplementation(GL_VERTEX_ARRAY_KHR, _id);
@ -214,7 +214,7 @@ std::string Mesh::label() {
Mesh& Mesh::setLabelInternal(const Containers::ArrayView<const char> label) {
createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_VERTEX_ARRAY, _id, label);
#else
Context::current().state().debug->labelImplementation(GL_VERTEX_ARRAY_KHR, _id, label);

19
src/Magnum/Mesh.h

@ -557,10 +557,11 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
* @brief Mesh label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{VERTEX_ARRAY_OBJECT_EXT}
@ -572,12 +573,12 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
* @brief Set mesh label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{VERTEX_ARRAY} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* @def_gl_keyword{VERTEX_ARRAY} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{VERTEX_ARRAY_OBJECT_EXT}
* @requires_gles Debug output is not available in WebGL.
*/

17
src/Magnum/Renderbuffer.h

@ -172,10 +172,11 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject {
* @brief Renderbuffer label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{RENDERBUFFER}
@ -187,10 +188,10 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject {
* @brief Set renderbuffer label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{RENDERBUFFER}

16
src/Magnum/Renderer.h

@ -106,11 +106,11 @@ class MAGNUM_EXPORT Renderer {
* @see @ref DebugOutput, @ref Feature::DebugOutputSynchronous,
* @ref Platform::Sdl2Application::Configuration::Flag::Debug "Platform::*Application::Configuration::Flag::Debug"
* @requires_gl43 Extension @extension{KHR,debug}
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a}/
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
* @extension2{KHR,debug,debug}
* @requires_gles Debug output is not available in WebGL.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
DebugOutput = GL_DEBUG_OUTPUT,
#else
DebugOutput = GL_DEBUG_OUTPUT_KHR,
@ -121,11 +121,11 @@ class MAGNUM_EXPORT Renderer {
* @ref Feature::DebugOutput is enabled.
* @see @ref DebugMessage
* @requires_gl43 Extension @extension{KHR,debug}
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a}/
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
* @extension2{KHR,debug,debug}
* @requires_gles Debug output is not available in WebGL.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS,
#else
DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR,
@ -1451,11 +1451,11 @@ class MAGNUM_EXPORT Renderer {
* Given operation would cause an internal stack to underflow.
* @see @ref DebugGroup
* @requires_gl43 Extension @extension{KHR,debug}
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a}/
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
* @extension2{KHR,debug,debug}
* @requires_gles Debug output is not available in WebGL.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
StackUnderflow = GL_STACK_UNDERFLOW,
#else
StackUnderflow = GL_STACK_UNDERFLOW_KHR,
@ -1465,11 +1465,11 @@ class MAGNUM_EXPORT Renderer {
* Given operation would cause an internal stack to overflow.
* @see @ref DebugGroup
* @requires_gl43 Extension @extension{KHR,debug}
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a}/
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
* @extension2{KHR,debug,debug}
* @requires_gles Debug output is not available in WebGL.
*/
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
StackOverflow = GL_STACK_OVERFLOW
#else
StackOverflow = GL_STACK_OVERFLOW_KHR

4
src/Magnum/Shader.cpp

@ -686,7 +686,7 @@ Shader::~Shader() {
#ifndef MAGNUM_TARGET_WEBGL
std::string Shader::label() const {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_SHADER, _id);
#else
return Context::current().state().debug->getLabelImplementation(GL_SHADER_KHR, _id);
@ -694,7 +694,7 @@ std::string Shader::label() const {
}
Shader& Shader::setLabelInternal(const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_SHADER, _id, label);
#else
Context::current().state().debug->labelImplementation(GL_SHADER_KHR, _id, label);

17
src/Magnum/Shader.h

@ -537,10 +537,11 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Shader label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{SHADER} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{SHADER_OBJECT_EXT}
@ -552,10 +553,10 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Set shader label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{SHADER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{SHADER_OBJECT_EXT}

17
src/Magnum/TransformFeedback.h

@ -243,10 +243,11 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject {
* @brief Transform feedback label
*
* The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function returns empty string.
* OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label}
* with @def_gl{TRANSFORM_FEEDBACK}
@ -258,10 +259,10 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject {
* @brief Set transform feedback label
* @return Reference to self (for method chaining)
*
* Default is empty string. If OpenGL 4.3 is not supported and neither
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* nor @extension{EXT,debug_label} desktop or ES extension is
* available, this function does nothing.
* Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* supported and neither @extension{KHR,debug} (covered also by
* @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{TRANSFORM_FEEDBACK}

Loading…
Cancel
Save