summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry/sprite_atlas.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-04-23 11:39:12 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-05-04 17:33:05 +0200
commit97a22b6f5fea5666025189231f5fecc4946ceb0b (patch)
tree7aae1422c631d92c01c4deb91b7d128a64f2df2c /src/mbgl/geometry/sprite_atlas.hpp
parent28b9b3f9d64207a03b6125b3e299efda59952a03 (diff)
downloadqtlocation-mapboxgl-97a22b6f5fea5666025189231f5fecc4946ceb0b.tar.gz
upload all GL objects before rendering a frame
This moves all texture updates and buffer uploads to the beginning of every frame, before we issue any drawing commands. This means the GPU typically has much more time to upload the data in the background until we actually need it, and doesn't have to pause to store/load the framebuffer.
Diffstat (limited to 'src/mbgl/geometry/sprite_atlas.hpp')
-rw-r--r--src/mbgl/geometry/sprite_atlas.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mbgl/geometry/sprite_atlas.hpp b/src/mbgl/geometry/sprite_atlas.hpp
index 079c15cefd..5605143104 100644
--- a/src/mbgl/geometry/sprite_atlas.hpp
+++ b/src/mbgl/geometry/sprite_atlas.hpp
@@ -50,10 +50,13 @@ public:
SpriteAtlasPosition getPosition(const std::string& name, bool repeating = false);
- // Binds the image buffer of this sprite atlas to the GPU, and uploads data if it is out
- // of date.
+ // Binds the atlas texture to the GPU, and uploads data if it is out of date.
void bind(bool linear = false);
+ // Uploads the texture to the GPU to be available when we need it. This is a lazy operation;
+ // the texture is only bound when the data is out of date (=dirty).
+ void upload();
+
inline float getWidth() const { return width; }
inline float getHeight() const { return height; }
inline float getTextureWidth() const { return width * pixelRatio; }