From 92a24fd63733e3fc0ed6dda89ef83b54a54dbdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 13 Aug 2014 12:39:46 +0200 Subject: [PATCH] Add missing test for multisample texture framebuffer attachment. --- src/Magnum/Test/FramebufferGLTest.cpp | 37 +++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Test/FramebufferGLTest.cpp b/src/Magnum/Test/FramebufferGLTest.cpp index efebc4852..f7477f5f2 100644 --- a/src/Magnum/Test/FramebufferGLTest.cpp +++ b/src/Magnum/Test/FramebufferGLTest.cpp @@ -43,6 +43,7 @@ #ifndef MAGNUM_TARGET_GLES #include "Magnum/CubeMapTextureArray.h" +#include "Magnum/MultisampleTexture.h" #include "Magnum/RectangleTexture.h" #endif @@ -466,11 +467,43 @@ void FramebufferGLTest::attachTexture2DArray() { #ifndef MAGNUM_TARGET_GLES void FramebufferGLTest::attachTexture2DMultisample() { - CORRADE_SKIP("Multisample textures are not implemented yet."); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not available.")); + + MultisampleTexture2D color; + color.setStorage(4, TextureFormat::RGBA8, {128, 128}); + + MultisampleTexture2D depthStencil; + depthStencil.setStorage(4, TextureFormat::Depth24Stencil8, {128, 128}); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTexture(Framebuffer::ColorAttachment(0), color) + .attachTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); } void FramebufferGLTest::attachTexture2DMultisampleArray() { - CORRADE_SKIP("Multisample textures are not implemented yet."); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not available.")); + + MultisampleTexture2DArray color; + color.setStorage(4, TextureFormat::RGBA8, {128, 128, 8}); + + MultisampleTexture2DArray depthStencil; + depthStencil.setStorage(4, TextureFormat::Depth24Stencil8, {128, 128, 8}); + + Framebuffer framebuffer({{}, Vector2i(128)}); + framebuffer.attachTextureLayer(Framebuffer::ColorAttachment(0), color, 3) + .attachTextureLayer(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 3); + + MAGNUM_VERIFY_NO_ERROR(); + CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete); } void FramebufferGLTest::attachRectangleTexture() {