From ccb525553786e11fbb76af2caf931ba539713761 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 13 Jun 2017 16:04:13 -0700 Subject: [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. --- src/mbgl/programs/symbol_program.hpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src/mbgl/programs') 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& sizeProperty, const float defaultValue); - virtual SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue 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 getCoveringStops(Stops s, float lowerZoom, float upperZoom) { class ConstantSymbolSizeBinder final : public SymbolSizeBinder { public: - using PropertyValue = variant>; - ConstantSymbolSizeBinder(const float /*tileZoom*/, const float& size, const float /*defaultValue*/) : layoutSize(size) {} @@ -157,7 +155,7 @@ public: ); } - SymbolSizeAttributes::Bindings attributeBindings(const PossiblyEvaluatedPropertyValue) 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 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 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& layoutVertexBuffer, const SymbolSizeBinder& symbolSizeBinder, - const PossiblyEvaluatedPropertyValue& currentSizeValue, const gl::IndexBuffer& indexBuffer, const gl::SegmentVector& 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 -- cgit v1.2.1