diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp index f1d3c8d0f..b42a1a381 100644 --- a/android/cpp/native_map_view.cpp +++ b/android/cpp/native_map_view.cpp @@ -23,7 +23,12 @@ void log_egl_string(EGLDisplay display, EGLint name, const char* label) { if (str == nullptr) { mbgl::Log::Error(mbgl::Event::OpenGL, "eglQueryString(%d) returned error %d", name, eglGetError()); } else { - mbgl::Log::Info(mbgl::Event::OpenGL, "EGL %s: %s", label, str); + char buf[513]; + for (int len = std::strlen(str), pos = 0; len > 0; len -= 512, pos += 512) { + strncpy(buf, str + pos, 512); + buf[512] = 0; + mbgl::Log::Info(mbgl::Event::OpenGL, "EGL %s: %s", label, buf); + } } } @@ -32,7 +37,12 @@ void log_gl_string(GLenum name, const char* label) { if (str == nullptr) { mbgl::Log::Error(mbgl::Event::OpenGL, "glGetString(%d) returned error %d", name, glGetError()); } else { - mbgl::Log::Info(mbgl::Event::OpenGL, "GL %s: %s", label, str); + char buf[513]; + for (int len = std::strlen(reinterpret_cast(str)), pos = 0; len > 0; len -= 512, pos += 512) { + strncpy(buf, reinterpret_cast(str) + pos, 512); + buf[512] = 0; + mbgl::Log::Info(mbgl::Event::OpenGL, "GL %s: %s", label, buf); + } } } @@ -352,7 +362,7 @@ typedef enum { // Tuple is typedef std::tuple ConfigProperties; -EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_configs) const { +EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_configs) { mbgl::Log::Info(mbgl::Event::OpenGL, "Found %d configs", num_configs); // Create a list of configs that pass our filters @@ -475,6 +485,7 @@ EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_conf // Sort the configs to find the best one config_list.sort(); + using_depth24 = std::get<1>(config_list.front()) == 24; bool is_conformant = !std::get<2>(config_list.front()); bool is_caveat = std::get<3>(config_list.front()); int config_num = std::get<4>(config_list.front()); @@ -541,7 +552,11 @@ void NativeMapView::loadExtensions() { if (extensions.find("GL_OES_depth24") != std::string::npos) { mbgl::Log::Info(mbgl::Event::OpenGL, "Using GL_OES_depth24."); - gl::is_depth24_supported = true; + if (!using_depth24) { + gl::is_depth24_supported = true; + } else { + mbgl::Log::Debug(mbgl::Event::OpenGL, "Preferring 16 bit depth."); + } } } diff --git a/include/mbgl/android/native_map_view.hpp b/include/mbgl/android/native_map_view.hpp index 059847c24..8f37fe947 100644 --- a/include/mbgl/android/native_map_view.hpp +++ b/include/mbgl/android/native_map_view.hpp @@ -60,7 +60,7 @@ public: void notifyMapChange(); private: - EGLConfig chooseConfig(const EGLConfig configs[], EGLint num_configs) const; + EGLConfig chooseConfig(const EGLConfig configs[], EGLint num_configs); void loadExtensions(); @@ -84,6 +84,8 @@ private: std::string api_key; bool first_time = false; + + bool using_depth24 = false; }; }