void FramebufferGLTest::constructMove() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); #endif Framebuffer a({{32, 16}, {128, 256}}); const Int id = a.id(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(id > 0); Framebuffer b(std::move(a)); CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.viewport(), Range2Di({32, 16}, {128, 256})); Framebuffer c({{128, 256}, {32, 16}}); const Int cId = c.id(); c = std::move(b); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(cId > 0); CORRADE_COMPARE(b.id(), cId); CORRADE_COMPARE(c.id(), id); CORRADE_COMPARE(c.viewport(), Range2Di({32, 16}, {128, 256})); }
void BufferGLTest::map() { #ifdef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported<Extensions::GL::OES::mapbuffer>()) CORRADE_SKIP(Extensions::GL::OES::mapbuffer::string() + std::string(" is not supported")); #endif Buffer buffer; constexpr char data[] = {2, 7, 5, 13, 25}; buffer.setData(data, BufferUsage::StaticDraw); #ifndef MAGNUM_TARGET_GLES char* contents = buffer.map<char>(Buffer::MapAccess::ReadWrite); #else char* contents = buffer.map<char>(Buffer::MapAccess::WriteOnly); #endif MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(contents); #ifndef MAGNUM_TARGET_GLES2 CORRADE_COMPARE(contents[2], 5); #endif contents[3] = 107; CORRADE_VERIFY(buffer.unmap()); MAGNUM_VERIFY_NO_ERROR(); /** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES Containers::Array<char> changedContents = buffer.data<char>(); CORRADE_COMPARE(changedContents.size(), 5); CORRADE_COMPARE(changedContents[3], 107); #endif }
void FramebufferGLTest::invalidate() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); #endif Renderbuffer color; #ifndef MAGNUM_TARGET_GLES2 color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); #else color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); #endif Renderbuffer stencil; stencil.setStorage(RenderbufferFormat::StencilIndex8, Vector2i(128)); Framebuffer framebuffer({{}, Vector2i(128)}); framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) .attachRenderbuffer(Framebuffer::BufferAttachment::Stencil, stencil); MAGNUM_VERIFY_NO_ERROR(); framebuffer.invalidate({Framebuffer::InvalidationAttachment::Depth, Framebuffer::ColorAttachment(0)}); MAGNUM_VERIFY_NO_ERROR(); }
void AbstractQueryGLTest::constructMove() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>()) CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); #endif SampleQuery a; const Int id = a.id(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(id > 0); SampleQuery b(std::move(a)); CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(b.id(), id); SampleQuery c; const Int cId = c.id(); c = std::move(b); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(cId > 0); CORRADE_COMPARE(b.id(), cId); CORRADE_COMPARE(c.id(), id); }
void SampleQueryGLTest::wrap() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>()) CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not available.")); #endif GLuint id; #ifndef MAGNUM_TARGET_GLES2 glGenQueries(1, &id); #else glGenQueriesEXT(1, &id); #endif /* Releasing won't delete anything */ { auto query = SampleQuery::wrap(id, SampleQuery::Target::AnySamplesPassed, ObjectFlag::DeleteOnDestruction); CORRADE_COMPARE(query.release(), id); } /* ...so we can wrap it again */ SampleQuery::wrap(id, SampleQuery::Target::AnySamplesPassed); #ifndef MAGNUM_TARGET_GLES2 glDeleteQueries(1, &id); #else glDeleteQueriesEXT(1, &id); #endif }
void TextureGLTest::subImageBuffer() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>()) CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); constexpr UnsignedByte zero[4*4*4] = {}; constexpr UnsignedByte subData[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; RectangleTexture texture; texture.setImage(TextureFormat::RGBA8, ImageReference2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(4), zero)); texture.setSubImage(Vector2i(1), BufferImage2D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector2i(2), subData, BufferUsage::StaticDraw)); MAGNUM_VERIFY_NO_ERROR(); BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte); texture.image(image, BufferUsage::StaticRead); const auto imageData = image.buffer().data<UnsignedByte>(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(4)); CORRADE_COMPARE_AS(std::vector<UnsignedByte>(imageData.begin(), imageData.end()), (std::vector<UnsignedByte>{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }), TestSuite::Compare::Container); }
void Test::hierarchy() { #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_EMSCRIPTEN) CORRADE_SKIP("Dependency hierarchy is meaningful only for dynamic plugins"); #else PluginManager::Manager<AbstractAnimal> manager(PLUGINS_DIR); CORRADE_COMPARE(manager.load("Chihuahua"), LoadState::Loaded); CORRADE_COMPARE(manager.loadState("Dog"), LoadState::Loaded); CORRADE_COMPARE(*manager.metadata("Chihuahua")->name(), "The smallest dog in the world."); CORRADE_COMPARE(manager.metadata("Chihuahua")->depends().size(), 1); CORRADE_COMPARE(manager.metadata("Chihuahua")->depends()[0], "Dog"); CORRADE_COMPARE(manager.metadata("Dog")->usedBy().size(), 1); CORRADE_COMPARE(manager.metadata("Dog")->usedBy()[0], "Chihuahua"); { std::unique_ptr<AbstractAnimal> animal = manager.instance("Chihuahua"); CORRADE_VERIFY(animal); CORRADE_VERIFY(animal->hasTail()); // inherited from dog CORRADE_COMPARE(animal->legCount(), 4); // this too CORRADE_COMPARE(animal->name(), "Rodriguez"); /* Try to unload plugin when another is depending on it */ CORRADE_COMPARE(manager.unload("Dog"), LoadState::Required); } /* After deleting instance, unload chihuahua plugin, then try again */ CORRADE_COMPARE(manager.unload("Chihuahua"), LoadState::NotLoaded); CORRADE_COMPARE(manager.unload("Dog"), LoadState::NotLoaded); CORRADE_VERIFY(manager.metadata("Dog")->usedBy().empty()); #endif }
void FramebufferGLTest::invalidateSub() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); #endif Renderbuffer color; #ifndef MAGNUM_TARGET_GLES2 color.setStorage(RenderbufferFormat::RGBA8, Vector2i(128)); #else color.setStorage(RenderbufferFormat::RGBA4, Vector2i(128)); #endif Renderbuffer depth; depth.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); Framebuffer framebuffer({{}, Vector2i(128)}); framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color) .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depth); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); framebuffer.invalidate({Framebuffer::InvalidationAttachment::Depth, Framebuffer::ColorAttachment(0)}, {{32, 16}, {79, 64}}); MAGNUM_VERIFY_NO_ERROR(); }
void SampleQueryGLTest::conditionalRender() { if(!Context::current()->isExtensionSupported<Extensions::GL::NV::conditional_render>()) CORRADE_SKIP(Extensions::GL::NV::conditional_render::string() + std::string(" is not available.")); Renderbuffer renderbuffer; renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(32)); Framebuffer framebuffer({{}, Vector2i(32)}); framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), renderbuffer); Buffer buffer; constexpr Vector2 triangle[] = {{-1.0f, 1.0f}, {-1.0f, -3.0f}, {3.0f, 1.0f}}; buffer.setData(triangle, BufferUsage::StaticDraw); Mesh mesh; mesh.setPrimitive(MeshPrimitive::Triangles) .setCount(3) .addVertexBuffer(buffer, 0, Attribute<0, Vector2>{}); MyShader shader; framebuffer.bind(); MAGNUM_VERIFY_NO_ERROR(); SampleQuery qYes{SampleQuery::Target::SamplesPassed}, qNo{SampleQuery::Target::SamplesPassed}, q{SampleQuery::Target::SamplesPassed}; /* This should generate some samples */ qYes.begin(); mesh.draw(shader); qYes.end(); /* Thus this should be rendered */ qYes.beginConditionalRender(SampleQuery::ConditionalRenderMode::Wait); q.begin(); mesh.draw(shader); q.end(); qYes.endConditionalRender(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(qYes.result<bool>()); CORRADE_VERIFY(q.result<bool>()); /* This shouldn't generate any samples */ qNo.begin(); qNo.end(); /* Thus this should not be rendered */ qNo.beginConditionalRender(SampleQuery::ConditionalRenderMode::Wait); q.begin(); mesh.draw(shader); q.end(); qNo.endConditionalRender(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(!qNo.result<bool>()); CORRADE_VERIFY(!q.result<bool>()); }
void FramebufferGLTest::multipleColorOutputs() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); #elif defined(MAGNUM_TARGET_GLES2) if(!Context::current()->isExtensionSupported<Extensions::GL::NV::draw_buffers>()) CORRADE_SKIP(Extensions::GL::NV::draw_buffers::string() + std::string(" is not available.")); #endif Texture2D color1; #ifndef MAGNUM_TARGET_GLES2 color1.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); #else color1.setStorage(1, TextureFormat::RGBA, Vector2i(128)); #endif Texture2D color2; #ifndef MAGNUM_TARGET_GLES2 color2.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); #else color2.setStorage(1, TextureFormat::RGBA, Vector2i(128)); #endif Renderbuffer depth; depth.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128)); Framebuffer framebuffer({{}, Vector2i(128)}); framebuffer.attachTexture(Framebuffer::ColorAttachment(0), color1, 0) .attachTexture(Framebuffer::ColorAttachment(1), color2, 0) .attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depth) .mapForDraw({{0, Framebuffer::ColorAttachment(1)}, {1, Framebuffer::ColorAttachment(0)}}); #ifdef MAGNUM_TARGET_GLES2 if(Context::current()->isExtensionSupported<Extensions::GL::NV::read_buffer>()) #endif { #ifdef MAGNUM_TARGET_GLES2 Debug() << "Using" << Extensions::GL::NV::read_buffer::string(); #endif framebuffer.mapForRead(Framebuffer::ColorAttachment(1)); } MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); }
void FramebufferGLTest::attachTexture2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); #endif MAGNUM_VERIFY_NO_ERROR(); Framebuffer framebuffer({{}, Vector2i(128)}); MAGNUM_VERIFY_NO_ERROR(); Texture2D color; #ifndef MAGNUM_TARGET_GLES2 color.setStorage(1, TextureFormat::RGBA8, Vector2i(128)); #else color.setStorage(1, rgbaFormatES2, Vector2i(128)); #endif MAGNUM_VERIFY_NO_ERROR(); framebuffer.attachTexture(Framebuffer::ColorAttachment(0), color, 0); MAGNUM_VERIFY_NO_ERROR(); #ifdef MAGNUM_TARGET_GLES2 if(Context::current()->isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>()) #endif { #ifdef MAGNUM_TARGET_GLES2 Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string(); #endif /** @todo Is there any better way to select proper sized/unsized format on ES2? */ Texture2D depthStencil; #ifndef MAGNUM_TARGET_GLES2 depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128)); framebuffer.attachTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); #else depthStencil.setStorage(1, depthStencilFormatES2, Vector2i(128)); framebuffer.attachTexture(Framebuffer::BufferAttachment::Depth, depthStencil, 0) .attachTexture(Framebuffer::BufferAttachment::Stencil, depthStencil, 0); #endif } #ifdef MAGNUM_TARGET_GLES2 else if(Context::current()->isExtensionSupported<Extensions::GL::OES::depth_texture>()) { Debug() << "Using" << Extensions::GL::OES::depth_texture::string(); Texture2D depth; depth.setStorage(1, TextureFormat::DepthComponent16, Vector2i(128)); framebuffer.attachTexture(Framebuffer::BufferAttachment::Depth, depth, 0); } #endif MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); }
void MultisampleTextureGLTest::construct2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); #else if(!Context::current()->isVersionSupported(Version::GLES310)) CORRADE_SKIP("OpenGL ES 3.1 is not supported."); #endif { MultisampleTexture2D texture; MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(texture.id() > 0); } MAGNUM_VERIFY_NO_ERROR(); }
void DirectoryTest::readNonSeekable() { #ifdef __unix__ /* (OS X doesn't have /proc) */ /** @todo Test more thoroughly than this */ const auto data = Directory::read("/proc/loadavg"); CORRADE_VERIFY(!data.empty()); #else CORRADE_SKIP("Not implemented on this platform."); #endif }
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(); }
void MultisampleTextureGLTest::storage2DArray() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); #else if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>()) CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported.")); #endif MultisampleTexture2DArray texture; texture.setStorage(4, TextureFormat::RGBA8, {16, 16, 5}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(texture.imageSize(), Vector3i(16, 16, 5)); MAGNUM_VERIFY_NO_ERROR(); }
void MultisampleTextureGLTest::construct2DArray() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); #else if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>()) CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported.")); #endif { MultisampleTexture2DArray texture; MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(texture.id() > 0); } MAGNUM_VERIFY_NO_ERROR(); }
void MultisampleTextureGLTest::storage2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); #else if(!Context::current()->isVersionSupported(Version::GLES310)) CORRADE_SKIP("OpenGL ES 3.1 is not supported."); #endif MultisampleTexture2D texture; texture.setStorage(4, TextureFormat::RGBA8, {16, 16}); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(texture.imageSize(), Vector2i(16, 16)); MAGNUM_VERIFY_NO_ERROR(); }
void ContextGLTest::isExtensionDisabled() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::APPLE::vertex_array_object>()) CORRADE_SKIP(Extensions::GL::APPLE::vertex_array_object::string() + std::string(" extension should be supported, can't test")); if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>()) CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test")); /* This is not disabled anywhere */ CORRADE_VERIFY(!Context::current()->isExtensionDisabled<Extensions::GL::APPLE::vertex_array_object>()); /* This is disabled in GL < 3.2 to work around GLSL compiler bugs */ CORRADE_VERIFY(Context::current()->isExtensionDisabled<Extensions::GL::ARB::explicit_attrib_location>(Version::GL310)); CORRADE_VERIFY(!Context::current()->isExtensionDisabled<Extensions::GL::ARB::explicit_attrib_location>(Version::GL320)); #else CORRADE_SKIP("No useful extensions to test on OpenGL ES"); #endif }
void DebugOutputGLTest::setCallback() { if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>()) CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported")); /* Need to be careful, because the test runner is using debug output too */ DebugOutput::setDefaultCallback(); MAGNUM_VERIFY_NO_ERROR(); }
void CubeMapTextureGLTest::samplingMaxLevel() { if(!Context::current()->isExtensionSupported<Extensions::GL::APPLE::texture_max_level>()) CORRADE_SKIP(Extensions::GL::APPLE::texture_max_level::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setMaxLevel(750); MAGNUM_VERIFY_NO_ERROR(); }
void FramebufferGLTest::attachCubeMapTextureArray() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not available.")); CubeMapTextureArray color; color.setStorage(1, TextureFormat::RGBA8, {128, 128, 18}); CubeMapTextureArray depthStencil; depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, {128, 128, 18}); Framebuffer framebuffer({{}, Vector2i(128)}); framebuffer.attachTextureLayer(Framebuffer::ColorAttachment(0), color, 0, 3) .attachTextureLayer(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0, 3); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); }
void Test::wrongMetadataFile() { #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_EMSCRIPTEN) CORRADE_SKIP("Can't test metadata file of static plugins"); #else PluginManager::Manager<AbstractAnimal> manager(PLUGINS_DIR); CORRADE_COMPARE(manager.loadState("Snail"), LoadState::WrongMetadataFile); CORRADE_COMPARE(manager.load("Snail"), LoadState::WrongMetadataFile); #endif }
void FramebufferGLTest::attachRectangleTexture() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>()) CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not available.")); RectangleTexture color; color.setStorage(TextureFormat::RGBA8, Vector2i(128)); RectangleTexture depthStencil; depthStencil.setStorage(TextureFormat::Depth24Stencil8, Vector2i(128)); Framebuffer framebuffer({{}, Vector2i(128)}); framebuffer.attachTexture(Framebuffer::ColorAttachment(0), color, 0) .attachTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0); MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); }
void TextureGLTest::invalidateSubImage() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>()) CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); RectangleTexture texture; texture.setStorage(TextureFormat::RGBA8, Vector2i(32)); texture.invalidateSubImage(Vector2i(4), Vector2i(16)); MAGNUM_VERIFY_NO_ERROR(); }
void AbstractQueryGLTest::label() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>()) CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); #endif /* 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(); }
void MultisampleTextureGLTest::invalidateSubImage2DArray() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); MultisampleTexture2DArray texture; texture.setStorage(4, TextureFormat::RGBA8, {16, 16, 5}); texture.invalidateSubImage({3, 4, 1}, {5, 6, 3}); MAGNUM_VERIFY_NO_ERROR(); }
void CubeMapTextureGLTest::samplingCompare() { if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::shadow_samplers>() || !Context::current()->isExtensionSupported<Extensions::GL::NV::shadow_samplers_cube>()) CORRADE_SKIP(Extensions::GL::NV::shadow_samplers_cube::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setCompareMode(Sampler::CompareMode::CompareRefToTexture) .setCompareFunction(Sampler::CompareFunction::GreaterOrEqual); MAGNUM_VERIFY_NO_ERROR(); }
void CubeMapTextureGLTest::samplingSwizzle() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_swizzle>()) CORRADE_SKIP(Extensions::GL::ARB::texture_swizzle::string() + std::string(" is not supported.")); #endif CubeMapTexture texture; texture.setSwizzle<'b', 'g', 'r', '0'>(); MAGNUM_VERIFY_NO_ERROR(); }
void AnyImporterTest::ogg() { if(_manager.loadState("VorbisAudioImporter") == PluginManager::LoadState::NotFound) CORRADE_SKIP("VorbisAudioImporter plugin not found, cannot test"); AnyImporter importer{_manager}; CORRADE_VERIFY(importer.openFile(OGG_FILE)); /* Check only parameters, as it is good enough proof that it is working */ CORRADE_COMPARE(importer.format(), Buffer::Format::Mono16); CORRADE_COMPARE(importer.frequency(), 96000); }
void DebugOutputGLTest::setEnabled() { if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>()) CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported")); /* Try at least some combinations */ DebugOutput::setEnabled(DebugOutput::Source::Application, true); DebugOutput::setEnabled(DebugOutput::Source::Application, DebugOutput::Type::UndefinedBehavior, {3168, 35487, 234487}, false); DebugOutput::setEnabled(true); MAGNUM_VERIFY_NO_ERROR(); }