-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
@jfirebaugh Given your notes in #8820 I've started implementing a renderer abstraction and proxy/bridge interface for the SDK to implement so we can do either synchronous or asynchronous rendering. As I understood your notes, we want something like: Besides quite some details to work out I'm running into a issue with the sdk binding part you might have already thought about: The proxy/bridge ideally doesn't know about the data passed to the renderer as it contains references to non-public headers (like the TransformState). I can find no way to pass it along with unique_ptrs though, without having the definition been known at the point where I move the data. |
Current call chain for continuous rendering is:
With the introduction of
This will make a clean division:
For neatness and parallelism, we could rename them |
d2ffd35
to
8247901
Compare
@jfirebaugh I made some progress with reducing the number of moving parts. Leaving some notes here.
related: Cutting the ownership between
When we use the renderer on a separate thread, we are going to have to assure that the destruction of the Renderer/RenderBridge still completes before destructing the map.
|
I think instead we should have per-SDK implementations of
It's not that much duplication, and some SDKs probably don't even need it. E.g.
Yes, good idea.
Does this go away if ownership of |
src/mbgl/map/map.cpp
Outdated
impl->renderStyle->setSourceTileCacheSize(size); | ||
impl->backend.invalidate(); | ||
} | ||
impl->backend.setRendererState([=](Renderer* renderer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix #8039 now so that we don't need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll start on that first.
src/mbgl/map/map.cpp
Outdated
impl->renderStyle->onLowMemory(); | ||
impl->backend.invalidate(); | ||
} | ||
impl->backend.setRendererState([](Renderer* renderer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have an explicit pass-through in RenderBridge
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/mbgl/map/map.cpp
Outdated
if (impl->renderStyle) { | ||
impl->renderStyle->dumpDebugLogs(); | ||
} | ||
impl->backend.setRendererState([](Renderer* renderer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this. And then remove setRendererState
.
Makes sense if coallescing is indeed a platform issue. I'll try it out on a couple of platforms. I know that Android also just sets a flag that isn't used until the next draw call.
That would help a lot. I used a reference initially as moving ownership limits the use of the RenderBridge as a part of the platform View bindings by inheritance ( |
dcfe906
to
121be92
Compare
@jfirebaugh I'm finishing up with the platform changes. Besides a bug specific to egl on linux, they seem to work well. Could you give it a quick check if it's moving in the right direction? Major parts still on my todo list:
For reference the bug with egl/linux
|
54ee072
to
bb7acf8
Compare
@jfirebaugh Noting additional changes from our conversation on chat:
Plus the outstanding work for completeness:
|
8d4f3bb
to
f7a9a9e
Compare
@kkaefer Noticed that animations are choppier in this branch than on master. Seems like fewer frames are rendered than before. |
58991ee
to
ce3538d
Compare
@frederoni It seems there is a slight difference between macOS and iOS when calling [nativeView setNeedsDisplay]. On macOS, when doing this while renderSync is in progress, it is not queued behind the current redraw, whereas it is on iOS. To make sure that animations work properly on both platforms I had to make sure it works with an I kept a single @kkaefer A similar problem existed on glfw where the dirty flag was cleared too late so another iteration could not be triggered from anination frame callbacks. I addressed this in f290c6d |
- Guards against duplicate activations by checking wether the backend of the prior scope is the same as the current ones - Makes sure that only the most outer backend scope deactivates by tracking activation state
ce3538d
to
7089d6b
Compare
Introduces a
Renderer
interface with a matchingRendererFrontend
interface to decouple the map from the actual rendering. This makes it possible to have different threading strategies per platform.