From 1f985dfec6c30ccd401c6203cc221821d761a8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 18 May 2015 23:28:09 +0200 Subject: [PATCH] First-class WebGL support, part 2: no debug output. --- src/Magnum/AbstractObject.cpp | 18 +++++++++++------- src/Magnum/AbstractObject.h | 5 +++++ src/Magnum/AbstractQuery.cpp | 4 ++++ src/Magnum/AbstractQuery.h | 6 ++++++ src/Magnum/AbstractShaderProgram.cpp | 4 ++++ src/Magnum/AbstractShaderProgram.h | 7 +++++++ src/Magnum/AbstractTexture.cpp | 4 ++++ src/Magnum/AbstractTexture.h | 6 ++++++ src/Magnum/Buffer.cpp | 4 ++++ src/Magnum/Buffer.h | 6 ++++++ src/Magnum/CMakeLists.txt | 26 ++++++++++++++++++++------ src/Magnum/CubeMapTexture.h | 2 +- src/Magnum/DebugOutput.cpp | 22 ++++++++++++---------- src/Magnum/DebugOutput.h | 14 +++++++++++++- src/Magnum/Framebuffer.cpp | 4 ++++ src/Magnum/Framebuffer.h | 6 ++++++ src/Magnum/Implementation/DebugState.h | 4 ++++ src/Magnum/Implementation/State.cpp | 4 ++++ src/Magnum/Implementation/State.h | 4 ++++ src/Magnum/Mesh.cpp | 4 ++++ src/Magnum/Mesh.h | 6 ++++++ src/Magnum/PrimitiveQuery.h | 2 +- src/Magnum/Renderbuffer.cpp | 4 ++++ src/Magnum/Renderbuffer.h | 6 ++++++ src/Magnum/Renderer.cpp | 2 ++ src/Magnum/Renderer.h | 12 ++++++++++-- src/Magnum/SampleQuery.h | 2 +- src/Magnum/Shader.cpp | 4 ++++ src/Magnum/Shader.h | 4 ++++ src/Magnum/Texture.h | 2 +- src/Magnum/TextureArray.h | 2 +- src/Magnum/TimeQuery.h | 2 +- src/Magnum/TransformFeedback.cpp | 4 ++++ src/Magnum/TransformFeedback.h | 6 ++++++ 34 files changed, 180 insertions(+), 32 deletions(-) diff --git a/src/Magnum/AbstractObject.cpp b/src/Magnum/AbstractObject.cpp index 5eed945c3..4e5fd5ebd 100644 --- a/src/Magnum/AbstractObject.cpp +++ b/src/Magnum/AbstractObject.cpp @@ -32,11 +32,14 @@ #include "Magnum/Extensions.h" #include "Implementation/State.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif namespace Magnum { -#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) +#ifndef MAGNUM_TARGET_WEBGL +#ifndef CORRADE_TARGET_NACL namespace { inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) { switch(khrIdentifier) { @@ -131,7 +134,7 @@ void AbstractObject::labelImplementationNoOp(GLenum, GLuint, Containers::ArrayRe void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) { #ifndef MAGNUM_TARGET_GLES glObjectLabel(identifier, name, label.size(), label); - #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #elif !defined(CORRADE_TARGET_NACL) glObjectLabelKHR(identifier, name, label.size(), label); #else static_cast(identifier); @@ -142,7 +145,7 @@ void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuin } void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL const GLenum type = extTypeFromKhrIdentifier(identifier); glLabelObjectEXT(type, name, label.size(), label); #else @@ -160,7 +163,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c GLsizei size; #ifndef MAGNUM_TARGET_GLES glGetObjectLabel(identifier, name, 0, &size, nullptr); - #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #elif !defined(CORRADE_TARGET_NACL) glGetObjectLabelKHR(identifier, name, 0, &size, nullptr); #else static_cast(identifier); @@ -173,7 +176,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c label.resize(size+1); #ifndef MAGNUM_TARGET_GLES glGetObjectLabel(identifier, name, size+1, nullptr, &label[0]); - #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #elif !defined(CORRADE_TARGET_NACL) glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]); #else CORRADE_ASSERT_UNREACHABLE(); @@ -188,7 +191,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c GLsizei size; /* Get label size (w/o null terminator) */ - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL const GLenum type = extTypeFromKhrIdentifier(identifier); glGetObjectLabelEXT(type, name, 0, &size, nullptr); #else @@ -200,7 +203,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c /* Make place also for the null terminator */ std::string label; label.resize(size+1); - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]); #else CORRADE_ASSERT_UNREACHABLE(); @@ -210,5 +213,6 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c label.resize(size); return label; } +#endif } diff --git a/src/Magnum/AbstractObject.h b/src/Magnum/AbstractObject.h index 193baf83e..e96f8a258 100644 --- a/src/Magnum/AbstractObject.h +++ b/src/Magnum/AbstractObject.h @@ -47,6 +47,7 @@ class MAGNUM_EXPORT AbstractObject { friend Implementation::DebugState; public: + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Max object label length * @@ -59,20 +60,24 @@ class MAGNUM_EXPORT AbstractObject { * @ref BufferTexture::setLabel(), @ref Framebuffer::setLabel(), * @ref Mesh::setLabel(), @ref Renderbuffer::setLabel(), * @ref Shader::setLabel(), @fn_gl{Get} with @def_gl{MAX_LABEL_LENGTH} + * @requires_gles Debug output is not available in WebGL. */ static Int maxLabelLength(); + #endif protected: MAGNUM_LOCAL AbstractObject() = default; MAGNUM_LOCAL ~AbstractObject() = default; private: + #ifndef MAGNUM_TARGET_WEBGL static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, Containers::ArrayReference label); static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, Containers::ArrayReference label); static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, Containers::ArrayReference label); 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); + #endif }; } diff --git a/src/Magnum/AbstractQuery.cpp b/src/Magnum/AbstractQuery.cpp index 10868a208..3e224a5b8 100644 --- a/src/Magnum/AbstractQuery.cpp +++ b/src/Magnum/AbstractQuery.cpp @@ -28,7 +28,9 @@ #include #include "Magnum/Context.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Magnum/Implementation/DebugState.h" +#endif #include "Magnum/Implementation/QueryState.h" #include "Magnum/Implementation/State.h" @@ -73,6 +75,7 @@ void AbstractQuery::createImplementationDSA() { } #endif +#ifndef MAGNUM_TARGET_WEBGL std::string AbstractQuery::label() const { #ifndef MAGNUM_TARGET_GLES return Context::current()->state().debug->getLabelImplementation(GL_QUERY, _id); @@ -89,6 +92,7 @@ AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayReference< #endif return *this; } +#endif bool AbstractQuery::resultAvailable() { GLuint result; diff --git a/src/Magnum/AbstractQuery.h b/src/Magnum/AbstractQuery.h index 0d0b8b092..fa851f2d7 100644 --- a/src/Magnum/AbstractQuery.h +++ b/src/Magnum/AbstractQuery.h @@ -65,6 +65,7 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { /** @brief OpenGL query ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Query label * @@ -75,6 +76,7 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { * @see @fn_gl{GetObjectLabel} with @def_gl{QUERY} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{QUERY_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ std::string label() const; @@ -88,6 +90,7 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with * @def_gl{QUERY} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{QUERY_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ AbstractQuery& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -97,6 +100,7 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { template AbstractQuery& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** * @brief Whether the result is available @@ -160,7 +164,9 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { #endif private: + #ifndef MAGNUM_TARGET_WEBGL AbstractQuery& setLabelInternal(Containers::ArrayReference label); + #endif void MAGNUM_LOCAL createImplementationDefault(); #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp index 6b64456df..2dc68ab42 100644 --- a/src/Magnum/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -30,7 +30,9 @@ #include "Magnum/Shader.h" #include "Magnum/Math/RectangularMatrix.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/ShaderProgramState.h" #include "Implementation/State.h" @@ -250,6 +252,7 @@ AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&& return *this; } +#ifndef MAGNUM_TARGET_WEBGL std::string AbstractShaderProgram::label() const { #ifndef MAGNUM_TARGET_GLES return Context::current()->state().debug->getLabelImplementation(GL_PROGRAM, _id); @@ -266,6 +269,7 @@ AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers: #endif return *this; } +#endif std::pair AbstractShaderProgram::validate() { glValidateProgram(_id); diff --git a/src/Magnum/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h index c7fa2e4fd..c7c3c1c32 100644 --- a/src/Magnum/AbstractShaderProgram.h +++ b/src/Magnum/AbstractShaderProgram.h @@ -574,6 +574,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { /** @brief OpenGL program ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Shader program label * @@ -584,6 +585,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @see @fn_gl{GetObjectLabel} with @def_gl{PROGRAM} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{PROGRAM_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ std::string label() const; @@ -597,6 +599,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with * @def_gl{PROGRAM} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{PROGRAM_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ AbstractShaderProgram& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -606,6 +609,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { template AbstractShaderProgram& setLabel(const char (&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** * @brief Validate program @@ -949,7 +953,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { #endif private: + #ifndef MAGNUM_TARGET_WEBGL AbstractShaderProgram& setLabelInternal(Containers::ArrayReference label); + #endif + void bindAttributeLocationInternal(UnsignedInt location, Containers::ArrayReference name); void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayReference name); void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayReference name); diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index 523d980b7..82945cf99 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -41,7 +41,9 @@ #include "Magnum/Shader.h" #endif +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/State.h" #include "Implementation/TextureState.h" @@ -242,6 +244,7 @@ inline void AbstractTexture::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } +#ifndef MAGNUM_TARGET_WEBGL std::string AbstractTexture::label() { createIfNotAlready(); return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); @@ -252,6 +255,7 @@ AbstractTexture& AbstractTexture::setLabelInternal(const Containers::ArrayRefere Context::current()->state().debug->labelImplementation(GL_TEXTURE, _id, label); return *this; } +#endif void AbstractTexture::bind(Int textureUnit) { Implementation::TextureState& textureState = *Context::current()->state().texture; diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index a3630e12f..7220bc4e4 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -263,6 +263,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { /** @brief Move assignment */ AbstractTexture& operator=(AbstractTexture&& other) noexcept; + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Texture label * @@ -273,6 +274,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @see @fn_gl{GetObjectLabel} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{TEXTURE} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -286,6 +288,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{TEXTURE} + * @requires_gles Debug output is not available in WebGL. */ AbstractTexture& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -295,6 +298,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { template AbstractTexture& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** @brief OpenGL texture ID */ GLuint id() const { return _id; } @@ -326,7 +330,9 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { explicit AbstractTexture(GLenum target); + #ifndef MAGNUM_TARGET_WEBGL AbstractTexture& setLabelInternal(Containers::ArrayReference label); + #endif /* Unlike bind() this also sets the texture binding unit as active */ void MAGNUM_LOCAL bindInternal(); diff --git a/src/Magnum/Buffer.cpp b/src/Magnum/Buffer.cpp index 33457f3e0..c9ad263e1 100644 --- a/src/Magnum/Buffer.cpp +++ b/src/Magnum/Buffer.cpp @@ -32,7 +32,9 @@ #include "Implementation/State.h" #include "Implementation/BufferState.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif namespace Magnum { @@ -208,6 +210,7 @@ inline void Buffer::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } +#ifndef MAGNUM_TARGET_WEBGL std::string Buffer::label() { createIfNotAlready(); #ifndef MAGNUM_TARGET_GLES @@ -226,6 +229,7 @@ Buffer& Buffer::setLabelInternal(const Containers::ArrayReference la #endif return *this; } +#endif void Buffer::bindInternal(const TargetHint target, Buffer* const buffer) { const GLuint id = buffer ? buffer->_id : 0; diff --git a/src/Magnum/Buffer.h b/src/Magnum/Buffer.h index 74a81fd5b..4e32904e0 100644 --- a/src/Magnum/Buffer.h +++ b/src/Magnum/Buffer.h @@ -798,6 +798,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { /** @brief OpenGL buffer ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Buffer label * @@ -808,6 +809,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @see @fn_gl{GetObjectLabel} with @def_gl{BUFFER} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{BUFFER_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -821,6 +823,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with @def_gl{BUFFER} * or @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{BUFFER_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ Buffer& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -830,6 +833,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { template Buffer& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** @brief Target hint */ TargetHint targetHint() const { return _targetHint; } @@ -1217,7 +1221,9 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); + #ifndef MAGNUM_TARGET_WEBGL Buffer& setLabelInternal(Containers::ArrayReference label); + #endif #ifndef MAGNUM_TARGET_GLES void subDataInternal(GLintptr offset, GLsizeiptr size, GLvoid* data); diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt index a9318a2ba..110b7afc6 100644 --- a/src/Magnum/CMakeLists.txt +++ b/src/Magnum/CMakeLists.txt @@ -39,7 +39,6 @@ set(Magnum_SRCS ColorFormat.cpp CubeMapTexture.cpp Context.cpp - DebugOutput.cpp DefaultFramebuffer.cpp Framebuffer.cpp Image.cpp @@ -56,7 +55,6 @@ set(Magnum_SRCS Version.cpp Implementation/BufferState.cpp - Implementation/DebugState.cpp Implementation/FramebufferState.cpp Implementation/MeshState.cpp Implementation/QueryState.cpp @@ -96,7 +94,6 @@ set(Magnum_HEADERS ColorFormat.h Context.h CubeMapTexture.h - DebugOutput.h DefaultFramebuffer.h DimensionTraits.h Extensions.h @@ -128,7 +125,6 @@ set(Magnum_HEADERS # Header files to display in project view of IDEs only set(Magnum_PRIVATE_HEADERS Implementation/BufferState.h - Implementation/DebugState.h Implementation/FramebufferState.h Implementation/maxTextureSize.h Implementation/MeshState.h @@ -142,8 +138,6 @@ set(Magnum_PRIVATE_HEADERS # Deprecated headers if(BUILD_DEPRECATED) set(Magnum_HEADERS ${Magnum_HEADERS} - DebugMarker.h - DebugMessage.h Query.h) endif() @@ -182,6 +176,26 @@ if(NOT TARGET_GLES2) endif() +# Non-WebGL stuff +if(NOT TARGET_WEBGL) + list(APPEND Magnum_SRCS + DebugOutput.cpp + + Implementation/DebugState.cpp) + + list(APPEND Magnum_HEADERS + DebugOutput.h) + + list(APPEND Magnum_PRIVATE_HEADERS + Implementation/DebugState.h) + + if(BUILD_DEPRECATED) + list(APPEND Magnum_HEADERS + DebugMarker.h + DebugMessage.h) + endif() +endif() + # Link in GL function pointer variables on platforms that support it if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL) list(APPEND Magnum_SRCS $) diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h index bb36982d4..f3f67cf41 100644 --- a/src/Magnum/CubeMapTexture.h +++ b/src/Magnum/CubeMapTexture.h @@ -648,7 +648,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture { } /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) CubeMapTexture& setLabel(const std::string& label) { AbstractTexture::setLabel(label); return *this; diff --git a/src/Magnum/DebugOutput.cpp b/src/Magnum/DebugOutput.cpp index 37dc11bd9..14513357d 100644 --- a/src/Magnum/DebugOutput.cpp +++ b/src/Magnum/DebugOutput.cpp @@ -25,6 +25,7 @@ #include "DebugOutput.h" +#ifndef MAGNUM_TARGET_WEBGL #include #include "Magnum/Context.h" @@ -40,7 +41,7 @@ namespace Magnum { namespace { -#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) +#ifndef CORRADE_TARGET_NACL void #ifdef CORRADE_TARGET_WINDOWS APIENTRY @@ -169,7 +170,7 @@ void DebugOutput::setEnabledInternal(const GLenum source, const GLenum type, con void DebugOutput::controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list, bool) {} void DebugOutput::controlImplementationKhr(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list ids, const bool enabled) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glDebugMessageControl #else @@ -195,7 +196,7 @@ void DebugOutput::callbackImplementationKhr(const Callback callback, const void* /* Adding callback */ if(!original && callback) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glDebugMessageCallback #else @@ -209,7 +210,7 @@ void DebugOutput::callbackImplementationKhr(const Callback callback, const void* /* Deleting callback */ } else if(original && !callback) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glDebugMessageCallback #else @@ -277,7 +278,7 @@ void DebugMessage::insertInternal(const Source source, const Type type, const Un void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayReference) {} void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayReference string) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glDebugMessageInsert #else @@ -295,7 +296,7 @@ void DebugMessage::insertImplementationKhr(const Source source, const Type type, } void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayReference string) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL glInsertEventMarkerEXT(string.size(), string.data()); #else static_cast(string); @@ -377,7 +378,7 @@ void DebugGroup::pop() { void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::ArrayReference) {} void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id, const Containers::ArrayReference message) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glPushDebugGroup #else @@ -393,7 +394,7 @@ void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id } void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::ArrayReference message) { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL glPushGroupMarkerEXT(message.size(), message.data()); #else static_cast(message); @@ -406,7 +407,7 @@ void DebugGroup::popImplementationNoOp() {} void DebugGroup::popImplementationKhr() { #ifndef MAGNUM_TARGET_GLES glPopDebugGroup(); - #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #elif !defined(CORRADE_TARGET_NACL) glPopDebugGroupKHR(); #else CORRADE_ASSERT_UNREACHABLE(); @@ -414,7 +415,7 @@ void DebugGroup::popImplementationKhr() { } void DebugGroup::popImplementationExt() { - #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL) + #ifndef CORRADE_TARGET_NACL glPopGroupMarkerEXT(); #else CORRADE_ASSERT_UNREACHABLE(); @@ -435,3 +436,4 @@ Debug operator<<(Debug debug, const DebugGroup::Source value) { #endif } +#endif diff --git a/src/Magnum/DebugOutput.h b/src/Magnum/DebugOutput.h index 2b34c2f64..eb59569df 100644 --- a/src/Magnum/DebugOutput.h +++ b/src/Magnum/DebugOutput.h @@ -25,21 +25,24 @@ DEALINGS IN THE SOFTWARE. */ +#ifndef MAGNUM_TARGET_WEBGL /** @file * @brief Class @ref Magnum::DebugOutput, @ref Magnum::DebugMessage, @ref Magnum::DebugGroup */ +#endif #include #include -#include "Magnum/Magnum.h" #include "Magnum/OpenGL.h" +#include "Magnum/Magnum.h" #include "Magnum/visibility.h" #ifdef MAGNUM_BUILD_DEPRECATED #include #endif +#ifndef MAGNUM_TARGET_WEBGL namespace Magnum { namespace Implementation { struct DebugState; } @@ -118,6 +121,8 @@ objects with labels. See @ref AbstractQuery::setLabel(), @ref Buffer::setLabel(), @ref Framebuffer::setLabel(), @ref Mesh::setLabel(), @ref Renderbuffer::setLabel(), @ref Shader::setLabel() and @ref TransformFeedback::setLabel() for more information. + +@requires_gles Debug output is not available in WebGL. */ class MAGNUM_EXPORT DebugOutput { friend Implementation::DebugState; @@ -453,6 +458,8 @@ and the debug output is either not supported or turned off, the calls will not result in any allocations and thus won't have any negative performance effects. @see @ref DebugGroup + +@requires_gles Debug output is not available in WebGL. */ class MAGNUM_EXPORT DebugMessage { friend Implementation::DebugState; @@ -760,6 +767,8 @@ and the debug output is either not supported or turned off, the calls will not result in any allocations and thus won't have any negative performance effects. @see @ref DebugMessage + +@requires_gles Debug output is not available in WebGL. */ class MAGNUM_EXPORT DebugGroup { friend Implementation::DebugState; @@ -888,5 +897,8 @@ class MAGNUM_EXPORT DebugGroup { Debug MAGNUM_EXPORT operator<<(Debug debug, DebugGroup::Source value); } +#else +#error this header is not available in WebGL build +#endif #endif diff --git a/src/Magnum/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp index ab23128c2..81d7313c1 100644 --- a/src/Magnum/Framebuffer.cpp +++ b/src/Magnum/Framebuffer.cpp @@ -45,7 +45,9 @@ #include "Magnum/RectangleTexture.h" #endif +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/State.h" #include "Implementation/FramebufferState.h" @@ -121,6 +123,7 @@ Framebuffer::~Framebuffer() { glDeleteFramebuffers(1, &_id); } +#ifndef MAGNUM_TARGET_WEBGL std::string Framebuffer::label() { createIfNotAlready(); return Context::current()->state().debug->getLabelImplementation(GL_FRAMEBUFFER, _id); @@ -131,6 +134,7 @@ Framebuffer& Framebuffer::setLabelInternal(const Containers::ArrayReferencestate().debug->labelImplementation(GL_FRAMEBUFFER, _id, label); return *this; } +#endif Framebuffer::Status Framebuffer::checkStatus(const FramebufferTarget target) { return Status((this->*Context::current()->state().framebuffer->checkStatusImplementation)(target)); diff --git a/src/Magnum/Framebuffer.h b/src/Magnum/Framebuffer.h index cec6538b2..e3c9966f8 100644 --- a/src/Magnum/Framebuffer.h +++ b/src/Magnum/Framebuffer.h @@ -338,6 +338,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje /** @brief OpenGL framebuffer ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Framebuffer label * @@ -348,6 +349,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @see @fn_gl{GetObjectLabel} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{FRAMEBUFFER} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -361,6 +363,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{FRAMEBUFFER} + * @requires_gles Debug output is not available in WebGL. */ Framebuffer& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -370,6 +373,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje template Framebuffer& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** * @brief Check framebuffer status @@ -669,7 +673,9 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje void MAGNUM_LOCAL createImplementationDSA(); #endif + #ifndef MAGNUM_TARGET_WEBGL Framebuffer& setLabelInternal(Containers::ArrayReference label); + #endif void MAGNUM_LOCAL renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer); #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Implementation/DebugState.h b/src/Magnum/Implementation/DebugState.h index 4c5051853..1199fc465 100644 --- a/src/Magnum/Implementation/DebugState.h +++ b/src/Magnum/Implementation/DebugState.h @@ -30,6 +30,10 @@ #include "Magnum/DebugOutput.h" +#ifdef MAGNUM_TARGET_WEBGL +#error this header is not available in WebGL build +#endif + namespace Magnum { namespace Implementation { struct DebugState { diff --git a/src/Magnum/Implementation/State.cpp b/src/Magnum/Implementation/State.cpp index a72f646df..7f2b8ca8a 100644 --- a/src/Magnum/Implementation/State.cpp +++ b/src/Magnum/Implementation/State.cpp @@ -31,7 +31,9 @@ #include "Magnum/Extensions.h" #include "BufferState.h" +#ifndef MAGNUM_TARGET_WEBGL #include "DebugState.h" +#endif #include "FramebufferState.h" #include "MeshState.h" #include "QueryState.h" @@ -56,7 +58,9 @@ State::State(Context& context) { #endif buffer.reset(new BufferState{context, extensions}); + #ifndef MAGNUM_TARGET_WEBGL debug.reset(new DebugState{context, extensions}); + #endif framebuffer.reset(new FramebufferState{context, extensions}); mesh.reset(new MeshState{context, extensions}); query.reset(new QueryState{context, extensions}); diff --git a/src/Magnum/Implementation/State.h b/src/Magnum/Implementation/State.h index 6a578ccd7..8519f8a73 100644 --- a/src/Magnum/Implementation/State.h +++ b/src/Magnum/Implementation/State.h @@ -33,7 +33,9 @@ namespace Magnum { namespace Implementation { struct BufferState; +#ifndef MAGNUM_TARGET_WEBGL struct DebugState; +#endif struct FramebufferState; struct MeshState; struct QueryState; @@ -54,7 +56,9 @@ struct State { enum: GLuint { DisengagedBinding = ~0u }; std::unique_ptr buffer; + #ifndef MAGNUM_TARGET_WEBGL std::unique_ptr debug; + #endif std::unique_ptr framebuffer; std::unique_ptr mesh; std::unique_ptr query; diff --git a/src/Magnum/Mesh.cpp b/src/Magnum/Mesh.cpp index 6113634b2..cde2674bc 100644 --- a/src/Magnum/Mesh.cpp +++ b/src/Magnum/Mesh.cpp @@ -32,7 +32,9 @@ #include "Magnum/Context.h" #include "Magnum/Extensions.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/BufferState.h" #include "Implementation/MeshState.h" #include "Implementation/State.h" @@ -172,6 +174,7 @@ inline void Mesh::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } +#ifndef MAGNUM_TARGET_WEBGL std::string Mesh::label() { createIfNotAlready(); #ifndef MAGNUM_TARGET_GLES @@ -190,6 +193,7 @@ Mesh& Mesh::setLabelInternal(const Containers::ArrayReference label) #endif return *this; } +#endif Mesh& Mesh::setIndexBuffer(Buffer& buffer, GLintptr offset, IndexType type, UnsignedInt start, UnsignedInt end) { #if defined(CORRADE_TARGET_NACL) || defined(MAGNUM_TARGET_WEBGL) diff --git a/src/Magnum/Mesh.h b/src/Magnum/Mesh.h index eef3e931e..3f7bbaf58 100644 --- a/src/Magnum/Mesh.h +++ b/src/Magnum/Mesh.h @@ -458,6 +458,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Mesh label * @@ -468,6 +469,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @see @fn_gl{GetObjectLabel} with @def_gl{VERTEX_ARRAY} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{VERTEX_ARRAY_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -481,6 +483,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with * @def_gl{VERTEX_ARRAY} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{VERTEX_ARRAY_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ Mesh& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -490,6 +493,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { template Mesh& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** * @brief Whether the mesh is indexed @@ -862,7 +866,9 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); + #ifndef MAGNUM_TARGET_WEBGL Mesh& setLabelInternal(Containers::ArrayReference label); + #endif /* Computing stride of interleaved vertex attributes */ template static GLsizei strideOfInterleaved(const Attribute& attribute, const U&... attributes) { diff --git a/src/Magnum/PrimitiveQuery.h b/src/Magnum/PrimitiveQuery.h index 8fe684458..398ff59c4 100644 --- a/src/Magnum/PrimitiveQuery.h +++ b/src/Magnum/PrimitiveQuery.h @@ -115,7 +115,7 @@ class PrimitiveQuery: public AbstractQuery { #endif /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) PrimitiveQuery& setLabel(const std::string& label) { AbstractQuery::setLabel(label); return *this; diff --git a/src/Magnum/Renderbuffer.cpp b/src/Magnum/Renderbuffer.cpp index 7d23bb205..627454d1d 100644 --- a/src/Magnum/Renderbuffer.cpp +++ b/src/Magnum/Renderbuffer.cpp @@ -28,7 +28,9 @@ #include "Magnum/Context.h" #include "Magnum/Extensions.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/FramebufferState.h" #include "Implementation/State.h" @@ -102,6 +104,7 @@ inline void Renderbuffer::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } +#ifndef MAGNUM_TARGET_WEBGL std::string Renderbuffer::label() { createIfNotAlready(); return Context::current()->state().debug->getLabelImplementation(GL_RENDERBUFFER, _id); @@ -112,6 +115,7 @@ Renderbuffer& Renderbuffer::setLabelInternal(const Containers::ArrayReferencestate().debug->labelImplementation(GL_RENDERBUFFER, _id, label); return *this; } +#endif void Renderbuffer::setStorage(const RenderbufferFormat internalFormat, const Vector2i& size) { (this->*Context::current()->state().framebuffer->renderbufferStorageImplementation)(internalFormat, size); diff --git a/src/Magnum/Renderbuffer.h b/src/Magnum/Renderbuffer.h index d0de19b24..63d8d2dd4 100644 --- a/src/Magnum/Renderbuffer.h +++ b/src/Magnum/Renderbuffer.h @@ -117,6 +117,7 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { /** @brief OpenGL internal renderbuffer ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Renderbuffer label * @@ -127,6 +128,7 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * @see @fn_gl{GetObjectLabel} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{RENDERBUFFER} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -140,6 +142,7 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{RENDERBUFFER} + * @requires_gles Debug output is not available in WebGL. */ Renderbuffer& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -149,6 +152,7 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { template Renderbuffer& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** * @brief Set renderbuffer storage @@ -192,7 +196,9 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); + #ifndef MAGNUM_TARGET_WEBGL Renderbuffer& setLabelInternal(Containers::ArrayReference label); + #endif void MAGNUM_LOCAL storageImplementationDefault(RenderbufferFormat internalFormat, const Vector2i& size); #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/Renderer.cpp b/src/Magnum/Renderer.cpp index 1a4a82cc8..019dd8491 100644 --- a/src/Magnum/Renderer.cpp +++ b/src/Magnum/Renderer.cpp @@ -231,8 +231,10 @@ Debug operator<<(Debug debug, const Renderer::Error value) { _c(InvalidOperation) _c(InvalidFramebufferOperation) _c(OutOfMemory) + #ifndef MAGNUM_TARGET_WEBGL _c(StackUnderflow) _c(StackOverflow) + #endif #undef _c } diff --git a/src/Magnum/Renderer.h b/src/Magnum/Renderer.h index 7e8f4edbb..d125c9e0c 100644 --- a/src/Magnum/Renderer.h +++ b/src/Magnum/Renderer.h @@ -84,13 +84,15 @@ class MAGNUM_EXPORT Renderer { */ Blending = GL_BLEND, + #ifndef MAGNUM_TARGET_WEBGL /** * Debug output. Disabled by default unless the GL context was * created with debug output enabled. * @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 @es_extension{KHR,debug} + * @requires_es_extension Extension @es_extension2{KHR,debug,debug} + * @requires_gles Debug output is not available in WebGL. */ #ifndef MAGNUM_TARGET_GLES DebugOutput = GL_DEBUG_OUTPUT, @@ -103,13 +105,15 @@ class MAGNUM_EXPORT Renderer { * @ref Feature::DebugOutput is enabled. * @see @ref DebugMessage * @requires_gl43 Extension @extension{KHR,debug} - * @requires_es_extension Extension @es_extension{KHR,debug} + * @requires_es_extension Extension @es_extension2{KHR,debug,debug} + * @requires_gles Debug output is not available in WebGL. */ #ifndef MAGNUM_TARGET_GLES DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS, #else DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR, #endif + #endif #ifndef MAGNUM_TARGET_GLES /** @@ -974,11 +978,13 @@ class MAGNUM_EXPORT Renderer { /** There is not enough memory left to execute the command. */ OutOfMemory = GL_OUT_OF_MEMORY, + #ifndef MAGNUM_TARGET_WEBGL /** * Given operation would cause an internal stack to underflow. * @see @ref DebugGroup * @requires_gl43 Extension @extension{KHR,debug} * @requires_es_extension Extension @es_extension2{KHR,debug,debug} + * @requires_gles Debug output is not available in WebGL. */ #ifndef MAGNUM_TARGET_GLES StackUnderflow = GL_STACK_UNDERFLOW, @@ -991,12 +997,14 @@ class MAGNUM_EXPORT Renderer { * @see @ref DebugGroup * @requires_gl43 Extension @extension{KHR,debug} * @requires_es_extension Extension @es_extension2{KHR,debug,debug} + * @requires_gles Debug output is not available in WebGL. */ #ifndef MAGNUM_TARGET_GLES StackOverflow = GL_STACK_OVERFLOW #else StackOverflow = GL_STACK_OVERFLOW_KHR #endif + #endif }; /** diff --git a/src/Magnum/SampleQuery.h b/src/Magnum/SampleQuery.h index a8c05127a..74f8c7d43 100644 --- a/src/Magnum/SampleQuery.h +++ b/src/Magnum/SampleQuery.h @@ -232,7 +232,7 @@ class SampleQuery: public AbstractQuery { #endif /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) SampleQuery& setLabel(const std::string& label) { AbstractQuery::setLabel(label); return *this; diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index 43b8d4a23..789459494 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -32,7 +32,9 @@ #include "Magnum/Context.h" #include "Magnum/Extensions.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Implementation/DebugState.h" +#endif #include "Implementation/State.h" #include "Implementation/ShaderState.h" @@ -646,6 +648,7 @@ Shader::~Shader() { glDeleteShader(_id); } +#ifndef MAGNUM_TARGET_WEBGL std::string Shader::label() const { #ifndef MAGNUM_TARGET_GLES return Context::current()->state().debug->getLabelImplementation(GL_SHADER, _id); @@ -662,6 +665,7 @@ Shader& Shader::setLabelInternal(const Containers::ArrayReference la #endif return *this; } +#endif std::vector Shader::sources() const { return _sources; } diff --git a/src/Magnum/Shader.h b/src/Magnum/Shader.h index fcdec21b5..26c3a1be5 100644 --- a/src/Magnum/Shader.h +++ b/src/Magnum/Shader.h @@ -488,6 +488,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { /** @brief OpenGL shader ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Shader label * @@ -498,6 +499,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * @see @fn_gl{GetObjectLabel} with @def_gl{SHADER} or * @fn_gl_extension2{GetObjectLabel,EXT,debug_label} with * @def_gl{SHADER_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ std::string label() const; @@ -511,6 +513,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} with * @def_gl{SHADER} or @fn_gl_extension2{LabelObject,EXT,debug_label} * with @def_gl{SHADER_OBJECT_EXT} + * @requires_gles Debug output is not available in WebGL. */ Shader& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); @@ -520,6 +523,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { template Shader& setLabel(const char(&label)[size]) { return setLabelInternal({label, size - 1}); } + #endif /** @brief Shader type */ Type type() const { return _type; } diff --git a/src/Magnum/Texture.h b/src/Magnum/Texture.h index 39a50a54c..117b10964 100644 --- a/src/Magnum/Texture.h +++ b/src/Magnum/Texture.h @@ -875,7 +875,7 @@ template class Texture: public AbstractTexture { } /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) Texture& setLabel(const std::string& label) { AbstractTexture::setLabel(label); return *this; diff --git a/src/Magnum/TextureArray.h b/src/Magnum/TextureArray.h index fe021b652..be03adfdf 100644 --- a/src/Magnum/TextureArray.h +++ b/src/Magnum/TextureArray.h @@ -530,7 +530,7 @@ template class TextureArray: public AbstractTexture { } /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) TextureArray& setLabel(const std::string& label) { AbstractTexture::setLabel(label); return *this; diff --git a/src/Magnum/TimeQuery.h b/src/Magnum/TimeQuery.h index e38a3761b..662f5e541 100644 --- a/src/Magnum/TimeQuery.h +++ b/src/Magnum/TimeQuery.h @@ -138,7 +138,7 @@ class TimeQuery: public AbstractQuery { #endif /* Overloads to remove WTF-factor from method chaining order */ - #ifndef DOXYGEN_GENERATING_OUTPUT + #if !defined(DOXYGEN_GENERATING_OUTPUT) && !defined(MAGNUM_TARGET_WEBGL) TimeQuery& setLabel(const std::string& label) { AbstractQuery::setLabel(label); return *this; diff --git a/src/Magnum/TransformFeedback.cpp b/src/Magnum/TransformFeedback.cpp index def84607c..1a61a5037 100644 --- a/src/Magnum/TransformFeedback.cpp +++ b/src/Magnum/TransformFeedback.cpp @@ -32,7 +32,9 @@ #include "Magnum/Buffer.h" #include "Magnum/Context.h" #include "Magnum/Extensions.h" +#ifndef MAGNUM_TARGET_WEBGL #include "Magnum/Implementation/DebugState.h" +#endif #include "Magnum/Implementation/State.h" #include "Magnum/Implementation/TransformFeedbackState.h" @@ -144,6 +146,7 @@ inline void TransformFeedback::createIfNotAlready() { CORRADE_INTERNAL_ASSERT(_created); } +#ifndef MAGNUM_TARGET_WEBGL std::string TransformFeedback::label() { createIfNotAlready(); return Context::current()->state().debug->getLabelImplementation(GL_TRANSFORM_FEEDBACK, _id); @@ -154,6 +157,7 @@ TransformFeedback& TransformFeedback::setLabelInternal(const Containers::ArrayRe Context::current()->state().debug->labelImplementation(GL_TRANSFORM_FEEDBACK, _id, label); return *this; } +#endif TransformFeedback& TransformFeedback::attachBuffer(const UnsignedInt index, Buffer& buffer, const GLintptr offset, const GLsizeiptr size) { (this->*Context::current()->state().transformFeedback->attachRangeImplementation)(index, buffer, offset, size); diff --git a/src/Magnum/TransformFeedback.h b/src/Magnum/TransformFeedback.h index 61fd852e7..18da39f3c 100644 --- a/src/Magnum/TransformFeedback.h +++ b/src/Magnum/TransformFeedback.h @@ -179,6 +179,7 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject { /** @brief OpenGL transform feedback ID */ GLuint id() const { return _id; } + #ifndef MAGNUM_TARGET_WEBGL /** * @brief Buffer label * @@ -188,6 +189,7 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject { * extension is available, this function returns empty string. * @see @fn_gl{GetObjectLabel} or @fn_gl_extension2{GetObjectLabel,EXT,debug_label} * with @def_gl{TRANSFORM_FEEDBACK} + * @requires_gles Debug output is not available in WebGL. */ std::string label(); @@ -201,10 +203,12 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject { * @see @ref maxLabelLength(), @fn_gl{ObjectLabel} or * @fn_gl_extension2{LabelObject,EXT,debug_label} with * @def_gl{TRANSFORM_FEEDBACK} + * @requires_gles Debug output is not available in WebGL. */ TransformFeedback& setLabel(const std::string& label) { return setLabelInternal({label.data(), label.size()}); } + #endif /** @overload */ template TransformFeedback& setLabel(const char(&label)[size]) { @@ -364,7 +368,9 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject { void MAGNUM_LOCAL attachImplementationDSA(GLuint firstIndex, std::initializer_list buffers); #endif + #ifndef MAGNUM_TARGET_WEBGL TransformFeedback& setLabelInternal(Containers::ArrayReference label); + #endif GLuint _id; bool _created; /* see createIfNotAlready() for details */