summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-05-13 17:13:31 -0700
committerKonstantin Käfer <mail@kkaefer.com>2019-05-15 11:57:43 -0700
commit3a6ff7710fcf201f82ddc2090488ef585bd8ab17 (patch)
treede380cbb7f5553282b081dce9202cbe9e502ebe5 /src/mbgl/geometry
parentbf0998697e0893d8a56421a139c7fc4855e89fa5 (diff)
downloadqtlocation-mapboxgl-3a6ff7710fcf201f82ddc2090488ef585bd8ab17.tar.gz
[core] add gfx::UploadPass, split startRender into prepare and upload
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r--src/mbgl/geometry/line_atlas.cpp14
-rw-r--r--src/mbgl/geometry/line_atlas.hpp6
2 files changed, 11 insertions, 9 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index a3c1c9abce..106a24d015 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -1,5 +1,5 @@
#include <mbgl/geometry/line_atlas.hpp>
-#include <mbgl/gfx/context.hpp>
+#include <mbgl/gfx/upload_pass.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/util/hash.hpp>
@@ -126,18 +126,20 @@ Size LineAtlas::getSize() const {
return image.size;
}
-void LineAtlas::upload(gfx::Context& context) {
+void LineAtlas::upload(gfx::UploadPass& uploadPass) {
if (!texture) {
- texture = context.createTexture(image);
+ texture = uploadPass.createTexture(image);
} else if (dirty) {
- context.updateTexture(*texture, image);
+ uploadPass.updateTexture(*texture, image);
}
dirty = false;
}
-gfx::TextureBinding LineAtlas::textureBinding(gfx::Context& context) {
- upload(context);
+gfx::TextureBinding LineAtlas::textureBinding() {
+ assert(texture);
+ // All _changes_ to the texture should've been made and uploaded already.
+ assert(!dirty);
return { texture->getResource(), gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No,
gfx::TextureWrapType::Repeat, gfx::TextureWrapType::Clamp };
}
diff --git a/src/mbgl/geometry/line_atlas.hpp b/src/mbgl/geometry/line_atlas.hpp
index 3a238f8507..b43583c9c8 100644
--- a/src/mbgl/geometry/line_atlas.hpp
+++ b/src/mbgl/geometry/line_atlas.hpp
@@ -11,7 +11,7 @@
namespace mbgl {
namespace gfx {
-class Context;
+class UploadPass;
} // namespace gfx
class LinePatternPos {
@@ -32,11 +32,11 @@ public:
~LineAtlas();
// Binds the atlas texture to the GPU, and uploads data if it is out of date.
- gfx::TextureBinding textureBinding(gfx::Context&);
+ gfx::TextureBinding textureBinding();
// 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(gfx::Context&);
+ void upload(gfx::UploadPass&);
LinePatternPos getDashPosition(const std::vector<float>&, LinePatternCap);
LinePatternPos addDash(const std::vector<float>& dasharray, LinePatternCap);