diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-13 16:45:12 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-14 11:14:05 -0700 |
commit | f3bb99f9195c28cff5bb9029c752871a21e96f12 (patch) | |
tree | e758995b092be40c67fc387e10f8a73da8df8257 /src/mbgl/renderer | |
parent | 7a3f7980b056754b336ac22c43fb6289fa64d4e1 (diff) | |
download | qtlocation-mapboxgl-f3bb99f9195c28cff5bb9029c752871a21e96f12.tar.gz |
[core] Eliminate constant attribute bindings
Rather than binding constant attributes that will never be used, just disable the attribute.
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r-- | src/mbgl/renderer/paint_property_binder.hpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 91ddcac2b3..c22291767a 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -103,11 +103,8 @@ public: void populateVertexVector(const GeometryTileFeature&, std::size_t) override {} void upload(gl::Context&) override {} - AttributeBinding attributeBinding(const PossiblyEvaluatedPropertyValue<T>& currentValue) const override { - auto value = attributeValue(currentValue.constantOr(constant)); - return typename Attribute::ConstantBinding { - zoomInterpolatedAttributeValue(value, value) - }; + AttributeBinding attributeBinding(const PossiblyEvaluatedPropertyValue<T>&) const override { + return gl::DisabledAttribute(); } float interpolationFactor(float) const override { @@ -152,12 +149,9 @@ public: AttributeBinding attributeBinding(const PossiblyEvaluatedPropertyValue<T>& currentValue) const override { if (currentValue.isConstant()) { - BaseAttributeValue value = attributeValue(*currentValue.constant()); - return typename Attribute::ConstantBinding { - zoomInterpolatedAttributeValue(value, value) - }; + return gl::DisabledAttribute(); } else { - return Attribute::variableBinding(*vertexBuffer, 0, BaseAttribute::Dimensions); + return Attribute::binding(*vertexBuffer, 0, BaseAttribute::Dimensions); } } @@ -216,12 +210,9 @@ public: AttributeBinding attributeBinding(const PossiblyEvaluatedPropertyValue<T>& currentValue) const override { if (currentValue.isConstant()) { - BaseAttributeValue value = attributeValue(*currentValue.constant()); - return typename Attribute::ConstantBinding { - zoomInterpolatedAttributeValue(value, value) - }; + return gl::DisabledAttribute(); } else { - return Attribute::variableBinding(*vertexBuffer, 0); + return Attribute::binding(*vertexBuffer, 0); } } |