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-09-14 15:26:45 +0300
commit1c53dc9ca8d90111c215643322114de2e7040e9c (patch)
treeda4a5066b61261bc71e9da2f4fe057e01faf996e
parentb9ef805ae03dc4fafde7ad74132cfb7d190401aa (diff)
downloadqtlocation-mapboxgl-1c53dc9ca8d90111c215643322114de2e7040e9c.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.cpp35
-rw-r--r--src/mbgl/gl/context.hpp7
2 files changed, 18 insertions, 24 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 22b22b549d..1909504525 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -124,10 +124,24 @@ 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
+ && !disableVAOExtension) {
+ vertexArray = std::make_unique<extension::VertexArray>(fn);
}
+
#if MBGL_HAS_BINARY_PROGRAMS
programBinary = std::make_unique<extension::ProgramBinary>(fn);
#endif
@@ -286,22 +300,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;
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index f8cb546585..bd682f44da 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -305,13 +305,8 @@ private:
std::vector<RenderbufferID> abandonedRenderbuffers;
public:
- // For testing and Windows because Qt + ANGLE
- // crashes with VAO enabled.
-#if defined(_WINDOWS)
- bool disableVAOExtension = true;
-#else
+ // For testing
bool disableVAOExtension = false;
-#endif
};
} // namespace gl