summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-06-13 16:04:13 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-07-17 09:19:02 -0700
commitccb525553786e11fbb76af2caf931ba539713761 (patch)
treec83c2bb3b8e612f082c86ad79ba056412d7612b8
parent76caec25c73ef3ddbf2d1673ecfe2c4d9e4f1b45 (diff)
downloadqtlocation-mapboxgl-ccb525553786e11fbb76af2caf931ba539713761.tar.gz
[core] Don't use "current" icon/text-size when binding
The current value is not passed to `SymbolSizeBinder::uniformValues`, so we shouldn't check `currentValue.isConstant()` in `SymbolSizeBinder::attributeBindings`. If it were true, then we might end up using attribute bindings that are appropriate only for a constant property, but uniform bindings that are appropriate only for a source or composite function. Instead, just wait for a new bucket to be generated. This will happen automatically, since icon/text-size are layout properties.
-rw-r--r--src/mbgl/programs/symbol_program.hpp21
-rw-r--r--src/mbgl/renderer/painter_symbol.cpp1
2 files changed, 5 insertions, 17 deletions
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index 01e95f456d..abcba1d033 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -107,7 +107,7 @@ public:
const style::DataDrivenPropertyValue<float>& sizeProperty,
const float defaultValue);
- virtual SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const = 0;
+ virtual SymbolSizeAttributes::Bindings attributeBindings() const = 0;
virtual void populateVertexVector(const GeometryTileFeature& feature) = 0;
virtual UniformValues uniformValues(float currentZoom) const = 0;
virtual void upload(gl::Context&) = 0;
@@ -133,8 +133,6 @@ Range<float> getCoveringStops(Stops s, float lowerZoom, float upperZoom) {
class ConstantSymbolSizeBinder final : public SymbolSizeBinder {
public:
- using PropertyValue = variant<float, style::CameraFunction<float>>;
-
ConstantSymbolSizeBinder(const float /*tileZoom*/, const float& size, const float /*defaultValue*/)
: layoutSize(size) {}
@@ -157,7 +155,7 @@ public:
);
}
- SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float>) const override {
+ SymbolSizeAttributes::Bindings attributeBindings() const override {
return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} };
}
void upload(gl::Context&) override {}
@@ -211,11 +209,7 @@ public:
defaultValue(defaultValue_) {
}
- SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const override {
- if (currentValue.isConstant()) {
- return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} };
- }
-
+ SymbolSizeAttributes::Bindings attributeBindings() const override {
return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::variableBinding(*buffer, 0, 1) };
}
@@ -268,11 +262,7 @@ public:
return getCoveringStops(stops, tileZoom, tileZoom + 1); }))
{}
- SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue<float> currentValue) const override {
- if (currentValue.isConstant()) {
- return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::ConstantBinding {{{0, 0, 0}}} };
- }
-
+ SymbolSizeAttributes::Bindings attributeBindings() const override {
return SymbolSizeAttributes::Bindings { SymbolSizeAttributes::Attribute::variableBinding(*buffer, 0) };
}
@@ -364,7 +354,6 @@ public:
UniformValues&& uniformValues,
const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
const SymbolSizeBinder& symbolSizeBinder,
- const PossiblyEvaluatedPropertyValue<float>& currentSizeValue,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const gl::SegmentVector<Attributes>& segments,
const PaintPropertyBinders& paintPropertyBinders,
@@ -380,7 +369,7 @@ public:
.concat(symbolSizeBinder.uniformValues(currentZoom))
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)),
LayoutAttributes::allVariableBindings(layoutVertexBuffer)
- .concat(symbolSizeBinder.attributeBindings(currentSizeValue))
+ .concat(symbolSizeBinder.attributeBindings())
.concat(paintPropertyBinders.attributeBindings(currentProperties)),
indexBuffer,
segments
diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp
index 86b2146b9f..c9ed8cc570 100644
--- a/src/mbgl/renderer/painter_symbol.cpp
+++ b/src/mbgl/renderer/painter_symbol.cpp
@@ -54,7 +54,6 @@ void Painter::renderSymbol(PaintParameters& parameters,
std::move(uniformValues),
*buffers.vertexBuffer,
*symbolSizeBinder,
- values_.layoutSize,
*buffers.indexBuffer,
buffers.segments,
binders,