Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

render static images - #1272

Merged
kkaefer merged 7 commits into
masterfrom
1272-render-still-images-on-thread
Apr 17, 2015
Merged

kkaefer merged 7 commits into
masterfrom
1272-render-still-images-on-thread

Conversation

@kkaefer

@kkaefer kkaefer commented Apr 16, 2015

Copy link
Copy Markdown
Member

Pull work and ideas from the static-render branch into master so we can render static images for node-mapbox-gl-native.

/cc @kkaefer

@kkaefer
kkaefer force-pushed the 1272-render-still-images-on-thread branch from 1c62246 to 6ccbd35 Compare April 16, 2015 09:11
@mikemorris
mikemorris force-pushed the 1272-render-still-images-on-thread branch from 6ccbd35 to 728001d Compare April 16, 2015 11:09
mikemorris added a commit to cutting-room-floor/node-mapbox-gl-native that referenced this pull request Apr 16, 2015
@mikemorris

Copy link
Copy Markdown
Contributor Author

Seeing uncaught exceptions in style parsing that seem to be happening asynchronously and as such are not being caught as expected. The following crash pops up during map.render even though I would have expected to catch it earlier in map.load.

try {
    nodeMap->map.setStyleJSON(style, ".");
} catch (const std::exception &ex) {
    return NanThrowError(ex.what());
}
# returns an image
libc++abi.dylib: terminating with uncaught exception of type mbgl::error::style_parse
Process 80171 stopped
* thread #10: tid = 0x1456d9, 0x00007fff8c34a286 libsystem_kernel.dylib`__pthread_kill + 10, name = 'Map', stop reason = signal SIGABRT
    frame #0: 0x00007fff8c34a286 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff8c34a286 <+10>: jae    0x7fff8c34a290            ; <+20>
    0x7fff8c34a288 <+12>: movq   %rax, %rdi
    0x7fff8c34a28b <+15>: jmp    0x7fff8c345c53            ; cerror_nocancel
    0x7fff8c34a290 <+20>: retq
(lldb) bt
* thread #10: tid = 0x1456d9, 0x00007fff8c34a286 libsystem_kernel.dylib`__pthread_kill + 10, name = 'Map', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8c34a286 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff8e0ab42f libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x00007fff8c5a6b53 libsystem_c.dylib`abort + 129
    frame #3: 0x00007fff91202a21 libc++abi.dylib`abort_message + 257
    frame #4: 0x00007fff9122a9d1 libc++abi.dylib`default_terminate_handler() + 267
    frame #5: 0x00007fff8db337eb libobjc.A.dylib`_objc_terminate() + 124
    frame #6: 0x00007fff912280a1 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #7: 0x00007fff91227b30 libc++abi.dylib`__cxa_throw + 121
    frame #8: 0x000000010313f8b5 mapbox-gl-native.node`mbgl::Style::loadJSON(this=<unavailable>, data=<unavailable>) + 229 at style.cpp:78
    frame #9: 0x00000001030fd02d mapbox-gl-native.node`mbgl::Map::loadStyleJSON(this=0x00000001010088c0, json=<unavailable>, base=<unavailable>) + 221 at map.cpp:765
    frame #10: 0x00000001030fce3d mapbox-gl-native.node`mbgl::Map::reloadStyle(this=<unavailable>) + 525 at map.cpp:755
    frame #11: 0x00000001030f9d0a mapbox-gl-native.node`mbgl::Map::prepare(this=0x00000001010088c0) + 154 at map.cpp:798
    frame #12: 0x00000001030f97c4 mapbox-gl-native.node`mbgl::Map::run(this=0x00000001010088c0) + 292 at map.cpp:282
    frame #13: 0x00000001030fe9cf mapbox-gl-native.node`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5> >(void*) [inlined] mbgl::Map::start(bool, mbgl::Map::Mode)::$_5::operator()() const + 20 at map.cpp:182
    frame #14: 0x00000001030fe9bb mapbox-gl-native.node`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5> >(void*) [inlined] decltype(std::__1::forward<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5>(fp)(std::__1::forward<>(fp0))) std::__1::__invoke<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5>(mbgl::Map::start(bool, mbgl::Map::Mode)::$_5&&) at __functional_base:413
    frame #15: 0x00000001030fe9bb mapbox-gl-native.node`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5> >(void*) [inlined] void std::__1::__thread_execute<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5>(std::__1::tuple<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5>&, std::__1::__tuple_indices<>) at thread:332
    frame #16: 0x00000001030fe9bb mapbox-gl-native.node`void* std::__1::__thread_proxy<std::__1::tuple<mbgl::Map::start(bool, mbgl::Map::Mode)::$_5> >(__vp=0x0000000100c23290) + 91 at thread:342
    frame #17: 0x00007fff8e0a9268 libsystem_pthread.dylib`_pthread_body + 131
    frame #18: 0x00007fff8e0a91e5 libsystem_pthread.dylib`_pthread_start + 176
    frame #19: 0x00007fff8e0a741d libsystem_pthread.dylib`thread_start + 13

kkaefer referenced this pull request Apr 16, 2015
This brings the easing transition code a bit closer to how easings work
in gl-js. Instead of having an array of individual transitions for scale,
rotate, and pan, there is a single transition function that does all the
required calculations. This permits us to:

* Eliminate the "timeout" transition. (Fixes #126)
* Replace start/stopPanning() et al with setGestureInProgress(). Apps or
  SDKs are expected to make paired calls to setGestureInProgress(). This
  state will be ORed with the active easing state to determine when to
  use texture interpolation. (Fixes #79)
* Run style recalculations only when an ease transition that affects the
  zoom is in progress. (Fixes #1155)
@kkaefer

kkaefer commented Apr 16, 2015

Copy link
Copy Markdown
Member

We still need to rework the interface to fix #1273 so that whenever we trigger a static image render, all of the options are set atomically so that we know the size of the view before we are loading data to render the tile.

kkaefer added 6 commits April 17, 2015 13:40
- static rendering now also runs in a separate thread; you have to start it with map.start(Map::Mode::Static) and join the thread with map.stop() before destructing the Map object
- map.renderStill() takes a callback with will be invoked on the *map* thread, so you'll have to figure out your own method of dispatching back to the main thread.
- this is only a stopgap; we need to properly pass state between threads
- doesn't fix changing the pixel ratio
@kkaefer
kkaefer force-pushed the 1272-render-still-images-on-thread branch from ddfd988 to 60a0e8a Compare April 17, 2015 11:41
kkaefer added a commit that referenced this pull request Apr 17, 2015
Render still/static images on a separate thread as well, aligning it with the way continuous render mode works
@kkaefer
kkaefer merged commit 7827d49 into master Apr 17, 2015
@kkaefer
kkaefer deleted the 1272-render-still-images-on-thread branch April 17, 2015 13:43
mikemorris added a commit to cutting-room-floor/node-mapbox-gl-native that referenced this pull request Apr 17, 2015
mikemorris added a commit to cutting-room-floor/node-mapbox-gl-native that referenced this pull request Apr 17, 2015
mapbox/mapbox-gl-native#1272

Some tests are hanging with no errors or log messages
when map.load is passed a style but never rendered.
@kkaefer kkaefer mentioned this pull request Apr 20, 2015
5 of 8 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants