Browse Source

Make it possible to attach cube map and multisample arrays on ES3 AEP.

Somehow I forgot to enable this when doing support for the
ANDROID_extension_pack_es31a extension.
pull/126/head
Vladimír Vondruš 11 years ago
parent
commit
e5909819fe
  1. 7
      src/Magnum/Framebuffer.cpp
  2. 15
      src/Magnum/Framebuffer.h
  3. 33
      src/Magnum/Test/FramebufferGLTest.cpp

7
src/Magnum/Framebuffer.cpp

@ -41,9 +41,10 @@
#endif
#include "Magnum/TextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/CubeMapTextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/RectangleTexture.h"
#endif
@ -261,7 +262,7 @@ Framebuffer& Framebuffer::attachTextureLayer(const BufferAttachment attachment,
}
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Framebuffer& Framebuffer::attachTextureLayer(const BufferAttachment attachment, CubeMapTextureArray& texture, Int level, Int layer) {
(this->*Context::current()->state().framebuffer->textureLayerImplementation)(attachment, texture.id(), level, layer);
return *this;

15
src/Magnum/Framebuffer.h

@ -703,18 +703,23 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
Framebuffer& attachTextureLayer(BufferAttachment attachment, Texture2DArray& texture, Int level, Int layer);
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/** @overload
* @requires_gl40 Extension @extension{ARB,texture_cube_map_array}
* @requires_gl Cube map texture arrays are not available in OpenGL ES
* or WebGL.
* @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_cube_map_array}
* @requires_gles Cube map texture arrays are not available in WebGL.
*/
Framebuffer& attachTextureLayer(BufferAttachment attachment, CubeMapTextureArray& texture, Int level, Int layer);
/** @overload
* @requires_gl32 Extension @extension{ARB,texture_multisample}
* @requires_gl Multisample array textures are not available in OpenGL
* ES or WebGL.
* @requires_gles30 Multisample 2D array textures are not defined in
* OpenGL ES 2.0.
* @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{OES,texture_storage_multisample_2d_array}
* @requires_gles Multisample textures are not available in WebGL.
*/
Framebuffer& attachTextureLayer(BufferAttachment attachment, MultisampleTexture2DArray& texture, Int layer);
#endif

33
src/Magnum/Test/FramebufferGLTest.cpp

@ -41,9 +41,10 @@
#include "Magnum/MultisampleTexture.h"
#include "Magnum/TextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/CubeMapTextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/RectangleTexture.h"
#endif
@ -75,12 +76,14 @@ struct FramebufferGLTest: AbstractOpenGLTester {
void attachTexture2DArray();
void attachTexture2DMultisample();
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void attachTexture2DMultisampleArray();
#endif
#ifndef MAGNUM_TARGET_GLES
void attachRectangleTexture();
#endif
void attachCubeMapTexture();
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void attachCubeMapTextureArray();
#endif
void detach();
@ -128,12 +131,14 @@ FramebufferGLTest::FramebufferGLTest() {
&FramebufferGLTest::attachTexture2DArray,
&FramebufferGLTest::attachTexture2DMultisample,
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&FramebufferGLTest::attachTexture2DMultisampleArray,
#endif
#ifndef MAGNUM_TARGET_GLES
&FramebufferGLTest::attachRectangleTexture,
#endif
&FramebufferGLTest::attachCubeMapTexture,
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&FramebufferGLTest::attachCubeMapTextureArray,
#endif
&FramebufferGLTest::detach,
@ -528,12 +533,17 @@ void FramebufferGLTest::attachTexture2DMultisample() {
}
#endif
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void FramebufferGLTest::attachTexture2DMultisampleArray() {
#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()->isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not available."));
#endif
MultisampleTexture2DArray color;
color.setStorage(4, TextureFormat::RGBA8, {128, 128, 8});
@ -549,7 +559,9 @@ void FramebufferGLTest::attachTexture2DMultisampleArray() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Read), Framebuffer::Status::Complete);
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#endif
#ifndef MAGNUM_TARGET_GLES
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."));
@ -622,12 +634,17 @@ void FramebufferGLTest::attachCubeMapTexture() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#ifndef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void FramebufferGLTest::attachCubeMapTextureArray() {
#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_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not available."));
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not available."));
#endif
CubeMapTextureArray color;
color.setStorage(1, TextureFormat::RGBA8, {128, 128, 18});

Loading…
Cancel
Save