Add workaround for android emulator as crash on Android emulation is still presented (#3310)
This commit is contained in:
@@ -67,6 +67,7 @@ private:
|
||||
/// Remove all the drawables for tiles
|
||||
/// @return The number of drawables actually removed.
|
||||
std::size_t removeAllDrawables() override;
|
||||
|
||||
#endif
|
||||
|
||||
// Paint properties
|
||||
|
||||
@@ -98,6 +98,10 @@ public:
|
||||
const std::shared_ptr<UpdateParameters>&,
|
||||
const RenderTree&,
|
||||
UniqueChangeRequestVec&) override;
|
||||
|
||||
/// Remove all the drawables for tiles
|
||||
std::size_t removeAllDrawables() override;
|
||||
|
||||
#endif // MLN_DRAWABLE_RENDERER
|
||||
|
||||
protected:
|
||||
@@ -120,8 +124,6 @@ protected:
|
||||
/// Remove all drawables for the tile from the layer group
|
||||
std::size_t removeTile(RenderPass, const OverscaledTileID&) override;
|
||||
|
||||
/// Remove all the drawables for tiles
|
||||
std::size_t removeAllDrawables() override;
|
||||
#endif // MLN_DRAWABLE_RENDERER
|
||||
|
||||
private:
|
||||
|
||||
@@ -191,6 +191,9 @@ public:
|
||||
|
||||
/// Returns the current renderability mode of the layer
|
||||
bool isLayerRenderable() const noexcept { return isRenderable; }
|
||||
|
||||
/// Remove all the drawables for tiles
|
||||
virtual std::size_t removeAllDrawables();
|
||||
#endif
|
||||
|
||||
using Dependency = style::expression::Dependency;
|
||||
@@ -247,9 +250,6 @@ protected:
|
||||
/// @return The number of drawables actually removed.
|
||||
virtual std::size_t removeTile(RenderPass, const OverscaledTileID&);
|
||||
|
||||
/// Remove all the drawables for tiles
|
||||
virtual std::size_t removeAllDrawables();
|
||||
|
||||
/// Update `renderTileIDs` from `renderTiles`
|
||||
void updateRenderTileIDs();
|
||||
|
||||
|
||||
@@ -983,6 +983,13 @@ void RenderOrchestrator::updateLayers(gfx::ShaderRegistry& shaders,
|
||||
|
||||
for (const auto& item : items) {
|
||||
auto& renderLayer = item.layer.get();
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
// Android Emulator: Goldfish is *very* broken. This will prevent a crash
|
||||
// inside the GL translation layer at the cost of emulator performance.
|
||||
if (androidGoldfishMitigationEnabled) {
|
||||
renderLayer.removeAllDrawables();
|
||||
}
|
||||
#endif
|
||||
renderLayer.update(shaders, context, state, updateParameters, renderTree, changes);
|
||||
}
|
||||
addChanges(changes);
|
||||
|
||||
@@ -61,6 +61,10 @@ public:
|
||||
const std::optional<std::string>& localFontFamily_);
|
||||
~RenderOrchestrator() override;
|
||||
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
void enableAndroidEmulatorGoldfishMitigation(bool enable) { androidGoldfishMitigationEnabled = enable; }
|
||||
#endif
|
||||
|
||||
void markContextLost() { contextLost = true; };
|
||||
// TODO: Introduce RenderOrchestratorObserver.
|
||||
void setObserver(RendererObserver*);
|
||||
@@ -220,6 +224,10 @@ private:
|
||||
bool placedSymbolDataCollected = false;
|
||||
bool tileCacheEnabled = true;
|
||||
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
bool androidGoldfishMitigationEnabled{false};
|
||||
#endif
|
||||
|
||||
// Vectors with reserved capacity of layerImpls->size() to avoid
|
||||
// reallocation on each frame.
|
||||
std::vector<Immutable<style::LayerProperties>> filteredLayersForSource;
|
||||
|
||||
@@ -152,4 +152,10 @@ void Renderer::clearData() {
|
||||
impl->orchestrator.clearData();
|
||||
}
|
||||
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
void Renderer::enableAndroidEmulatorGoldfishMitigation(bool enable) {
|
||||
impl->orchestrator.enableAndroidEmulatorGoldfishMitigation(enable);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user