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

23
src/Magnum/AbstractObject.h

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

4
src/Magnum/AbstractQuery.cpp

@ -72,7 +72,7 @@ void AbstractQuery::createImplementationDSA() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string AbstractQuery::label() const { std::string AbstractQuery::label() const {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_QUERY, _id); return Context::current().state().debug->getLabelImplementation(GL_QUERY, _id);
#else #else
return Context::current().state().debug->getLabelImplementation(GL_QUERY_KHR, _id); 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) { 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); Context::current().state().debug->labelImplementation(GL_QUERY, _id, label);
#else #else
Context::current().state().debug->labelImplementation(GL_QUERY_KHR, _id, label); 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 * @brief Query label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{QUERY} or * @see @fn_gl_keyword{GetObjectLabel} with @def_gl{QUERY} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{QUERY_OBJECT_EXT} * @def_gl{QUERY_OBJECT_EXT}
@ -101,10 +102,10 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
* @brief Set query label * @brief Set query label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{QUERY} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label} * @def_gl{QUERY} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{QUERY_OBJECT_EXT} * with @def_gl{QUERY_OBJECT_EXT}

4
src/Magnum/AbstractShaderProgram.cpp

@ -301,7 +301,7 @@ AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&&
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string AbstractShaderProgram::label() const { std::string AbstractShaderProgram::label() const {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_PROGRAM, _id); return Context::current().state().debug->getLabelImplementation(GL_PROGRAM, _id);
#else #else
return Context::current().state().debug->getLabelImplementation(GL_PROGRAM_KHR, _id); 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) { 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); Context::current().state().debug->labelImplementation(GL_PROGRAM, _id, label);
#else #else
Context::current().state().debug->labelImplementation(GL_PROGRAM_KHR, _id, label); 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 * @brief Shader program label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{PROGRAM} or * @see @fn_gl_keyword{GetObjectLabel} with @def_gl{PROGRAM} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{PROGRAM_OBJECT_EXT} * @def_gl{PROGRAM_OBJECT_EXT}
@ -781,10 +782,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Set shader program label * @brief Set shader program label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{PROGRAM} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label} * @def_gl{PROGRAM} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{PROGRAM_OBJECT_EXT} * with @def_gl{PROGRAM_OBJECT_EXT}

17
src/Magnum/AbstractTexture.h

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

4
src/Magnum/Buffer.cpp

