summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2018-08-28 14:03:38 +0300
committerAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2018-08-30 12:17:49 +0300
commita22f1f34097b7c5335362b3faf98c1c8391d6d4e (patch)
tree69b57060c55f8a6603c1ec932d99e95a1fd357da
parent8c58842839e3e17f1d75a1eadd6443628824ed1c (diff)
downloadqtlocation-mapboxgl-a22f1f34097b7c5335362b3faf98c1c8391d6d4e.tar.gz
[core] Refactor vertex array object extension initialization
Currently the vertex object extension is disabled through an ifdef for the Windows platform due to an issue with ANGLE, while there is a blacklist for other platforms. Unify those by adding ANGLE to that blacklist and some small refactoring.
-rw-r--r--src/mbgl/gl/context.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 4afbe5af1e..0b40cef613 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -124,10 +124,23 @@ void Context::initializeExtensions(const std::function<gl::ProcAddress(const cha
return nullptr;
};
+ const std::string renderer = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_RENDERER)));
+ Log::Info(Event::General, "GPU Identifier: %s", renderer.c_str());
+
debugging = std::make_unique<extension::Debugging>(fn);
- if (!disableVAOExtension) {
- vertexArray = std::make_unique<extension::VertexArray>(fn);
+
+ // Block Adreno 2xx, 3xx as it crashes on glBuffer(Sub)Data
+ // Block ARM Mali-T720 (in some MT8163 chipsets) as it crashes on glBindVertexArray
+ // Block ANGLE on Direct3D as the combination of Qt + Windows + ANGLE leads to crashes
+ if (renderer.find("Adreno (TM) 2") == std::string::npos
+ && renderer.find("Adreno (TM) 3") == std::string::npos
+ && (renderer.find("ANGLE") == std::string::npos
+ || renderer.find("Direct3D") == std::string::npos)
+ && renderer.find("Mali-T720") == std::string::npos
+ && renderer.find("Sapphire 650") == std::string::npos) {
+ vertexArray = std::make_unique<extension::VertexArray>(fn);
}
+
#if MBGL_HAS_BINARY_PROGRAMS
programBinary = std::make_unique<extension::ProgramBinary>(fn);
#endif
@@ -286,22 +299,7 @@ UniqueTexture Context::createTexture() {
}
bool Context::supportsVertexArrays() const {
- static bool blacklisted = []() {
- const std::string renderer = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_RENDERER)));
-
- Log::Info(Event::General, "GPU Identifier: %s", renderer.c_str());
-
- // Blacklist Adreno 2xx, 3xx as it crashes on glBuffer(Sub)Data
- // Blacklist ARM Mali-T720 (in some MT8163 chipsets) as it crashes on glBindVertexArray
- return renderer.find("Adreno (TM) 2") != std::string::npos
- || renderer.find("Adreno (TM) 3") != std::string::npos
- || renderer.find("Mali-T720") != std::string::npos
- || renderer.find("Sapphire 650") != std::string::npos;
-
- }();
-
- return !blacklisted &&
- vertexArray &&
+ return vertexArray &&
vertexArray->genVertexArrays &&
vertexArray->bindVertexArray &&
vertexArray->deleteVertexArrays;