summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.cpp
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2018-05-17 11:47:31 -0400
commit30376f3ce1d17522d9e64901b1bbc52906ee5267 (patch)
tree1f00d04a223a76a86e16ddebc77f56d2cff88b5b /src/mbgl/gl/attribute.cpp
parent7d1e52a3255d4eecdcd37e4fb600eb76fa9333f8 (diff)
parent146057adf90e85e3edc80446f02d20e5f6cab378 (diff)
downloadqtlocation-mapboxgl-upstream/fabian-merge-release-4.0.1-master.tar.gz
Merge branch 'release-boba' into masterupstream/fabian-merge-release-4.0.1-master
# Conflicts: # mapbox-gl-js # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/gradle/dependencies.gradle # platform/darwin/src/MGLVectorTileSource.mm # platform/darwin/src/MGLVectorTileSource_Private.h # platform/ios/CHANGELOG.md # src/mbgl/style/expression/compound_expression.cpp
Diffstat (limited to 'src/mbgl/gl/attribute.cpp')
-rw-r--r--src/mbgl/gl/attribute.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mbgl/gl/attribute.cpp b/src/mbgl/gl/attribute.cpp
index bb5b2ddc34..b2d05fe665 100644
--- a/src/mbgl/gl/attribute.cpp
+++ b/src/mbgl/gl/attribute.cpp
@@ -1,14 +1,20 @@
#include <mbgl/gl/attribute.hpp>
+#include <mbgl/gl/context.hpp>
#include <mbgl/gl/gl.hpp>
namespace mbgl {
namespace gl {
-void bindAttributeLocation(ProgramID id, AttributeLocation location, const char* name) {
- if (location >= MAX_ATTRIBUTES) {
- throw gl::Error("too many vertex attributes");
+void bindAttributeLocation(Context& context, ProgramID id, AttributeLocation location, const char* name) {
+ // We're using sequentially numberered attribute locations starting with 0. Therefore we can use
+ // the location as a proxy for the number of attributes.
+ if (location >= context.maximumVertexBindingCount) {
+ // Don't bind the location on this hardware since it exceeds the limit (otherwise we'd get
+ // an OpenGL error). This means we'll see rendering errors, and possibly slow rendering due
+ // to unbound attributes.
+ } else {
+ MBGL_CHECK_ERROR(glBindAttribLocation(id, location, name));
}
- MBGL_CHECK_ERROR(glBindAttribLocation(id, location, name));
}
std::set<std::string> getActiveAttributes(ProgramID id) {