summaryrefslogtreecommitdiff
path: root/test/gl/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/gl/object.cpp')
-rw-r--r--test/gl/object.cpp82
1 files changed, 3 insertions, 79 deletions
diff --git a/test/gl/object.cpp b/test/gl/object.cpp
index a9fd038e61..5e7a158939 100644
--- a/test/gl/object.cpp
+++ b/test/gl/object.cpp
@@ -6,7 +6,6 @@
#include <mbgl/gl/gl_helper.hpp>
#include <mbgl/gl/gl_config.hpp>
#include <mbgl/gl/object_store.hpp>
-#include <mbgl/gl/texture_pool.hpp>
#include <memory>
@@ -99,6 +98,8 @@ TEST(GLObject, Store) {
texture.reset();
EXPECT_FALSE(store.empty());
store.performCleanup();
+ EXPECT_FALSE(store.empty());
+ store.reset();
EXPECT_TRUE(store.empty());
mbgl::gl::UniqueVAO vao = store.createVAO();
@@ -108,84 +109,7 @@ TEST(GLObject, Store) {
store.performCleanup();
EXPECT_TRUE(store.empty());
- mbgl::gl::UniqueTexturePool texturePool = store.createTexturePool();
- for (auto& id : texturePool.get()) {
- EXPECT_NE(id, 0u);
- }
- EXPECT_TRUE(texturePool.get().size() == size_t(mbgl::gl::TextureMax));
- texturePool.reset();
- EXPECT_FALSE(store.empty());
- store.performCleanup();
- EXPECT_TRUE(store.empty());
-
- view.deactivate();
-}
-
-TEST(GLObject, TexturePool) {
- mbgl::HeadlessView view(std::make_shared<mbgl::HeadlessDisplay>(), 1);
- view.activate();
-
- mbgl::gl::ObjectStore store;
- EXPECT_TRUE(store.empty());
-
- mbgl::gl::TexturePool pool;
-
- std::vector<mbgl::gl::PooledTexture> ids;
-
- // Fill an entire texture pool.
- for (auto i = 0; i != mbgl::gl::TextureMax; ++i) {
- ids.push_back(pool.acquireTexture(store));
- EXPECT_EQ(ids.back().get(), GLuint(i + 1));
- EXPECT_TRUE(store.empty());
- }
-
- // Reuse texture ids from the same pool.
- for (auto i = 0; i != mbgl::gl::TextureMax; ++i) {
- ids[i].reset();
- ids.push_back(pool.acquireTexture(store));
- EXPECT_EQ(ids.back().get(), GLuint(i + 1));
- EXPECT_TRUE(store.empty());
- }
-
- // Trigger a new texture pool creation.
- {
- mbgl::gl::PooledTexture id = pool.acquireTexture(store);
- EXPECT_EQ(id, GLuint(mbgl::gl::TextureMax + 1));
- EXPECT_TRUE(store.empty());
-
- id.reset();
-
- // Last used texture from pool triggers pool recycling.
- EXPECT_FALSE(store.empty());
-
- store.performCleanup();
- EXPECT_TRUE(store.empty());
- }
-
- // First pool is still full, thus creating a new pool.
- mbgl::gl::PooledTexture id1 = pool.acquireTexture(store);
- EXPECT_GT(id1.get(), GLuint(mbgl::gl::TextureMax));
- EXPECT_TRUE(store.empty());
-
- // Release all textures from the first pool.
- ids.clear();
- EXPECT_FALSE(store.empty());
-
- store.performCleanup();
- EXPECT_TRUE(store.empty());
-
- // The first pool is now gone, the next pool is now in use.
- mbgl::gl::PooledTexture id2 = pool.acquireTexture(store);
- EXPECT_GT(id2.get(), id1.get());
-
- id2.reset();
- EXPECT_TRUE(store.empty());
-
- // Last used texture from the pool triggers pool recycling.
- id1.reset();
- EXPECT_FALSE(store.empty());
-
- store.performCleanup();
+ store.reset();
EXPECT_TRUE(store.empty());
view.deactivate();