summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/program.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-07-06 08:06:12 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-07-12 14:48:22 -0700
commit358b0305ae1f52b477ae145bcca4b7af242dd5c3 (patch)
treef5b1315e650079fce12130611896836e1c8cfa98 /src/mbgl/programs/program.hpp
parentc61041b44cd9181641db2351f4657cc356300226 (diff)
downloadqtlocation-mapboxgl-358b0305ae1f52b477ae145bcca4b7af242dd5c3.tar.gz
[core] Per-segment-per-layer vertex arrays
Reduces rebinding, matches gl-js, and works around the buggy VAO implementation on PowerVR SGX544 GPUs.
Diffstat (limited to 'src/mbgl/programs/program.hpp')
-rw-r--r--src/mbgl/programs/program.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index 0199752b06..71d7569f53 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -58,7 +58,8 @@ public:
const SegmentVector<Attributes>& segments,
const PaintPropertyBinders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
- float currentZoom) {
+ float currentZoom,
+ const std::string& layerID) {
typename AllUniforms::Values allUniformValues = uniformValues
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties));
@@ -66,8 +67,10 @@ public:
.concat(paintPropertyBinders.attributeBindings(currentProperties));
for (auto& segment : segments) {
- if (!segment.vertexArray) {
- segment.vertexArray = context.createVertexArray();
+ optional<gl::VertexArray>& vertexArray = segment.vertexArrays[layerID];
+
+ if (!vertexArray) {
+ vertexArray = context.createVertexArray();
}
program.draw(
@@ -77,7 +80,7 @@ public:
std::move(stencilMode),
std::move(colorMode),
allUniformValues,
- *segment.vertexArray,
+ *vertexArray,
Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset),
indexBuffer,
segment.indexOffset,