@ -202,7 +202,7 @@ inline void Buffer::createIfNotAlready() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string Buffer::label() { std::string Buffer::label() {
createIfNotAlready(); createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_BUFFER, _id); return Context::current().state().debug->getLabelImplementation(GL_BUFFER, _id);
#else #else
return Context::current().state().debug->getLabelImplementation(GL_BUFFER_KHR, _id); 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) { Buffer& Buffer::setLabelInternal(const Containers::ArrayView<const char> label) {
createIfNotAlready(); createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_BUFFER, _id, label); Context::current().state().debug->labelImplementation(GL_BUFFER, _id, label);
#else #else
Context::current().state().debug->labelImplementation(GL_BUFFER_KHR, _id, label); 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 * @brief Buffer label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{BUFFER} or * @see @fn_gl_keyword{GetObjectLabel} with @def_gl{BUFFER} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{BUFFER_OBJECT_EXT} * @def_gl{BUFFER_OBJECT_EXT}
@ -858,10 +859,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Set buffer label * @brief Set buffer label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{BUFFER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label} * @def_gl{BUFFER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{BUFFER_OBJECT_EXT} * with @def_gl{BUFFER_OBJECT_EXT}

4
src/Magnum/Context.h

@ -138,10 +138,10 @@ class MAGNUM_EXPORT Context {
/** /**
* Debug context * Debug context
* @requires_gl43 Extension @extension{KHR,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} * @extension2{KHR,debug,debug}
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Debug = GL_CONTEXT_FLAG_DEBUG_BIT, Debug = GL_CONTEXT_FLAG_DEBUG_BIT,
#else #else
Debug = GL_CONTEXT_FLAG_DEBUG_BIT_KHR, 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; GLint& value = Context::current().state().debug->maxLoggedMessages;
if(value == 0) { if(value == 0) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES, &value); glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES, &value);
#else #else
glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES_KHR, &value); glGetIntegerv(GL_MAX_DEBUG_LOGGED_MESSAGES_KHR, &value);
@ -144,7 +144,7 @@ Int DebugOutput::maxMessageLength() {
GLint& value = Context::current().state().debug->maxMessageLength; GLint& value = Context::current().state().debug->maxMessageLength;
if(value == 0) { if(value == 0) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &value); glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &value);
#else #else
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH_KHR, &value); 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::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_GLES2
#ifndef MAGNUM_TARGET_GLES void DebugOutput::controlImplementationKhrDesktopES32(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list<UnsignedInt> ids, const bool enabled) {
glDebugMessageControl glDebugMessageControl(source, type, severity, ids.size(), ids.begin(), enabled);
#else
glDebugMessageControlKHR
#endif
(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::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 */ /* Replace the callback */
const Callback original = Context::current().state().debug->messageCallback; const Callback original = Context::current().state().debug->messageCallback;
Context::current().state().debug->messageCallback = callback; Context::current().state().debug->messageCallback = callback;
/* Adding callback */ /* Adding callback */
if(!original && callback) { if(!original && callback)
#ifndef MAGNUM_TARGET_GLES glDebugMessageCallback(callbackWrapper, userParam);
glDebugMessageCallback
#else
glDebugMessageCallbackKHR
#endif
(callbackWrapper, userParam);
/* Deleting callback */ /* Deleting callback */
} else if(original && !callback) { else if(original && !callback)
#ifndef MAGNUM_TARGET_GLES glDebugMessageCallback(nullptr, nullptr);
glDebugMessageCallback }
#else #endif
glDebugMessageCallbackKHR
#endif #ifdef MAGNUM_TARGET_GLES
(nullptr, nullptr); 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 #ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DebugOutput::Source value) { 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::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_GLES2
#ifndef MAGNUM_TARGET_GLES void DebugMessage::insertImplementationKhrDesktopES32(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView<const char> string) {
glDebugMessageInsert glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
#else
glDebugMessageInsertKHR
#endif
(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) { void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView<const char> string) {
glInsertEventMarkerEXT(string.size(), string.data()); glInsertEventMarkerEXT(string.size(), string.data());
@ -319,7 +332,7 @@ Int DebugGroup::maxStackDepth() {
GLint& value = Context::current().state().debug->maxStackDepth; GLint& value = Context::current().state().debug->maxStackDepth;
if(value == 0) { if(value == 0) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAX_DEBUG_GROUP_STACK_DEPTH, &value); glGetIntegerv(GL_MAX_DEBUG_GROUP_STACK_DEPTH, &value);
#else #else
glGetIntegerv(GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR, &value); 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::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_GLES2
#ifndef MAGNUM_TARGET_GLES void DebugGroup::pushImplementationKhrDesktopES32(const Source source, const UnsignedInt id, const Containers::ArrayView<const char> message) {
glPushDebugGroup glPushDebugGroup(GLenum(source), id, message.size(), message.data());
#else
glPushDebugGroupKHR
#endif
(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) { void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::ArrayView<const char> message) {
glPushGroupMarkerEXT(message.size(), message.data()); glPushGroupMarkerEXT(message.size(), message.data());
@ -358,13 +374,17 @@ void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::Ar
void DebugGroup::popImplementationNoOp() {} void DebugGroup::popImplementationNoOp() {}
void DebugGroup::popImplementationKhr() { #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES void DebugGroup::popImplementationKhrDesktopES32() {
glPopDebugGroup(); glPopDebugGroup();
#else }
#endif
#ifdef MAGNUM_TARGET_GLES
void DebugGroup::popImplementationKhrES() {
glPopDebugGroupKHR(); glPopDebugGroupKHR();
#endif
} }
#endif
void DebugGroup::popImplementationExt() { void DebugGroup::popImplementationExt() {
glPopGroupMarkerEXT(); 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 @section Magnum-DebugOutput-usage Basic usage
Support for debug output is provided by OpenGL 4.3 or @extension{KHR,debug} Support for debug output is provided by OpenGL 4.3 / OpenGL ES 3.2 or
(desktop/ES extension, covered also by @extension{ANDROID,extension_pack_es31a}). @extension{KHR,debug} (desktop/ES extension, covered also by
Subset of the functionality is provided also by @extension{EXT,debug_marker} @extension{ANDROID,extension_pack_es31a}). Subset of the functionality is
(desktop/ES extensions) or @extension{GREMEDY,string_marker} (desktop only provided also by @extension{EXT,debug_marker} (desktop/ES extensions) or
extension). @extension{GREMEDY,string_marker} (desktop only extension).
With OpenGL 4.3 or @extension{KHR,debug} desktop/ES extension, the debug output With OpenGL 4.3 / OpenGL ES 3.2 or @extension{KHR,debug} desktop/ES extension,
needs to be enabled first. It can be enabled globally using 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" @ref Platform::Sdl2Application::Configuration::Flag::Debug "Platform::*Application::Configuration::Flag::Debug"
when creating context or only for some portions of the code using when creating context or only for some portions of the code using
@ref Renderer::Feature::DebugOutput. If enabled globally, some OpenGL drivers @ref Renderer::Feature::DebugOutput. If enabled globally, some OpenGL drivers
@ -135,42 +135,42 @@ class MAGNUM_EXPORT DebugOutput {
*/ */
enum class Source: GLenum { enum class Source: GLenum {
/** OpenGL */ /** OpenGL */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Api = GL_DEBUG_SOURCE_API, Api = GL_DEBUG_SOURCE_API,
#else #else
Api = GL_DEBUG_SOURCE_API_KHR, Api = GL_DEBUG_SOURCE_API_KHR,
#endif #endif
/** Window system (GLX, WGL) */ /** Window system (GLX, WGL) */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM, WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM,
#else #else
WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR, WindowSystem = GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR,
#endif #endif
/** Shader compiler */ /** Shader compiler */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER, ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER,
#else #else
ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER_KHR, ShaderCompiler = GL_DEBUG_SOURCE_SHADER_COMPILER_KHR,
#endif #endif
/** External debugger or third-party middleware */ /** External debugger or third-party middleware */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else #else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
#endif #endif
/** The application */ /** The application */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION, Application = GL_DEBUG_SOURCE_APPLICATION,
#else #else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR, Application = GL_DEBUG_SOURCE_APPLICATION_KHR,
#endif #endif
/** Any other source */ /** Any other source */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_SOURCE_OTHER Other = GL_DEBUG_SOURCE_OTHER
#else #else
Other = GL_DEBUG_SOURCE_OTHER_KHR Other = GL_DEBUG_SOURCE_OTHER_KHR
@ -185,63 +185,63 @@ class MAGNUM_EXPORT DebugOutput {
*/ */
enum class Type: GLenum { enum class Type: GLenum {
/** OpenGL error */ /** OpenGL error */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Error = GL_DEBUG_TYPE_ERROR, Error = GL_DEBUG_TYPE_ERROR,
#else #else
Error = GL_DEBUG_TYPE_ERROR_KHR, Error = GL_DEBUG_TYPE_ERROR_KHR,
#endif #endif
/** Behavior that has been marked for deprecation */ /** Behavior that has been marked for deprecation */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR,
#else #else
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR, DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR,
#endif #endif
/** Behavior that is undefined according to the specification */ /** Behavior that is undefined according to the specification */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR,
#else #else
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR, UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR,
#endif #endif
/** Non-portable usage of extensions or shaders */ /** Non-portable usage of extensions or shaders */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Portability = GL_DEBUG_TYPE_PORTABILITY, Portability = GL_DEBUG_TYPE_PORTABILITY,
#else #else
Portability = GL_DEBUG_TYPE_PORTABILITY_KHR, Portability = GL_DEBUG_TYPE_PORTABILITY_KHR,
#endif #endif
/** Implementation-dependent performance warning */ /** Implementation-dependent performance warning */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Performance = GL_DEBUG_TYPE_PERFORMANCE, Performance = GL_DEBUG_TYPE_PERFORMANCE,
#else #else
Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR, Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR,
#endif #endif
/** Annotation of the command stream */ /** Annotation of the command stream */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Marker = GL_DEBUG_TYPE_MARKER, Marker = GL_DEBUG_TYPE_MARKER,
#else #else
Marker = GL_DEBUG_TYPE_MARKER_KHR, Marker = GL_DEBUG_TYPE_MARKER_KHR,
#endif #endif
/** Entering a debug group */ /** Entering a debug group */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
PushGroup = GL_DEBUG_TYPE_PUSH_GROUP, PushGroup = GL_DEBUG_TYPE_PUSH_GROUP,
#else #else
PushGroup = GL_DEBUG_TYPE_PUSH_GROUP_KHR, PushGroup = GL_DEBUG_TYPE_PUSH_GROUP_KHR,
#endif #endif
/** Leaving a debug group */ /** Leaving a debug group */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
PopGroup = GL_DEBUG_TYPE_POP_GROUP, PopGroup = GL_DEBUG_TYPE_POP_GROUP,
#else #else
PopGroup = GL_DEBUG_TYPE_POP_GROUP_KHR, PopGroup = GL_DEBUG_TYPE_POP_GROUP_KHR,
#endif #endif
/** Any other type */ /** Any other type */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_TYPE_OTHER, Other = GL_DEBUG_TYPE_OTHER,
#else #else
Other = GL_DEBUG_TYPE_OTHER_KHR, Other = GL_DEBUG_TYPE_OTHER_KHR,
@ -259,7 +259,7 @@ class MAGNUM_EXPORT DebugOutput {
* Any OpenGL error, dangerous undefined behavior, shader * Any OpenGL error, dangerous undefined behavior, shader
* compilation errors. * compilation errors.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
High = GL_DEBUG_SEVERITY_HIGH, High = GL_DEBUG_SEVERITY_HIGH,
#else #else
High = GL_DEBUG_SEVERITY_HIGH_KHR, High = GL_DEBUG_SEVERITY_HIGH_KHR,
@ -269,21 +269,21 @@ class MAGNUM_EXPORT DebugOutput {
* Severe performance warnings, shader compilation warnings, use of * Severe performance warnings, shader compilation warnings, use of
* deprecated behavior. * deprecated behavior.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Medium = GL_DEBUG_SEVERITY_MEDIUM, Medium = GL_DEBUG_SEVERITY_MEDIUM,
#else #else
Medium = GL_DEBUG_SEVERITY_MEDIUM_KHR, Medium = GL_DEBUG_SEVERITY_MEDIUM_KHR,
#endif #endif
/** Minor performance warnings, trivial undefined behavior. */ /** Minor performance warnings, trivial undefined behavior. */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Low = GL_DEBUG_SEVERITY_LOW, Low = GL_DEBUG_SEVERITY_LOW,
#else #else
Low = GL_DEBUG_SEVERITY_LOW_KHR, Low = GL_DEBUG_SEVERITY_LOW_KHR,
#endif #endif
/** Any message other than error or performance warning. */ /** Any message other than error or performance warning. */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Notification = GL_DEBUG_SEVERITY_NOTIFICATION Notification = GL_DEBUG_SEVERITY_NOTIFICATION
#else #else
Notification = GL_DEBUG_SEVERITY_NOTIFICATION_KHR Notification = GL_DEBUG_SEVERITY_NOTIFICATION_KHR
@ -301,9 +301,10 @@ class MAGNUM_EXPORT DebugOutput {
* @brief Max count of debug messages in log * @brief Max count of debug messages in log
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* desktop or ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) * @extension{KHR,debug} desktop or ES extension (covered also by
* is not available, returns @cpp 0 @ce. * @extension{ANDROID,extension_pack_es31a}) is not available, returns
* @cpp 0 @ce.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_LOGGED_MESSAGES} * @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_LOGGED_MESSAGES}
*/ */
static Int maxLoggedMessages(); static Int maxLoggedMessages();
@ -312,9 +313,10 @@ class MAGNUM_EXPORT DebugOutput {
* @brief Max debug message length * @brief Max debug message length
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* desktop or ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) * @extension{KHR,debug} desktop or ES extension (covered also by
* is not available, returns @cpp 0 @ce. * @extension{ANDROID,extension_pack_es31a}) is not available, returns
* @cpp 0 @ce.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_MESSAGE_LENGTH} * @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_MESSAGE_LENGTH}
*/ */
static Int maxMessageLength(); static Int maxMessageLength();
@ -328,9 +330,10 @@ class MAGNUM_EXPORT DebugOutput {
* set in parent debug group. See @ref DebugGroup documentation * set in parent debug group. See @ref DebugGroup documentation
* for more information. * for more information.
* *
* If OpenGL 4.3 is not supported and @extension{KHR,debug} desktop or * If OpenGL 4.3 / OpenGL ES 3.2 is not supported and @extension{KHR,debug}
* ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) * desktop or ES extension (covered also by
* is not available, this function does nothing. * @extension{ANDROID,extension_pack_es31a}) is not available, this
* function does nothing.
* @see @ref Renderer::Feature::DebugOutput, * @see @ref Renderer::Feature::DebugOutput,
* @fn_gl_keyword{DebugMessageControl} * @fn_gl_keyword{DebugMessageControl}
*/ */
@ -382,10 +385,10 @@ class MAGNUM_EXPORT DebugOutput {
* @brief Set debug message callback * @brief Set debug message callback
* *
* The messages are sent to the callback only if * The messages are sent to the callback only if
* @ref Renderer::Feature::DebugOutput is enabled. If OpenGL 4.3 is not * @ref Renderer::Feature::DebugOutput is enabled. If OpenGL 4.3 /
* supported and @extension{KHR,debug} desktop or ES extension (covered * OpenGL ES 3.2 is not supported and @extension{KHR,debug} desktop or
* also by @extension{ANDROID,extension_pack_es31a}) is not * ES extension (covered also by @extension{ANDROID,extension_pack_es31a})
* available, this function does nothing. * is not available, this function does nothing.
* @see @ref setDefaultCallback(), * @see @ref setDefaultCallback(),
* @ref Renderer::Feature::DebugOutputSynchronous, * @ref Renderer::Feature::DebugOutputSynchronous,
* @fn_gl_keyword{DebugMessageCallback} * @fn_gl_keyword{DebugMessageCallback}
@ -416,10 +419,20 @@ class MAGNUM_EXPORT DebugOutput {
private: private:
static void setEnabledInternal(GLenum source, GLenum type, GLenum severity, std::initializer_list<UnsignedInt> ids, bool enabled); 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 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 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} */ /** @debugoperatorclassenum{Magnum::DebugOutput,Magnum::DebugOutput::Source} */
@ -442,10 +455,11 @@ gDEBugger.
See @ref DebugOutput for introduction. See @ref DebugOutput for introduction.
If OpenGL 4.3 is supported or @extension{KHR,debug} desktop or ES extension If OpenGL 4.3 / OpenGL ES 3.2 is supported or @extension{KHR,debug} desktop or
(covered also by @extension{ANDROID,extension_pack_es31a}) is available and ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) is
default debug output callback is enabled for given kind of messages, the available and default debug output callback is enabled for given kind of
inserted message will be printed on standard output in the following form: messages, the inserted message will be printed on standard output in the
following form:
@code{.cpp} @code{.cpp}
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker, DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker,
@ -488,7 +502,7 @@ class MAGNUM_EXPORT DebugMessage {
* External debugger or third-party middleware * External debugger or third-party middleware
* @m_keywords{GL_DEBUG_SOURCE_THIRD_PARTY} * @m_keywords{GL_DEBUG_SOURCE_THIRD_PARTY}
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else #else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
@ -498,10 +512,10 @@ class MAGNUM_EXPORT DebugMessage {
* The application * The application
* @m_keywords{GL_DEBUG_SOURCE_APPLICATION} * @m_keywords{GL_DEBUG_SOURCE_APPLICATION}
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION, Application = GL_DEBUG_SOURCE_APPLICATION
#else #else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR, Application = GL_DEBUG_SOURCE_APPLICATION_KHR
#endif #endif
}; };
@ -513,49 +527,49 @@ class MAGNUM_EXPORT DebugMessage {
*/ */
enum class Type: GLenum { enum class Type: GLenum {
/** OpenGL error */ /** OpenGL error */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Error = GL_DEBUG_TYPE_ERROR, Error = GL_DEBUG_TYPE_ERROR,
#else #else
Error = GL_DEBUG_TYPE_ERROR_KHR, Error = GL_DEBUG_TYPE_ERROR_KHR,
#endif #endif
/** Behavior that has been marked for deprecation */ /** Behavior that has been marked for deprecation */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR,
#else #else
DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR, DeprecatedBehavior = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR,
#endif #endif
/** Behavior that is undefined according to the specification */ /** Behavior that is undefined according to the specification */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR,
#else #else
UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR, UndefinedBehavior = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR,
#endif #endif
/** Non-portable usage of extensions or shaders */ /** Non-portable usage of extensions or shaders */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Portability = GL_DEBUG_TYPE_PORTABILITY, Portability = GL_DEBUG_TYPE_PORTABILITY,
#else #else
Portability = GL_DEBUG_TYPE_PORTABILITY_KHR, Portability = GL_DEBUG_TYPE_PORTABILITY_KHR,
#endif #endif
/** Implementation-dependent performance warning */ /** Implementation-dependent performance warning */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Performance = GL_DEBUG_TYPE_PERFORMANCE, Performance = GL_DEBUG_TYPE_PERFORMANCE,
#else #else
Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR, Performance = GL_DEBUG_TYPE_PERFORMANCE_KHR,
#endif #endif
/** Annotation of the command stream */ /** Annotation of the command stream */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Marker = GL_DEBUG_TYPE_MARKER, Marker = GL_DEBUG_TYPE_MARKER,
#else #else
Marker = GL_DEBUG_TYPE_MARKER_KHR, Marker = GL_DEBUG_TYPE_MARKER_KHR,
#endif #endif
/** Any other type */ /** Any other type */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Other = GL_DEBUG_TYPE_OTHER Other = GL_DEBUG_TYPE_OTHER
#else #else
Other = GL_DEBUG_TYPE_OTHER_KHR Other = GL_DEBUG_TYPE_OTHER_KHR
@ -570,9 +584,9 @@ class MAGNUM_EXPORT DebugMessage {
* @param severity Message severity * @param severity Message severity
* @param string The actual message * @param string The actual message
* *
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug} * If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor * @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* @extension{EXT,debug_marker} (desktop or ES extensions) nor * nor @extension{EXT,debug_marker} (desktop or ES extensions) nor
* @extension{GREMEDY,string_marker} (desktop only extension) are * @extension{GREMEDY,string_marker} (desktop only extension) are
* available, this function does nothing. * available, this function does nothing.
* *
@ -599,7 +613,12 @@ class MAGNUM_EXPORT DebugMessage {
private: private:
static void insertInternal(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView<const char> string); 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 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); static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView<const char> string);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView<const char> string); 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(); group.pop();
@endcode @endcode
If OpenGL 4.3 is supported or @extension{KHR,debug} desktop or ES extension If OpenGL 4.3 / OpenGL ES 3.2 is supported or @extension{KHR,debug} desktop or
(covered also by @extension{ANDROID,extension_pack_es31a}) is available and ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) is
the default debug output callback is enabled for these kinds of messages, the available and the default debug output callback is enabled for these kinds of
group entering and leaving will be printed on standard output in the following messages, the group entering and leaving will be printed on standard output in
form: the following form:
@code{.shell-session} @code{.shell-session}
Debug output: application debug group enter (42): Scene rendering 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 If only @extension{EXT,debug_marker} is available, the group can be seen only
through graphics debugger. through graphics debugger.
If OpenGL 4.3 is not supported and neither @extension{KHR,debug} nor If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither @extension{KHR,debug}
@extension{EXT,debug_marker} are available, the functions are essentially a nor @extension{EXT,debug_marker} are available, the functions are essentially a
no-op. no-op.
@attention To avoid accidental debug group stack overflow/underflow, you cannot @attention To avoid accidental debug group stack overflow/underflow, you cannot
@ -708,14 +727,14 @@ class MAGNUM_EXPORT DebugGroup {
*/ */
enum class Source: GLenum { enum class Source: GLenum {
/** External debugger or third-party middleware */ /** External debugger or third-party middleware */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY,
#else #else
ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR, ThirdParty = GL_DEBUG_SOURCE_THIRD_PARTY_KHR,
#endif #endif
/** The application */ /** The application */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Application = GL_DEBUG_SOURCE_APPLICATION Application = GL_DEBUG_SOURCE_APPLICATION
#else #else
Application = GL_DEBUG_SOURCE_APPLICATION_KHR Application = GL_DEBUG_SOURCE_APPLICATION_KHR
@ -726,9 +745,10 @@ class MAGNUM_EXPORT DebugGroup {
* @brief Max debug group stack depth * @brief Max debug group stack depth
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and @extension{KHR,debug} * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* desktop or ES extension (covered also by @extension{ANDROID,extension_pack_es31a}) * @extension{KHR,debug} desktop or ES extension (covered also by
* is not available, returns @cpp 0 @ce. * @extension{ANDROID,extension_pack_es31a}) is not available, returns
* `0`.
* @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_GROUP_STACK_DEPTH} * @see @fn_gl{Get} with @def_gl_keyword{MAX_DEBUG_GROUP_STACK_DEPTH}
*/ */
static Int maxStackDepth(); static Int maxStackDepth();
@ -770,9 +790,9 @@ class MAGNUM_EXPORT DebugGroup {
* @ref DebugOutput::Type::PushGroup and * @ref DebugOutput::Type::PushGroup and
* @ref DebugOutput::Severity::Notification. * @ref DebugOutput::Severity::Notification.
* *
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug} * If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor * @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* @extension{EXT,debug_marker} is available, this function does * nor @extension{EXT,debug_marker} is available, this function does
* nothing. If @extension{KHR,debug} is not available and only * nothing. If @extension{KHR,debug} is not available and only
* @extension{EXT,debug_marker} is available, only @p message is used * @extension{EXT,debug_marker} is available, only @p message is used
* and all other parameters are ignored. * and all other parameters are ignored.
@ -799,9 +819,9 @@ class MAGNUM_EXPORT DebugGroup {
* @ref DebugOutput::Type::PopGroup and * @ref DebugOutput::Type::PopGroup and
* @ref DebugOutput::Severity::Notification. * @ref DebugOutput::Severity::Notification.
* *
* If OpenGL 4.3 is not supported and neither @extension{KHR,debug} * If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither
* (covered also by @extension{ANDROID,extension_pack_es31a}) nor * @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a})
* @extension{EXT,debug_marker} is available, this function does * nor @extension{EXT,debug_marker} is available, this function does
* nothing. * nothing.
* @see @ref push(), @ref Renderer::Error::StackUnderflow, * @see @ref push(), @ref Renderer::Error::StackUnderflow,
* @fn_gl_keyword{PopDebugGroup} or * @fn_gl_keyword{PopDebugGroup} or
@ -813,11 +833,21 @@ class MAGNUM_EXPORT DebugGroup {
void pushInternal(Source source, UnsignedInt id, Containers::ArrayView<const char> message); 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 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 pushImplementationExt(Source source, UnsignedInt id, Containers::ArrayView<const char> message);
static MAGNUM_LOCAL void popImplementationNoOp(); 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(); static MAGNUM_LOCAL void popImplementationExt();
bool _active; bool _active;

17
src/Magnum/Framebuffer.h

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

42
src/Magnum/Implementation/DebugState.cpp

@ -38,18 +38,42 @@ DebugState::DebugState(Context& context, std::vector<std::string>& extensions):
maxStackDepth{0}, maxStackDepth{0},
messageCallback(nullptr) 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()); extensions.emplace_back(Extensions::GL::KHR::debug::string());
#endif
getLabelImplementation = &AbstractObject::getLabelImplementationKhr; getLabelImplementation = &AbstractObject::getLabelImplementationKhrDesktopES32;
labelImplementation = &AbstractObject::labelImplementationKhr; labelImplementation = &AbstractObject::labelImplementationKhrDesktopES32;
controlImplementation = &DebugOutput::controlImplementationKhr; controlImplementation = &DebugOutput::controlImplementationKhrDesktopES32;
callbackImplementation = &DebugOutput::callbackImplementationKhr; callbackImplementation = &DebugOutput::callbackImplementationKhrDesktopES32;
messageInsertImplementation = &DebugMessage::insertImplementationKhr; messageInsertImplementation = &DebugMessage::insertImplementationKhrDesktopES32;
pushGroupImplementation = &DebugGroup::pushImplementationKhr; pushGroupImplementation = &DebugGroup::pushImplementationKhrDesktopES32;
popGroupImplementation = &DebugGroup::popImplementationKhr; 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>()) { if(context.isExtensionSupported<Extensions::GL::EXT::debug_label>()) {
extensions.emplace_back(Extensions::GL::EXT::debug_label::string()); 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 #ifndef MAGNUM_TARGET_WEBGL
std::string Mesh::label() { std::string Mesh::label() {
createIfNotAlready(); createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_VERTEX_ARRAY, _id); return Context::current().state().debug->getLabelImplementation(GL_VERTEX_ARRAY, _id);
#else #else
return Context::current().state().debug->getLabelImplementation(GL_VERTEX_ARRAY_KHR, _id); 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) { Mesh& Mesh::setLabelInternal(const Containers::ArrayView<const char> label) {
createIfNotAlready(); createIfNotAlready();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Context::current().state().debug->labelImplementation(GL_VERTEX_ARRAY, _id, label); Context::current().state().debug->labelImplementation(GL_VERTEX_ARRAY, _id, label);
#else #else
Context::current().state().debug->labelImplementation(GL_VERTEX_ARRAY_KHR, _id, label); 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 * @brief Mesh label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or * @see @fn_gl_keyword{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{VERTEX_ARRAY_OBJECT_EXT} * @def_gl{VERTEX_ARRAY_OBJECT_EXT}
@ -572,12 +573,12 @@ class MAGNUM_EXPORT Mesh: public AbstractObject {
* @brief Set mesh label * @brief Set mesh label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with * @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} * with @def_gl{VERTEX_ARRAY_OBJECT_EXT}
* @requires_gles Debug output is not available in WebGL. * @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 * @brief Renderbuffer label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or * @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{RENDERBUFFER} * @def_gl{RENDERBUFFER}
@ -187,10 +188,10 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject {
* @brief Set renderbuffer label * @brief Set renderbuffer label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with * @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{RENDERBUFFER} * @def_gl{RENDERBUFFER}

16
src/Magnum/Renderer.h

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

4
src/Magnum/Shader.cpp

@ -686,7 +686,7 @@ Shader::~Shader() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string Shader::label() const { std::string Shader::label() const {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
return Context::current().state().debug->getLabelImplementation(GL_SHADER, _id); return Context::current().state().debug->getLabelImplementation(GL_SHADER, _id);
#else #else
return Context::current().state().debug->getLabelImplementation(GL_SHADER_KHR, _id); 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) { 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); Context::current().state().debug->labelImplementation(GL_SHADER, _id, label);
#else #else
Context::current().state().debug->labelImplementation(GL_SHADER_KHR, _id, label); 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 * @brief Shader label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} with @def_gl{SHADER} or * @see @fn_gl_keyword{GetObjectLabel} with @def_gl{SHADER} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} with
* @def_gl{SHADER_OBJECT_EXT} * @def_gl{SHADER_OBJECT_EXT}
@ -552,10 +553,10 @@ class MAGNUM_EXPORT Shader: public AbstractObject {
* @brief Set shader label * @brief Set shader label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} with
* @def_gl{SHADER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label} * @def_gl{SHADER} or @fn_gl_extension_keyword{LabelObject,EXT,debug_label}
* with @def_gl{SHADER_OBJECT_EXT} * 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 * @brief Transform feedback label
* *
* The result is *not* cached, repeated queries will result in repeated * The result is *not* cached, repeated queries will result in repeated
* OpenGL calls. If OpenGL 4.3 is not supported and neither * OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function returns empty string. * desktop or ES extension is available, this function returns empty
* string.
* @see @fn_gl_keyword{GetObjectLabel} or * @see @fn_gl_keyword{GetObjectLabel} or
* @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label} * @fn_gl_extension_keyword{GetObjectLabel,EXT,debug_label}
* with @def_gl{TRANSFORM_FEEDBACK} * with @def_gl{TRANSFORM_FEEDBACK}
@ -258,10 +259,10 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject {
* @brief Set transform feedback label * @brief Set transform feedback label
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Default is empty string. If OpenGL 4.3 is not supported and neither * Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not
* @extension{KHR,debug} (covered also by @extension{ANDROID,extension_pack_es31a}) * supported and neither @extension{KHR,debug} (covered also by
* nor @extension{EXT,debug_label} desktop or ES extension is * @extension{ANDROID,extension_pack_es31a}) nor @extension{EXT,debug_label}
* available, this function does nothing. * desktop or ES extension is available, this function does nothing.
* @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or * @see @ref maxLabelLength(), @fn_gl_keyword{ObjectLabel} or
* @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with * @fn_gl_extension_keyword{LabelObject,EXT,debug_label} with
* @def_gl{TRANSFORM_FEEDBACK} * @def_gl{TRANSFORM_FEEDBACK}

Loading…
Cancel
Save