From 6408e40a60be97555fe98a430f1ae81bd128f4f3 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Wed, 13 Aug 2014 16:04:10 -0400 Subject: revert https://github.com/mapbox/mapbox-gl-native/commit/992815cc3da3a440dbc56c61925a4e5443b58073 --- include/mbgl/util/uv_detail.hpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index c65c247ba1..b3fdbb3719 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -31,18 +31,13 @@ private: class loop { public: - inline loop() { - if (uv_loop_init(&l) != 0) { - throw std::runtime_error("failed to initialize loop"); - } - } - - inline ~loop() { uv_loop_close(&l); } + inline loop() : l(uv_loop_new()) {} + inline ~loop() { uv_loop_delete(l); } - inline uv_loop_t *operator*() { return &l; } + inline uv_loop_t *operator*() { return l; } private: - uv_loop_t l; + uv_loop_t *l; }; class mutex { -- cgit v1.2.1 From 3466f364121b3a0a157ce62c417c94802484351a Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Wed, 20 Aug 2014 19:43:29 -0400 Subject: bump mapnik-packaging, conform to libuv 0.10 api --- include/mbgl/map/map.hpp | 8 ++++---- include/mbgl/platform/request.hpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index fba38879ed..4c5952a2c1 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -129,10 +129,10 @@ public: private: // uv async callbacks - static void render(uv_async_t *async); - static void terminate(uv_async_t *async); - static void cleanup(uv_async_t *async); - static void delete_async(uv_handle_t *handle); + static void render(uv_async_t *async, int status); + static void terminate(uv_async_t *async, int status); + static void cleanup(uv_async_t *async, int status); + static void delete_async(uv_handle_t *handle, int status); // Setup void setup(); diff --git a/include/mbgl/platform/request.hpp b/include/mbgl/platform/request.hpp index 0cbacf645d..2a231769c1 100644 --- a/include/mbgl/platform/request.hpp +++ b/include/mbgl/platform/request.hpp @@ -24,7 +24,7 @@ public: void complete(); private: - static void complete(uv_async_t *async); + static void complete(uv_async_t *async, int status); public: const std::string url; -- cgit v1.2.1 From c004c036964e9012b08aa4a2f8b16094630d62be Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Tue, 24 Jun 2014 00:25:20 +1000 Subject: Add View::make_inactive() to remove context from rendering thread View::make_inactive() is called just before termination of the rendering thread. The implementation must clear the thread's GL context. This ensures there is no context still bound to a thread during GL shutdown. This is needed as GL will not actually delete a context until it is not active on any thread. Fixes mapbox/mapbox-gl-native#340 Conflicts: common/glfw_view.hpp include/llmr/map/view.hpp test/headless.cpp --- include/mbgl/map/view.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index 92d60d4d02..3e2f1a4b5a 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -35,6 +35,10 @@ public: // renderer setup since the render thread doesn't switch the contexts. virtual void make_active() = 0; + // Called from the render thread. Makes the GL context inactive in the current + // thread. This is called once just before the rendering thread terminates. + virtual void make_inactive() = 0; + // Returns the base framebuffer object, if any, and 0 if using the system // provided framebuffer. virtual unsigned int root_fbo() { -- cgit v1.2.1 From 71549e7b93b6b44ed38e8915d8735c136889c3f1 Mon Sep 17 00:00:00 2001 From: Leith Bade Date: Tue, 24 Jun 2014 00:41:28 +1000 Subject: Adds the function Map::terminate() to allow all GL resources held by the map to be released immediately. Map::terminate() will call any GL functions on the current thread without blocking or defering to the rendering thread. This function allows a GL context to be destroyed and recreated safely without having to delete the Map object. Fixes mapbox/mapbox-gl-native#341 Conflicts: include/llmr/renderer/painter.hpp test/headless.cpp --- include/mbgl/map/map.hpp | 3 +++ include/mbgl/renderer/painter.hpp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index fba38879ed..0d2926d04b 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -53,6 +53,9 @@ public: // Triggers a cleanup that releases resources. void cleanup(); + // Releases resources immediately + void terminate(); + // Controls buffer swapping. bool needsSwap(); void swapped(); diff --git a/include/mbgl/renderer/painter.hpp b/include/mbgl/renderer/painter.hpp index 75529d1136..15331b9b67 100644 --- a/include/mbgl/renderer/painter.hpp +++ b/include/mbgl/renderer/painter.hpp @@ -63,6 +63,7 @@ public: // lazy initialization) in case rendering continues. void cleanup(); + void terminate(); // Renders the backdrop of the OpenGL view. This also paints in areas where we don't have any // tiles whatsoever. @@ -123,6 +124,7 @@ public: private: void setupShaders(); + void deleteShaders(); mat4 translatedMatrix(const mat4& matrix, const std::array &translation, const Tile::ID &id, TranslateAnchorType anchor); void prepareTile(const Tile& tile); -- cgit v1.2.1 From 91f40daa6911f57f3dca534080241b46844c71b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 8 Oct 2014 15:27:33 +0200 Subject: don't do concurrent access to a static member variable in situations where the renderer is used from multiple threads, this causes memory corruption. fixes mapbox/node-mapbox-gl-native#7 --- include/mbgl/style/class_dictionary.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/mbgl/style/class_dictionary.hpp b/include/mbgl/style/class_dictionary.hpp index c7f9c6a284..ecf80be3e3 100644 --- a/include/mbgl/style/class_dictionary.hpp +++ b/include/mbgl/style/class_dictionary.hpp @@ -14,17 +14,22 @@ enum class ClassID : uint32_t { }; class ClassDictionary { +private: + ClassDictionary(); + public: + static ClassDictionary &Get(); + // Returns an ID for a class name. If the class name does not yet have an ID, one is // auto-generated and stored for future reference. - static ClassID Lookup(const std::string &class_name); + ClassID lookup(const std::string &class_name); // Returns either Fallback, Default or Named, depending on the type of the class id. - static ClassID Normalize(ClassID id); + ClassID normalize(ClassID id); private: - static std::unordered_map store; - static uint32_t offset; + std::unordered_map store = { { "", ClassID::Default } }; + uint32_t offset = 0; }; } -- cgit v1.2.1 From 97986f603f5af6b12deb4cdb4e91cd5035457c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Thu, 16 Oct 2014 04:27:30 -0700 Subject: we don't need a root_fbo function anymore [skip ci] --- include/mbgl/map/view.hpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index 395a05d435..b567cd424f 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -39,12 +39,6 @@ public: // thread. This is called once just before the rendering thread terminates. virtual void make_inactive() = 0; - // Returns the base framebuffer object, if any, and 0 if using the system - // provided framebuffer. - virtual unsigned int root_fbo() { - return 0; - } - virtual void notify() = 0; // Notifies a watcher of map x/y/scale/rotation changes. -- cgit v1.2.1