summaryrefslogtreecommitdiff
path: root/src/mbgl/geometry
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-07 17:50:02 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-03-12 11:03:54 +0100
commite27f33062994a1b0155b44b9d471e48e93b09f8e (patch)
treeeff2ba71134b9721c16fd53378b9256b94396712 /src/mbgl/geometry
parentcb64c380fbbd209cb68af60e76b7a770805353a8 (diff)
downloadqtlocation-mapboxgl-e27f33062994a1b0155b44b9d471e48e93b09f8e.tar.gz
[core] add texture bindings to draw call instead of Context member fn
Diffstat (limited to 'src/mbgl/geometry')
-rw-r--r--src/mbgl/geometry/line_atlas.cpp14
-rw-r--r--src/mbgl/geometry/line_atlas.hpp4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp
index e1443dc3ab..5f9acab0e8 100644
--- a/src/mbgl/geometry/line_atlas.cpp
+++ b/src/mbgl/geometry/line_atlas.cpp
@@ -126,20 +126,20 @@ Size LineAtlas::getSize() const {
return image.size;
}
-void LineAtlas::upload(gfx::Context& context, uint8_t unit) {
+void LineAtlas::upload(gfx::Context& context) {
if (!texture) {
- texture = context.createTexture(image, unit);
+ texture = context.createTexture(image);
} else if (dirty) {
- context.updateTexture(*texture, image, unit);
+ context.updateTexture(*texture, image);
}
dirty = false;
}
-void LineAtlas::bind(gfx::Context& context, uint8_t unit) {
- upload(context, unit);
- context.bindTexture(*texture, unit, gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No,
- gfx::TextureWrapType::Repeat, gfx::TextureWrapType::Clamp);
+gfx::TextureBinding LineAtlas::textureBinding(gfx::Context& context) {
+ upload(context);
+ return { *texture->resource, gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No,
+ gfx::TextureWrapType::Repeat, gfx::TextureWrapType::Clamp };
}
} // namespace mbgl
diff --git a/src/mbgl/geometry/line_atlas.hpp b/src/mbgl/geometry/line_atlas.hpp
index 96072c700c..3a238f8507 100644
--- a/src/mbgl/geometry/line_atlas.hpp
+++ b/src/mbgl/geometry/line_atlas.hpp
@@ -32,11 +32,11 @@ public:
~LineAtlas();
// Binds the atlas texture to the GPU, and uploads data if it is out of date.
- void bind(gfx::Context&, uint8_t unit);
+ gfx::TextureBinding textureBinding(gfx::Context&);
// 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&, uint8_t unit);
+ void upload(gfx::Context&);
LinePatternPos getDashPosition(const std::vector<float>&, LinePatternCap);
LinePatternPos addDash(const std::vector<float>& dasharray, LinePatternCap);