Browse Source

First-class WebGL support, part 2: no debug output.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
1f985dfec6
  1. 18
      src/Magnum/AbstractObject.cpp
  2. 5
      src/Magnum/AbstractObject.h
  3. 4
      src/Magnum/AbstractQuery.cpp
  4. 6
      src/Magnum/AbstractQuery.h
  5. 4
      src/Magnum/AbstractShaderProgram.cpp
  6. 7
      src/Magnum/AbstractShaderProgram.h
  7. 4
      src/Magnum/AbstractTexture.cpp
  8. 6
      src/Magnum/AbstractTexture.h
  9. 4
      src/Magnum/Buffer.cpp
  10. 6
      src/Magnum/Buffer.h
  11. 26
      src/Magnum/CMakeLists.txt
  12. 2
      src/Magnum/CubeMapTexture.h
  13. 22
      src/Magnum/DebugOutput.cpp
  14. 14
      src/Magnum/DebugOutput.h
  15. 4
      src/Magnum/Framebuffer.cpp
  16. 6
      src/Magnum/Framebuffer.h
  17. 4
      src/Magnum/Implementation/DebugState.h
  18. 4
      src/Magnum/Implementation/State.cpp
  19. 4
      src/Magnum/Implementation/State.h
  20. 4
      src/Magnum/Mesh.cpp
  21. 6
      src/Magnum/Mesh.h
  22. 2
      src/Magnum/PrimitiveQuery.h
  23. 4
      src/Magnum/Renderbuffer.cpp
  24. 6
      src/Magnum/Renderbuffer.h
  25. 2
      src/Magnum/Renderer.cpp
  26. 12
      src/Magnum/Renderer.h
  27. 2
      src/Magnum/SampleQuery.h
  28. 4
      src/Magnum/Shader.cpp
  29. 4
      src/Magnum/Shader.h
  30. 2
      src/Magnum/Texture.h
  31. 2
      src/Magnum/TextureArray.h
  32. 2
      src/Magnum/TimeQuery.h
  33. 4
      src/Magnum/TransformFeedback.cpp
  34. 6
      src/Magnum/TransformFeedback.h

18
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<const char> 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<void>(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<const char> 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<void>(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
}

5
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<const char> label);
static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, Containers::ArrayReference<const char> label);
static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, Containers::ArrayReference<const char> 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
};
}

4
src/Magnum/AbstractQuery.cpp

@ -28,7 +28,9 @@
#include <Corrade/Utility/Assert.h>
#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;

6
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<std::size_t size> 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<const char> label);
#endif
void MAGNUM_LOCAL createImplementationDefault();
#ifndef MAGNUM_TARGET_GLES

4
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<bool, std::string> AbstractShaderProgram::validate() {
glValidateProgram(_id);

7
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<std::size_t size> 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<const char> label);
#endif
void bindAttributeLocationInternal(UnsignedInt location, Containers::ArrayReference<const char> name);
void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayReference<const char> name);
void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayReference<const char> name);

4
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;

6
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<std::size_t size> 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<const char> label);
#endif
/* Unlike bind() this also sets the texture binding unit as active */
void MAGNUM_LOCAL bindInternal();

4
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<const char> la
#endif
return *this;
}
#endif
void Buffer::bindInternal(const TargetHint target, Buffer* const buffer) {
const GLuint id = buffer ? buffer->_id : 0;

6
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<std::size_t size> 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<const char> label);
#endif
#ifndef MAGNUM_TARGET_GLES
void subDataInternal(GLintptr offset, GLsizeiptr size, GLvoid* data);

26
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 $<TARGET_OBJECTS:MagnumFlextGLObjects>)

2
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;

22
src/Magnum/DebugOutput.cpp

@ -25,6 +25,7 @@
#include "DebugOutput.h"
#ifndef MAGNUM_TARGET_WEBGL
#include <Corrade/Utility/Assert.h>
#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<UnsignedInt>, bool) {}
void DebugOutput::controlImplementationKhr(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list<UnsignedInt> 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<const char>) {}
void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayReference<const char> 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<const char> string) {
#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
#ifndef CORRADE_TARGET_NACL
glInsertEventMarkerEXT(string.size(), string.data());
#else
static_cast<void>(string);
@ -377,7 +378,7 @@ void DebugGroup::pop() {
void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::ArrayReference<const char>) {}
void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id, const Containers::ArrayReference<const char> 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<const char> message) {
#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
#ifndef CORRADE_TARGET_NACL
glPushGroupMarkerEXT(message.size(), message.data());
#else
static_cast<void>(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

14
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 <string>
#include <Corrade/Containers/Array.h>
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
#include "Magnum/Magnum.h"
#include "Magnum/visibility.h"
#ifdef MAGNUM_BUILD_DEPRECATED
#include <Corrade/Utility/Macros.h>
#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

4
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::ArrayReference<cons
Context::current()->state().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));

6
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<std::size_t size> 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<const char> label);
#endif
void MAGNUM_LOCAL renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer);
#ifndef MAGNUM_TARGET_GLES

4
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 {

4
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});

4
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<BufferState> buffer;
#ifndef MAGNUM_TARGET_WEBGL
std::unique_ptr<DebugState> debug;
#endif
std::unique_ptr<FramebufferState> framebuffer;
std::unique_ptr<MeshState> mesh;
std::unique_ptr<QueryState> query;

4
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<const char> 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)

6
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<std::size_t size> 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<const char> label);
#endif
/* Computing stride of interleaved vertex attributes */
template<UnsignedInt location, class T, class ...U> static GLsizei strideOfInterleaved(const Attribute<location, T>& attribute, const U&... attributes) {

2
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;

4
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::ArrayReference<co
Context::current()->state().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);

6
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<std::size_t size> 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<const char> label);
#endif
void MAGNUM_LOCAL storageImplementationDefault(RenderbufferFormat internalFormat, const Vector2i& size);
#ifndef MAGNUM_TARGET_GLES

2
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
}

12
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
};
/**

2
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;

4
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<const char> la
#endif
return *this;
}
#endif
std::vector<std::string> Shader::sources() const { return _sources; }

4
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<std::size_t size> Shader& setLabel(const char(&label)[size]) {
return setLabelInternal({label, size - 1});
}
#endif
/** @brief Shader type */
Type type() const { return _type; }

2
src/Magnum/Texture.h

@ -875,7 +875,7 @@ template<UnsignedInt dimensions> 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<dimensions>& setLabel(const std::string& label) {
AbstractTexture::setLabel(label);
return *this;

2
src/Magnum/TextureArray.h

@ -530,7 +530,7 @@ template<UnsignedInt dimensions> 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<dimensions>& setLabel(const std::string& label) {
AbstractTexture::setLabel(label);
return *this;

2
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;

4
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);

6
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<std::size_t size> 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<Buffer*> buffers);
#endif
#ifndef MAGNUM_TARGET_WEBGL
TransformFeedback& setLabelInternal(Containers::ArrayReference<const char> label);
#endif
GLuint _id;
bool _created; /* see createIfNotAlready() for details */

Loading…
Cancel
Save