From 26963970215f03018aca29b8638e702043c633f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 6 Apr 2014 20:56:37 +0200 Subject: [PATCH] Verify that *Texture::bind() doesn't emit any GL errors. Can't verify much more at this time. --- src/Magnum/Test/BufferTextureGLTest.cpp | 12 ++++++ src/Magnum/Test/CubeMapTextureArrayGLTest.cpp | 9 +++++ src/Magnum/Test/CubeMapTextureGLTest.cpp | 9 +++++ src/Magnum/Test/MultisampleTextureGLTest.cpp | 26 ++++++++++++ src/Magnum/Test/RectangleTextureGLTest.cpp | 12 ++++++ src/Magnum/Test/TextureArrayGLTest.cpp | 34 ++++++++++++++++ src/Magnum/Test/TextureGLTest.cpp | 40 +++++++++++++++++++ 7 files changed, 142 insertions(+) diff --git a/src/Magnum/Test/BufferTextureGLTest.cpp b/src/Magnum/Test/BufferTextureGLTest.cpp index d0cbd7a4e..e61f38e62 100644 --- a/src/Magnum/Test/BufferTextureGLTest.cpp +++ b/src/Magnum/Test/BufferTextureGLTest.cpp @@ -36,12 +36,14 @@ class BufferTextureGLTest: public AbstractOpenGLTester { explicit BufferTextureGLTest(); void construct(); + void bind(); void setBuffer(); void setBufferOffset(); }; BufferTextureGLTest::BufferTextureGLTest() { addTests({&BufferTextureGLTest::construct, + &BufferTextureGLTest::bind, &BufferTextureGLTest::setBuffer, &BufferTextureGLTest::setBufferOffset}); } @@ -60,6 +62,16 @@ void BufferTextureGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); } +void BufferTextureGLTest::bind() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); + + BufferTexture texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + void BufferTextureGLTest::setBuffer() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); diff --git a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index 1d7e69a43..9e353ca7d 100644 --- a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -40,6 +40,7 @@ class CubeMapTextureArrayGLTest: public AbstractOpenGLTester { explicit CubeMapTextureArrayGLTest(); void construct(); + void bind(); void sampling(); void samplingBorderInteger(); @@ -59,6 +60,7 @@ class CubeMapTextureArrayGLTest: public AbstractOpenGLTester { CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { addTests({&CubeMapTextureArrayGLTest::construct, + &CubeMapTextureArrayGLTest::bind, &CubeMapTextureArrayGLTest::sampling, &CubeMapTextureArrayGLTest::samplingBorderInteger, @@ -90,6 +92,13 @@ void CubeMapTextureArrayGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); } +void CubeMapTextureArrayGLTest::bind() { + CubeMapTextureArray texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + void CubeMapTextureArrayGLTest::sampling() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index ede16a7f2..ac99f0cee 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -43,6 +43,7 @@ class CubeMapTextureGLTest: public AbstractOpenGLTester { explicit CubeMapTextureGLTest(); void construct(); + void bind(); void sampling(); #ifdef MAGNUM_TARGET_GLES2 @@ -72,6 +73,7 @@ class CubeMapTextureGLTest: public AbstractOpenGLTester { CubeMapTextureGLTest::CubeMapTextureGLTest() { addTests({&CubeMapTextureGLTest::construct, + &CubeMapTextureGLTest::bind, &CubeMapTextureGLTest::sampling, #ifdef MAGNUM_TARGET_GLES2 @@ -110,6 +112,13 @@ void CubeMapTextureGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); } +void CubeMapTextureGLTest::bind() { + CubeMapTexture texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + void CubeMapTextureGLTest::sampling() { CubeMapTexture texture; texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) diff --git a/src/Magnum/Test/MultisampleTextureGLTest.cpp b/src/Magnum/Test/MultisampleTextureGLTest.cpp index 6c5e959cc..fbfd5d759 100644 --- a/src/Magnum/Test/MultisampleTextureGLTest.cpp +++ b/src/Magnum/Test/MultisampleTextureGLTest.cpp @@ -37,6 +37,9 @@ class MultisampleTextureGLTest: public AbstractOpenGLTester { void construct2D(); void construct2DArray(); + void bind2D(); + void bind2DArray(); + void storage2D(); void storage2DArray(); @@ -61,6 +64,9 @@ MultisampleTextureGLTest::MultisampleTextureGLTest() { addTests({&MultisampleTextureGLTest::construct2D, &MultisampleTextureGLTest::construct2DArray, + &MultisampleTextureGLTest::bind2D, + &MultisampleTextureGLTest::bind2DArray, + &MultisampleTextureGLTest::storage2D, &MultisampleTextureGLTest::storage2DArray, @@ -109,6 +115,26 @@ void MultisampleTextureGLTest::construct2DArray() { MAGNUM_VERIFY_NO_ERROR(); } +void MultisampleTextureGLTest::bind2D() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + MultisampleTexture2D texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void MultisampleTextureGLTest::bind2DArray() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); + + MultisampleTexture2DArray texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + void MultisampleTextureGLTest::storage2D() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); diff --git a/src/Magnum/Test/RectangleTextureGLTest.cpp b/src/Magnum/Test/RectangleTextureGLTest.cpp index a4121ce06..7068671c5 100644 --- a/src/Magnum/Test/RectangleTextureGLTest.cpp +++ b/src/Magnum/Test/RectangleTextureGLTest.cpp @@ -41,6 +41,7 @@ class RectangleTextureGLTest: public AbstractOpenGLTester { explicit RectangleTextureGLTest(); void construct(); + void bind(); void sampling(); void samplingBorderInteger(); @@ -58,6 +59,7 @@ class RectangleTextureGLTest: public AbstractOpenGLTester { RectangleTextureGLTest::RectangleTextureGLTest() { addTests({&RectangleTextureGLTest::construct, + &RectangleTextureGLTest::bind, &RectangleTextureGLTest::sampling, &RectangleTextureGLTest::samplingBorderInteger, @@ -88,6 +90,16 @@ void RectangleTextureGLTest::construct() { MAGNUM_VERIFY_NO_ERROR(); } +void RectangleTextureGLTest::bind() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); + + RectangleTexture texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + void RectangleTextureGLTest::sampling() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); diff --git a/src/Magnum/Test/TextureArrayGLTest.cpp b/src/Magnum/Test/TextureArrayGLTest.cpp index 2817bde22..33ff280db 100644 --- a/src/Magnum/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/Test/TextureArrayGLTest.cpp @@ -45,6 +45,11 @@ class TextureArrayGLTest: public AbstractOpenGLTester { #endif void construct2D(); + #ifndef MAGNUM_TARGET_GLES + void bind1D(); + #endif + void bind2D(); + #ifndef MAGNUM_TARGET_GLES void sampling1D(); #endif @@ -105,6 +110,11 @@ TextureArrayGLTest::TextureArrayGLTest() { #endif &TextureArrayGLTest::construct2D, + #ifndef MAGNUM_TARGET_GLES + &TextureArrayGLTest::bind1D, + #endif + &TextureArrayGLTest::bind2D, + #ifndef MAGNUM_TARGET_GLES &TextureArrayGLTest::sampling1D, #endif @@ -189,6 +199,30 @@ void TextureArrayGLTest::construct2D() { MAGNUM_VERIFY_NO_ERROR(); } +#ifndef MAGNUM_TARGET_GLES +void TextureArrayGLTest::bind1D() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + + Texture1DArray texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureArrayGLTest::bind2D() { + #ifndef MAGNUM_TARGET_GLES + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); + #endif + + Texture2DArray texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + #ifndef MAGNUM_TARGET_GLES void TextureArrayGLTest::sampling1D() { if(!Context::current()->isExtensionSupported()) diff --git a/src/Magnum/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp index 2f5a0f2ce..2cfa992a3 100644 --- a/src/Magnum/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -48,6 +48,12 @@ class TextureGLTest: public AbstractOpenGLTester { void construct2D(); void construct3D(); + #ifndef MAGNUM_TARGET_GLES + void bind1D(); + #endif + void bind2D(); + void bind3D(); + #ifndef MAGNUM_TARGET_GLES void sampling1D(); #endif @@ -128,6 +134,12 @@ TextureGLTest::TextureGLTest() { &TextureGLTest::construct2D, &TextureGLTest::construct3D, + #ifndef MAGNUM_TARGET_GLES + &TextureGLTest::bind1D, + #endif + &TextureGLTest::bind2D, + &TextureGLTest::bind3D, + #ifndef MAGNUM_TARGET_GLES &TextureGLTest::sampling1D, #endif @@ -239,6 +251,34 @@ void TextureGLTest::construct3D() { MAGNUM_VERIFY_NO_ERROR(); } +#ifndef MAGNUM_TARGET_GLES +void TextureGLTest::bind1D() { + Texture1D texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + +void TextureGLTest::bind2D() { + Texture2D texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + +void TextureGLTest::bind3D() { + #ifdef MAGNUM_TARGET_GLES2 + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); + #endif + + Texture3D texture; + texture.bind(15); + + MAGNUM_VERIFY_NO_ERROR(); +} + #ifndef MAGNUM_TARGET_GLES void TextureGLTest::sampling1D() { Texture1D texture;