@ -24,9 +24,7 @@
*/
*/
# include "Magnum/configure.h"
# include "Magnum/configure.h"
# ifndef MAGNUM_TARGET_GLES2
# include "Magnum/Color.h"
# include "Magnum/BufferImage.h"
# endif
# include "Magnum/ColorFormat.h"
# include "Magnum/ColorFormat.h"
# include "Magnum/Context.h"
# include "Magnum/Context.h"
# include "Magnum/Extensions.h"
# include "Magnum/Extensions.h"
@ -38,6 +36,16 @@
# include "Magnum/TextureFormat.h"
# include "Magnum/TextureFormat.h"
# include "Magnum/Test/AbstractOpenGLTester.h"
# include "Magnum/Test/AbstractOpenGLTester.h"
# ifndef MAGNUM_TARGET_GLES2
# include "Magnum/BufferImage.h"
# include "Magnum/TextureArray.h"
# endif
# ifndef MAGNUM_TARGET_GLES
# include "Magnum/CubeMapTextureArray.h"
# include "Magnum/RectangleTexture.h"
# endif
namespace Magnum { namespace Test {
namespace Magnum { namespace Test {
class FramebufferGLTest : public AbstractOpenGLTester {
class FramebufferGLTest : public AbstractOpenGLTester {
@ -298,8 +306,8 @@ void FramebufferGLTest::attachTexture1D() {
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , 128 ) ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , 128 ) ;
Framebuffer framebuffer ( { { } , { 128 , 1 } } ) ;
Framebuffer framebuffer ( { { } , { 128 , 1 } } ) ;
framebuffer . attachTexture1D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 )
framebuffer . attachTexture ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 )
. attachTexture1D ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
. attachTexture ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
@ -327,7 +335,7 @@ void FramebufferGLTest::attachTexture2D() {
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
framebuffer . attachTexture2D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 ) ;
framebuffer . attachTexture ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
@ -342,11 +350,11 @@ void FramebufferGLTest::attachTexture2D() {
Texture2D depthStencil ;
Texture2D depthStencil ;
# ifndef MAGNUM_TARGET_GLES2
# ifndef MAGNUM_TARGET_GLES2
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , Vector2i ( 128 ) ) ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , Vector2i ( 128 ) ) ;
framebuffer . attachTexture2D ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
framebuffer . attachTexture ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
# else
# else
depthStencil . setStorage ( 1 , TextureFormat : : DepthStencil , Vector2i ( 128 ) ) ;
depthStencil . setStorage ( 1 , TextureFormat : : DepthStencil , Vector2i ( 128 ) ) ;
framebuffer . attachTexture2D ( Framebuffer : : BufferAttachment : : Depth , depthStencil , 0 )
framebuffer . attachTexture ( Framebuffer : : BufferAttachment : : Depth , depthStencil , 0 )
. attachTexture2D ( Framebuffer : : BufferAttachment : : Stencil , depthStencil , 0 ) ;
. attachTexture ( Framebuffer : : BufferAttachment : : Stencil , depthStencil , 0 ) ;
# endif
# endif
}
}
@ -356,7 +364,7 @@ void FramebufferGLTest::attachTexture2D() {
Texture2D depth ;
Texture2D depth ;
depth . setStorage ( 1 , TextureFormat : : DepthComponent16 , Vector2i ( 128 ) ) ;
depth . setStorage ( 1 , TextureFormat : : DepthComponent16 , Vector2i ( 128 ) ) ;
framebuffer . attachTexture2D ( Framebuffer : : BufferAttachment : : Depth , depth , 0 ) ;
framebuffer . attachTexture ( Framebuffer : : BufferAttachment : : Depth , depth , 0 ) ;
}
}
# endif
# endif
@ -371,8 +379,6 @@ void FramebufferGLTest::attachTexture3D() {
# elif defined(MAGNUM_TARGET_GLES2)
# elif defined(MAGNUM_TARGET_GLES2)
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : OES : : texture_3D > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : OES : : texture_3D > ( ) )
CORRADE_SKIP ( Extensions : : GL : : OES : : texture_3D : : string ( ) + std : : string ( " is not available. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : OES : : texture_3D : : string ( ) + std : : string ( " is not available. " ) ) ;
# else
CORRADE_SKIP ( " Not properly implemented yet. " ) ;
# endif
# endif
Texture3D color ;
Texture3D color ;
@ -383,7 +389,7 @@ void FramebufferGLTest::attachTexture3D() {
# endif
# endif
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
framebuffer . attachTexture3D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 , 0 ) ;
framebuffer . attachTextureLayer ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 , 0 ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
@ -394,17 +400,16 @@ void FramebufferGLTest::attachTexture1DArray() {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not available. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not available. " ) ) ;
Texture2D color ( Texture2D : : Target : : Texture1DArray ) ;
Texture1DArray color ;
color . setStorage ( 1 , TextureFormat : : RGBA8 , { 128 , 8 } ) ;
color . setStorage ( 1 , TextureFormat : : RGBA8 , { 128 , 8 } ) ;
Texture2D depthStencil ( Texture2D : : Target : : Texture1DArray ) ;
Texture1DArray depthStencil ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , { 128 , 8 } ) ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , { 128 , 8 } ) ;
Framebuffer framebuffer ( { { } , { 128 , 1 } } ) ;
Framebuffer framebuffer ( { { } , { 128 , 1 } } ) ;
framebuffer . attachTexture2D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 )
framebuffer . attachTextureLayer ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 , 3 )
. attachTexture2D ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
. attachTextureLayer ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 , 3 ) ;
CORRADE_EXPECT_FAIL ( " Not properly implemented yet. " ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
}
}
@ -415,21 +420,20 @@ void FramebufferGLTest::attachTexture2DArray() {
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not available. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not available. " ) ) ;
# else
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : EXT : : texture_array > ( ) )
CORRADE_SKIP ( " Not properly implemented yet. " ) ;
CORRADE_SKIP ( Extensions : : GL : : EXT : : texture_array : : string ( ) + std : : string ( " is not available. " ) ) ;
# endif
# endif
Texture3D color ( Texture3D : : Target : : Texture2DArray ) ;
Texture2DArray color ;
color . setStorage ( 1 , TextureFormat : : RGBA8 , { 128 , 128 , 8 } ) ;
color . setStorage ( 1 , TextureFormat : : RGBA8 , { 128 , 128 , 8 } ) ;
Texture3D depthStencil ( Texture3D : : Target : : Texture2DArray ) ;
Texture2DArray depthStencil ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , { 128 , 128 , 8 } ) ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , { 128 , 128 , 8 } ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
framebuffer . attachTexture3D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 , 0 )
framebuffer . attachTextureLayer ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 , 3 )
. attachTexture3D ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 , 0 ) ;
. attachTextureLayer ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 , 3 ) ;
CORRADE_EXPECT_FAIL ( " Not properly implemented yet. " ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
}
}
@ -450,15 +454,15 @@ void FramebufferGLTest::attachRectangleTexture() {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : texture_rectangle > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : texture_rectangle > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : texture_rectangle : : string ( ) + std : : string ( " is not available. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : texture_rectangle : : string ( ) + std : : string ( " is not available. " ) ) ;
Texture2D color ( Texture2D : : Target : : Rectangle ) ;
RectangleTexture color ;
color . setStorage ( 1 , TextureFormat : : RGBA8 , Vector2i ( 128 ) ) ;
color . setStorage ( TextureFormat : : RGBA8 , Vector2i ( 128 ) ) ;
Texture2D depthStencil ( Texture2D : : Target : : Rectangle ) ;
RectangleTexture depthStencil ;
depthStencil . setStorage ( 1 , TextureFormat : : Depth24Stencil8 , Vector2i ( 128 ) ) ;
depthStencil . setStorage ( TextureFormat : : Depth24Stencil8 , Vector2i ( 128 ) ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
framebuffer . attachTexture2D ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 )
framebuffer . attachTexture ( Framebuffer : : ColorAttachment ( 0 ) , color , 0 )
. attachTexture2D ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
. attachTexture ( Framebuffer : : BufferAttachment : : DepthStencil , depthStencil , 0 ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
CORRADE_COMPARE ( framebuffer . checkStatus ( FramebufferTarget : : ReadDraw ) , Framebuffer : : Status : : Complete ) ;
@ -516,7 +520,23 @@ void FramebufferGLTest::attachCubeMapTexture() {
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
void FramebufferGLTest : : attachCubeMapTextureArray ( ) {
void FramebufferGLTest : : attachCubeMapTextureArray ( ) {
CORRADE_SKIP ( " Not implemented yet. " ) ;
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 ) ;
}
}
# endif
# endif
@ -547,8 +567,8 @@ void FramebufferGLTest::multipleColorOutputs() {
depth . setStorage ( RenderbufferFormat : : DepthComponent16 , Vector2i ( 128 ) ) ;
depth . setStorage ( RenderbufferFormat : : DepthComponent16 , Vector2i ( 128 ) ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
Framebuffer framebuffer ( { { } , Vector2i ( 128 ) } ) ;
framebuffer . attachTexture2D ( Framebuffer : : ColorAttachment ( 0 ) , color1 , 0 )
framebuffer . attachTexture ( Framebuffer : : ColorAttachment ( 0 ) , color1 , 0 )
. attachTexture2D ( Framebuffer : : ColorAttachment ( 1 ) , color2 , 0 )
. attachTexture ( Framebuffer : : ColorAttachment ( 1 ) , color2 , 0 )
. attachRenderbuffer ( Framebuffer : : BufferAttachment : : Depth , depth )
. attachRenderbuffer ( Framebuffer : : BufferAttachment : : Depth , depth )
. mapForDraw ( { { 0 , Framebuffer : : ColorAttachment ( 1 ) } ,
. mapForDraw ( { { 0 , Framebuffer : : ColorAttachment ( 1 ) } ,
{ 1 , Framebuffer : : ColorAttachment ( 0 ) } } ) ;
{ 1 , Framebuffer : : ColorAttachment ( 0 ) } } ) ;