[gl] Moved TexturePool to gl namespace

This commit is contained in:
Bruno de Oliveira Abinader
2016-02-17 18:22:03 +02:00
parent 1336e3e30f
commit bfafc360a7
14 changed files with 33 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
#include <mbgl/util/texture_pool.hpp>
#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/gl/gl_object_store.hpp>
#include <mbgl/util/thread_context.hpp>
@@ -7,7 +7,8 @@
const GLsizei TextureMax = 64;
using namespace mbgl;
namespace mbgl {
namespace gl {
GLuint TexturePool::getTextureID() {
if (texture_ids.empty()) {
@@ -51,3 +52,6 @@ void TexturePool::clearTextureIDs() {
}
texture_ids.clear();
}
} // namespace gl
} // namespace mbgl

View File

@@ -5,9 +5,9 @@
#include <mbgl/gl/gl.hpp>
#include <set>
#include <mutex>
namespace mbgl {
namespace gl {
class TexturePool : private util::noncopyable {
@@ -20,6 +20,7 @@ private:
std::set<GLuint> texture_ids;
};
} // namespace gl
} // namespace mbgl
#endif

View File

@@ -17,8 +17,9 @@
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/gl/gl_object_store.hpp>
#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/util/worker.hpp>
#include <mbgl/util/texture_pool.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/mapbox.hpp>
@@ -33,7 +34,7 @@ MapContext::MapContext(View& view_, FileSource& fileSource, MapMode mode_, GLCon
data(*dataPtr),
asyncUpdate([this] { update(); }),
asyncInvalidate([&view_] { view_.invalidate(); }),
texturePool(std::make_unique<TexturePool>()) {
texturePool(std::make_unique<gl::TexturePool>()) {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
util::ThreadContext::setFileSource(&fileSource);

View File

@@ -18,11 +18,12 @@ namespace mbgl {
class View;
class MapData;
class TexturePool;
class Painter;
class SpriteImage;
class FileRequest;
namespace gl { class TexturePool; }
struct FrameData {
std::array<uint16_t, 2> framebufferSize;
};
@@ -86,7 +87,7 @@ private:
util::AsyncTask asyncUpdate;
util::AsyncTask asyncInvalidate;
std::unique_ptr<TexturePool> texturePool;
std::unique_ptr<gl::TexturePool> texturePool;
std::unique_ptr<Painter> painter;
std::unique_ptr<Style> style;

View File

@@ -5,7 +5,7 @@
using namespace mbgl;
RasterBucket::RasterBucket(TexturePool& texturePool)
RasterBucket::RasterBucket(gl::TexturePool& texturePool)
: raster(texturePool) {
}

View File

@@ -12,7 +12,7 @@ class VertexArrayObject;
class RasterBucket : public Bucket {
public:
RasterBucket(TexturePool&);
RasterBucket(gl::TexturePool&);
void upload() override;
void render(Painter&, const StyleLayer&, const TileID&, const mat4&) override;

View File

@@ -116,7 +116,7 @@ void Style::removeLayer(const std::string& id) {
}
void Style::update(const TransformState& transform,
TexturePool& texturePool) {
gl::TexturePool& texturePool) {
bool allTilesUpdated = true;
StyleUpdateParameters parameters(data.pixelRatio,
data.getDebug(),

View File

@@ -26,11 +26,11 @@ class SpriteAtlas;
class LineAtlas;
class StyleLayer;
class TransformState;
class TexturePool;
class Tile;
class Bucket;
namespace gl { class TexturePool; }
struct RenderItem {
inline RenderItem(const StyleLayer& layer_,
const Tile* tile_ = nullptr,
@@ -79,7 +79,7 @@ public:
// Fetch the tiles needed by the current viewport and emit a signal when
// a tile is ready so observers can render the tile.
void update(const TransformState&, TexturePool&);
void update(const TransformState&, gl::TexturePool&);
void cascade();
void recalculate(float z);

View File

@@ -7,9 +7,9 @@ namespace mbgl {
class TransformState;
class Worker;
class TexturePool;
class MapData;
class Style;
namespace gl { class TexturePool; }
class StyleUpdateParameters {
public:
@@ -18,7 +18,7 @@ public:
TimePoint animationTime_,
const TransformState& transformState_,
Worker& worker_,
TexturePool& texturePool_,
gl::TexturePool& texturePool_,
bool shouldReparsePartialTiles_,
const MapMode mode_,
MapData& data_,
@@ -39,7 +39,7 @@ public:
TimePoint animationTime;
const TransformState& transformState;
Worker& worker;
TexturePool& texturePool;
gl::TexturePool& texturePool;
bool shouldReparsePartialTiles;
const MapMode mode;

View File

@@ -11,7 +11,7 @@ using namespace mbgl;
RasterTileData::RasterTileData(const TileID& id_,
float pixelRatio,
const std::string& urlTemplate,
TexturePool &texturePool_,
gl::TexturePool &texturePool_,
Worker& worker_,
const std::function<void(std::exception_ptr)>& callback)
: TileData(id_),

View File

@@ -8,15 +8,15 @@ namespace mbgl {
class FileRequest;
class StyleLayer;
class TexturePool;
class WorkRequest;
namespace gl { class TexturePool; }
class RasterTileData : public TileData {
public:
RasterTileData(const TileID&,
float pixelRatio,
const std::string& urlTemplate,
TexturePool&,
gl::TexturePool&,
Worker&,
const std::function<void(std::exception_ptr)>& callback);
~RasterTileData();
@@ -25,7 +25,7 @@ public:
Bucket* getBucket(StyleLayer const &layer_desc) override;
private:
TexturePool& texturePool;
gl::TexturePool& texturePool;
Worker& worker;
std::unique_ptr<FileRequest> req;
std::unique_ptr<Bucket> bucket;

View File

@@ -9,7 +9,7 @@
using namespace mbgl;
Raster::Raster(TexturePool& texturePool_)
Raster::Raster(gl::TexturePool& texturePool_)
: texturePool(texturePool_)
{}

View File

@@ -2,7 +2,7 @@
#define MBGL_UTIL_RASTER
#include <mbgl/gl/gl.hpp>
#include <mbgl/util/texture_pool.hpp>
#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/ptr.hpp>
#include <mbgl/util/chrono.hpp>
@@ -14,7 +14,7 @@ namespace mbgl {
class Raster : public std::enable_shared_from_this<Raster> {
public:
Raster(TexturePool&);
Raster(gl::TexturePool&);
~Raster();
// load image data
@@ -50,7 +50,7 @@ private:
bool loaded = false;
// shared texture pool
TexturePool& texturePool;
gl::TexturePool& texturePool;
// min/mag filter
GLint filter = 0;

View File

@@ -12,7 +12,7 @@
#include <mbgl/map/transform.hpp>
#include <mbgl/map/map_data.hpp>
#include <mbgl/util/worker.hpp>
#include <mbgl/util/texture_pool.hpp>
#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_update_parameters.hpp>
#include <mbgl/layer/line_layer.hpp>
@@ -29,7 +29,7 @@ public:
Transform transform { view, ConstrainMode::HeightOnly };
TransformState transformState;
Worker worker { 1 };
TexturePool texturePool;
gl::TexturePool texturePool;
MapData mapData { MapMode::Still, GLContextMode::Unique, 1.0 };
Style style { mapData };