[core] s/SharedTexture/PooledTexture/

This commit is contained in:
Bruno de Oliveira Abinader
2016-06-07 22:42:18 +03:00
parent 20fe1d2be4
commit cfac924606
4 changed files with 9 additions and 9 deletions

View File

@@ -67,8 +67,8 @@ TexturePool::TexturePool() : impl(std::make_unique<Impl>()) {
TexturePool::~TexturePool() {
}
SharedTexture TexturePool::acquireTexture(gl::ObjectStore& store) {
return SharedTexture { impl->acquireTexture(store) , { this } };
PooledTexture TexturePool::acquireTexture(gl::ObjectStore& store) {
return PooledTexture { impl->acquireTexture(store) , { this } };
}
} // namespace gl

View File

@@ -18,14 +18,14 @@ struct TextureReleaser {
void operator()(GLuint) const;
};
using SharedTexture = std_experimental::unique_resource<GLuint, TextureReleaser>;
using PooledTexture = std_experimental::unique_resource<GLuint, TextureReleaser>;
class TexturePool : private util::noncopyable {
public:
TexturePool();
~TexturePool();
SharedTexture acquireTexture(gl::ObjectStore&);
PooledTexture acquireTexture(gl::ObjectStore&);
private:
friend TextureReleaser;

View File

@@ -34,7 +34,7 @@ public:
GLsizei height = 0;
// GL buffer object handle.
mbgl::optional<gl::SharedTexture> texture;
mbgl::optional<gl::PooledTexture> texture;
// texture opacity
double opacity = 0;

View File

@@ -130,7 +130,7 @@ TEST(GLObject, TexturePool) {
mbgl::gl::TexturePool pool;
std::vector<mbgl::gl::SharedTexture> ids;
std::vector<mbgl::gl::PooledTexture> ids;
// Fill an entire texture pool.
for (auto i = 0; i != mbgl::gl::TextureMax; ++i) {
@@ -149,7 +149,7 @@ TEST(GLObject, TexturePool) {
// Trigger a new texture pool creation.
{
mbgl::gl::SharedTexture id = pool.acquireTexture(store);
mbgl::gl::PooledTexture id = pool.acquireTexture(store);
EXPECT_EQ(id, mbgl::gl::TextureMax + 1);
EXPECT_TRUE(store.empty());
@@ -163,7 +163,7 @@ TEST(GLObject, TexturePool) {
}
// First pool is still full, thus creating a new pool.
mbgl::gl::SharedTexture id1 = pool.acquireTexture(store);
mbgl::gl::PooledTexture id1 = pool.acquireTexture(store);
EXPECT_GT(id1.get(), mbgl::gl::TextureMax);
EXPECT_TRUE(store.empty());
@@ -175,7 +175,7 @@ TEST(GLObject, TexturePool) {
EXPECT_TRUE(store.empty());
// The first pool is now gone, the next pool is now in use.
mbgl::gl::SharedTexture id2 = pool.acquireTexture(store);
mbgl::gl::PooledTexture id2 = pool.acquireTexture(store);
EXPECT_GT(id2.get(), id1.get());
id2.reset();