diff options
author | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2018-09-20 09:40:18 +0300 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2018-09-21 09:45:35 +0300 |
commit | f49a9ca1de70c8249738ca42ab1c8c86fecf1623 (patch) | |
tree | 2b2050b8debf8ab84e8448806f5eeffa1cf6030b | |
parent | 737ebed7d5997872e8c1419cc6bfbb10ae6242d2 (diff) | |
download | qtlocation-mapboxgl-f49a9ca1de70c8249738ca42ab1c8c86fecf1623.tar.gz |
[core] Don't log GL renderer string on every context initialization
Commit 1c53dc9ca8d9 ([core] Refactor vertex array object extension
initialization) changed where the GL renderer string is checked in order
to prevent the vertex array extension initialization in certain
platforms and in doing so made the logging of that string more frequent,
once per context initialization instead of at most once per process.
This is a lot more verbose, specially when running unit tests, so make
sure that string is logged at most once as it was previously.
-rw-r--r-- | src/mbgl/gl/context.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index cf7b80741f..18ab38e684 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -124,8 +124,11 @@ 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()); + static const std::string renderer = []() { + std::string r = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_RENDERER))); + Log::Info(Event::General, "GPU Identifier: %s", r.c_str()); + return r; + }(); // Block ANGLE on Direct3D since the debugging extension is causing crashes if (!(renderer.find("ANGLE") != std::string::npos |