Browse Source

Enabled multisample texture framebuffer attachment in ES 3.1.

pull/68/head
Vladimír Vondruš 12 years ago
parent
commit
74a33df246
  1. 4
      src/Magnum/Framebuffer.cpp
  2. 7
      src/Magnum/Framebuffer.h
  3. 15
      src/Magnum/Test/FramebufferGLTest.cpp

4
src/Magnum/Framebuffer.cpp

@ -36,12 +36,12 @@
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/BufferImage.h"
#include "Magnum/MultisampleTexture.h"
#include "Magnum/TextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/CubeMapTextureArray.h"
#include "Magnum/MultisampleTexture.h"
#include "Magnum/RectangleTexture.h"
#endif
@ -190,7 +190,9 @@ Framebuffer& Framebuffer::attachTexture(const BufferAttachment attachment, Recta
(this->*Context::current()->state().framebuffer->texture2DImplementation)(attachment, GL_TEXTURE_RECTANGLE, texture.id(), 0);
return *this;
}
#endif
#ifndef MAGNUM_TARGET_GLES2
Framebuffer& Framebuffer::attachTexture(const BufferAttachment attachment, MultisampleTexture2D& texture) {
(this->*Context::current()->state().framebuffer->texture2DImplementation)(attachment, GL_TEXTURE_2D_MULTISAMPLE, texture.id(), 0);
return *this;

7
src/Magnum/Framebuffer.h

@ -523,10 +523,13 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* @requires_gl Rectangle textures are not available in OpenGL ES.
*/
Framebuffer& attachTexture(BufferAttachment attachment, RectangleTexture& texture);
#endif
#ifndef MAGNUM_TARGET_GLES2
/** @overload
* @requires_gl32 %Extension @extension{ARB,texture_multisample}
* @requires_gl Multisample textures are not available in OpenGL ES.
* @requires_gles31 Multisample textures are not available in OpenGL ES
* 3.0 and older.
*/
Framebuffer& attachTexture(BufferAttachment attachment, MultisampleTexture2D& texture);
#endif
@ -592,7 +595,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
/** @overload
* @requires_gl32 %Extension @extension{ARB,texture_multisample}
* @requires_gl Multisample textures are not available in OpenGL ES.
* @requires_gl Multisample array textures are not available in OpenGL ES.
*/
Framebuffer& attachTextureLayer(BufferAttachment attachment, MultisampleTexture2DArray& texture, Int layer);
#endif

15
src/Magnum/Test/FramebufferGLTest.cpp

@ -38,12 +38,12 @@
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/BufferImage.h"
#include "Magnum/MultisampleTexture.h"
#include "Magnum/TextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/CubeMapTextureArray.h"
#include "Magnum/MultisampleTexture.h"
#include "Magnum/RectangleTexture.h"
#endif
@ -72,9 +72,9 @@ class FramebufferGLTest: public AbstractOpenGLTester {
#endif
#ifndef MAGNUM_TARGET_GLES2
void attachTexture2DArray();
void attachTexture2DMultisample();
#endif
#ifndef MAGNUM_TARGET_GLES
void attachTexture2DMultisample();
void attachTexture2DMultisampleArray();
void attachRectangleTexture();
#endif
@ -120,9 +120,9 @@ FramebufferGLTest::FramebufferGLTest() {
#endif
#ifndef MAGNUM_TARGET_GLES2
&FramebufferGLTest::attachTexture2DArray,
&FramebufferGLTest::attachTexture2DMultisample,
#endif
#ifndef MAGNUM_TARGET_GLES
&FramebufferGLTest::attachTexture2DMultisample,
&FramebufferGLTest::attachTexture2DMultisampleArray,
&FramebufferGLTest::attachRectangleTexture,
#endif
@ -465,12 +465,17 @@ void FramebufferGLTest::attachTexture2DArray() {
}
#endif
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
void FramebufferGLTest::attachTexture2DMultisample() {
#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."));
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not available."));
#else
if(!Context::current()->isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
#endif
MultisampleTexture2D color;
color.setStorage(4, TextureFormat::RGBA8, {128, 128});
@ -485,7 +490,9 @@ void FramebufferGLTest::attachTexture2DMultisample() {
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::ReadDraw), Framebuffer::Status::Complete);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void FramebufferGLTest::attachTexture2DMultisampleArray() {
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));

Loading…
Cancel
Save