mirror of https://github.com/mosra/magnum.git
Browse Source
Can't test EXT_debug_label, as that is apparently OSX 10.9-only. Added GL tests for all implemented objects. KHR_debug is selected first, if that is not available, fall back to EXT_debug_label. If neither is available, the functions are no-op. I hope EXT_debug_label gets replaced by KHR_debug later, thus it is now only "emulated" through KHR_debug enums.pull/38/head
38 changed files with 1320 additions and 21 deletions
@ -0,0 +1,219 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "AbstractObject.h" |
||||
|
||||
#include <Utility/Assert.h> |
||||
|
||||
#include "Extensions.h" |
||||
#include "Implementation/State.h" |
||||
#include "Implementation/DebugState.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
namespace { |
||||
/* What the hell, Apple? Why you had to create this abomination _after_
|
||||
KHR_debug was released?! */ |
||||
inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) { |
||||
switch(khrIdentifier) { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_BUFFER: |
||||
#else |
||||
case GL_BUFFER_KHR: |
||||
#endif |
||||
return GL_BUFFER_OBJECT_EXT; |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_SHADER: |
||||
#else |
||||
case GL_SHADER_KHR: |
||||
#endif |
||||
return GL_SHADER_OBJECT_EXT; |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_PROGRAM: |
||||
#else |
||||
case GL_PROGRAM_KHR: |
||||
#endif |
||||
return GL_PROGRAM_OBJECT_EXT; |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_VERTEX_ARRAY: |
||||
#else |
||||
case GL_VERTEX_ARRAY_KHR: |
||||
#endif |
||||
return GL_VERTEX_ARRAY_OBJECT_EXT; |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_QUERY: |
||||
#else |
||||
case GL_QUERY_KHR: |
||||
#endif |
||||
return GL_QUERY_OBJECT_EXT; |
||||
|
||||
/** @todo Why isn't `GL_PROGRAM_PIPELINE_KHR` in ES's KHR_debug? */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_PROGRAM_PIPELINE: |
||||
#else |
||||
case 0x82E4: //GL_PROGRAM_PIPELINE_KHR:
|
||||
#endif |
||||
return GL_PROGRAM_PIPELINE_OBJECT_EXT; |
||||
|
||||
/**
|
||||
* @todo Shouldn't ES2's KHR_debug have `GL_TRANSFORM_FEEDBACK_KHR` |
||||
* instead of `GL_TRANSFORM_FEEDBACK`? (it's a new enum in 2.0) |
||||
*/ |
||||
case GL_TRANSFORM_FEEDBACK: |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
case GL_SAMPLER: |
||||
#else |
||||
case GL_SAMPLER_KHR: |
||||
#endif |
||||
case GL_TEXTURE: |
||||
case GL_RENDERBUFFER: |
||||
case GL_FRAMEBUFFER: |
||||
return khrIdentifier; |
||||
} |
||||
|
||||
CORRADE_ASSERT_UNREACHABLE(); |
||||
} |
||||
} |
||||
|
||||
Int AbstractObject::maxLabelLength() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) |
||||
return 0; |
||||
|
||||
GLint& value = Context::current()->state().debug->maxLabelLength; |
||||
|
||||
if(value == 0) { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetIntegerv(GL_MAX_LABEL_LENGTH, &value); |
||||
#else |
||||
glGetIntegerv(GL_MAX_LABEL_LENGTH_KHR, &value); |
||||
#endif |
||||
} |
||||
|
||||
return value; |
||||
} |
||||
|
||||
void AbstractObject::labelImplementationNoOp(GLenum, GLuint, const std::string&) {} |
||||
|
||||
void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const std::string& label) { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glObjectLabel(identifier, name, label.size(), label.data()); |
||||
#else |
||||
static_cast<void>(identifier); |
||||
static_cast<void>(name); |
||||
static_cast<void>(label); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
//glObjectLabelKHR(identifier, name, label.size(), label.data());
|
||||
#endif |
||||
} |
||||
|
||||
void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const std::string& label) { |
||||
const GLenum type = extTypeFromKhrIdentifier(identifier); |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glLabelObjectEXT(type, name, label.size(), label.data()); |
||||
#else |
||||
static_cast<void>(type); |
||||
static_cast<void>(name); |
||||
static_cast<void>(label); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
#endif |
||||
} |
||||
|
||||
std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return {}; } |
||||
|
||||
std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) { |
||||
/**
|
||||
* @todo Get rid of this workaround when NVidia returns proper size for |
||||
* length=0 & label=nullptr (even crashes on length>0 & label=nullptr) |
||||
*/ |
||||
#if 0 |
||||
/* Get label size (w/o null terminator) */ |
||||
GLsizei size; |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetObjectLabel(type, name, 0, &size, nullptr); |
||||
#else |
||||
glGetObjectLabelKHR(type, name, 0, &size, nullptr); |
||||
#endif |
||||
|
||||
/* Make place also for the null terminator */ |
||||
std::string label; |
||||
label.resize(size+1); |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetObjectLabel(identifier, name, size+1, nullptr, &label[0]); |
||||
#else |
||||
glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]); |
||||
#endif |
||||
|
||||
/* Pop null terminator and return the string */ |
||||
label.pop_back(); |
||||
return label; |
||||
#else |
||||
GLsizei size; |
||||
std::string label; |
||||
label.resize(maxLabelLength()); |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetObjectLabel(identifier, name, label.size(), &size, &label[0]); |
||||
#else |
||||
static_cast<void>(identifier); |
||||
static_cast<void>(name); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
//glGetObjectLabelKHR(identifier, name, label.size(), &size, &label[0]);
|
||||
#endif |
||||
return label.substr(0, size); |
||||
#endif |
||||
} |
||||
|
||||
std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) { |
||||
const GLenum type = extTypeFromKhrIdentifier(identifier); |
||||
|
||||
/* Get label size (w/o null terminator) */ |
||||
GLsizei size; |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetObjectLabelEXT(type, name, 0, &size, nullptr); |
||||
#else |
||||
static_cast<void>(type); |
||||
static_cast<void>(name); |
||||
CORRADE_INTERNAL_ASSERT(false); |
||||
#endif |
||||
|
||||
/* Make place also for the null terminator */ |
||||
std::string label; |
||||
label.resize(size+1); |
||||
/** @todo Re-enable when extension wrangler is available for ES */ |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]); |
||||
#endif |
||||
|
||||
/* Pop null terminator and return the string */ |
||||
label.pop_back(); |
||||
return label; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,81 @@
|
||||
#ifndef Magnum_AbstractObject_h |
||||
#define Magnum_AbstractObject_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
/** @file
|
||||
* @brief Class @ref Magnum::AbstractObject |
||||
*/ |
||||
|
||||
#include <string> |
||||
|
||||
#include "OpenGL.h" |
||||
#include "Types.h" |
||||
#include "magnumVisibility.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
namespace Implementation { |
||||
struct DebugState; |
||||
} |
||||
|
||||
/**
|
||||
@brief Base for all OpenGL objects |
||||
*/ |
||||
class MAGNUM_EXPORT AbstractObject { |
||||
friend class Context; |
||||
friend class Implementation::DebugState; |
||||
|
||||
public: |
||||
/**
|
||||
* @brief Max object label length |
||||
* |
||||
* The result is cached, repeated queries don't result in repeated |
||||
* OpenGL calls. If @extension{KHR,debug} desktop or ES extension is |
||||
* not available, returns `0`. Note that @extension{EXT,debug_label} |
||||
* has no such limit. |
||||
* @see @ref AbstractQuery::setLabel(), @ref AbstractShaderProgram::setLabel(), |
||||
* @ref AbstractTexture::setLabel(), @ref Buffer::setLabel(), |
||||
* @ref BufferTexture::setLabel(), @ref Framebuffer::setLabel(), |
||||
* @ref Mesh::setLabel(), @ref Renderbuffer::setLabel(), |
||||
* @ref Shader::setLabel(), @fn_gl{Get} with @def_gl{MAX_LABEL_LENGTH} |
||||
*/ |
||||
static Int maxLabelLength(); |
||||
|
||||
protected: |
||||
MAGNUM_LOCAL AbstractObject() = default; |
||||
MAGNUM_LOCAL ~AbstractObject() = default; |
||||
|
||||
private: |
||||
static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, const std::string&); |
||||
static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, const std::string& label); |
||||
static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, const std::string& 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 |
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "DebugState.h" |
||||
|
||||
#include "AbstractObject.h" |
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
DebugState::DebugState(Context& context): maxLabelLength(0) { |
||||
if(context.isExtensionSupported<Extensions::GL::KHR::debug>()) { |
||||
getLabelImplementation = &AbstractObject::getLabelImplementationKhr; |
||||
labelImplementation = &AbstractObject::labelImplementationKhr; |
||||
} else if(context.isExtensionSupported<Extensions::GL::EXT::debug_label>()) { |
||||
getLabelImplementation = &AbstractObject::getLabelImplementationExt; |
||||
labelImplementation = &AbstractObject::labelImplementationExt; |
||||
} else { |
||||
getLabelImplementation = &AbstractObject::getLabelImplementationNoOp; |
||||
labelImplementation = &AbstractObject::labelImplementationNoOp; |
||||
} |
||||
} |
||||
|
||||
}} |
||||
@ -0,0 +1,48 @@
|
||||
#ifndef Magnum_Implementation_DebugState_h |
||||
#define Magnum_Implementation_DebugState_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include <string> |
||||
|
||||
#include "Magnum.h" |
||||
#include "OpenGL.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
struct DebugState { |
||||
DebugState(Context& context); |
||||
|
||||
typedef std::string(*GetLabelImplementation)(GLenum, GLuint); |
||||
GetLabelImplementation getLabelImplementation; |
||||
|
||||
typedef void(*LabelImplementation)(GLenum, GLuint, const std::string&); |
||||
LabelImplementation labelImplementation; |
||||
|
||||
GLint maxLabelLength; |
||||
}; |
||||
|
||||
}} |
||||
|
||||
#endif |
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Buffer.h" |
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class AbstractObjectGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit AbstractObjectGLTest(); |
||||
|
||||
void labelNoOp(); |
||||
}; |
||||
|
||||
AbstractObjectGLTest::AbstractObjectGLTest() { |
||||
addTests({&AbstractObjectGLTest::labelNoOp}); |
||||
} |
||||
|
||||
void AbstractObjectGLTest::labelNoOp() { |
||||
if(Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) |
||||
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is supported.")); |
||||
|
||||
Buffer buffer; |
||||
buffer.setLabel("MyBuffer"); |
||||
CORRADE_COMPARE(buffer.label(), ""); |
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::AbstractObjectGLTest) |
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Query.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class AbstractQueryGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit AbstractQueryGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
AbstractQueryGLTest::AbstractQueryGLTest() { |
||||
addTests({&AbstractQueryGLTest::label}); |
||||
} |
||||
|
||||
void AbstractQueryGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
SampleQuery query; |
||||
CORRADE_COMPARE(query.label(), ""); |
||||
|
||||
query.setLabel("MyQuery"); |
||||
CORRADE_COMPARE(query.label(), "MyQuery"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::AbstractQueryGLTest) |
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "AbstractShaderProgram.h" |
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class AbstractShaderProgramGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit AbstractShaderProgramGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() { |
||||
addTests({&AbstractShaderProgramGLTest::label}); |
||||
} |
||||
|
||||
void AbstractShaderProgramGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
class MyShader: public AbstractShaderProgram { |
||||
public: |
||||
explicit MyShader() {} |
||||
}; |
||||
|
||||
MyShader shader; |
||||
CORRADE_COMPARE(shader.label(), ""); |
||||
|
||||
shader.setLabel("MyShader"); |
||||
CORRADE_COMPARE(shader.label(), "MyShader"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramGLTest) |
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Texture.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class AbstractTextureGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit AbstractTextureGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
AbstractTextureGLTest::AbstractTextureGLTest() { |
||||
addTests({&AbstractTextureGLTest::label}); |
||||
} |
||||
|
||||
void AbstractTextureGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
Texture2D texture; |
||||
CORRADE_COMPARE(texture.label(), ""); |
||||
|
||||
texture.setLabel("MyTexture"); |
||||
CORRADE_COMPARE(texture.label(), "MyTexture"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::AbstractTextureGLTest) |
||||
@ -0,0 +1,62 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Framebuffer.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class FramebufferGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit FramebufferGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
FramebufferGLTest::FramebufferGLTest() { |
||||
addTests({&FramebufferGLTest::label}); |
||||
} |
||||
|
||||
void FramebufferGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
Framebuffer framebuffer({{}, Vector2i(32)}); |
||||
|
||||
CORRADE_COMPARE(framebuffer.label(), ""); |
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
|
||||
framebuffer.setLabel("MyFramebuffer"); |
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
|
||||
CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer"); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::FramebufferGLTest) |
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Mesh.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class MeshGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit MeshGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
MeshGLTest::MeshGLTest() { |
||||
addTests({&MeshGLTest::label}); |
||||
} |
||||
|
||||
void MeshGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
Mesh mesh; |
||||
CORRADE_COMPARE(mesh.label(), ""); |
||||
|
||||
mesh.setLabel("MyMesh"); |
||||
CORRADE_COMPARE(mesh.label(), "MyMesh"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::MeshGLTest) |
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Renderbuffer.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class RenderbufferGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit RenderbufferGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
RenderbufferGLTest::RenderbufferGLTest() { |
||||
addTests({&RenderbufferGLTest::label}); |
||||
} |
||||
|
||||
void RenderbufferGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
Renderbuffer renderbuffer; |
||||
CORRADE_COMPARE(renderbuffer.label(), ""); |
||||
|
||||
renderbuffer.setLabel("MyRenderbuffer"); |
||||
CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::RenderbufferGLTest) |
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Context.h" |
||||
#include "Extensions.h" |
||||
#include "Shader.h" |
||||
#include "Test/AbstractOpenGLTester.h" |
||||
|
||||
namespace Magnum { namespace Test { |
||||
|
||||
class ShaderGLTest: public AbstractOpenGLTester { |
||||
public: |
||||
explicit ShaderGLTest(); |
||||
|
||||
void label(); |
||||
}; |
||||
|
||||
ShaderGLTest::ShaderGLTest() { |
||||
addTests({&ShaderGLTest::label}); |
||||
} |
||||
|
||||
void ShaderGLTest::label() { |
||||
/* No-Op version is tested in AbstractObjectGLTest */ |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>() && |
||||
!Context::current()->isExtensionSupported<Extensions::GL::EXT::debug_label>()) |
||||
CORRADE_SKIP("Required extension is not available"); |
||||
|
||||
Shader shader(Version::GL210, Shader::Type::Vertex); |
||||
CORRADE_COMPARE(shader.label(), ""); |
||||
|
||||
shader.setLabel("MyShader"); |
||||
CORRADE_COMPARE(shader.label(), "MyShader"); |
||||
|
||||
MAGNUM_VERIFY_NO_ERROR(); |
||||
} |
||||
|
||||
}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::Test::ShaderGLTest) |
||||
Loading…
Reference in new issue