From a9ddf5b7fd311ffb9215a682ab2387181189071e Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Thu, 21 Sep 2017 14:26:48 -0700 Subject: Preserve depth buffer between 3D layers + optimize render order (#9931) Port of https://github.com/mapbox/mapbox-gl-js/pull/5101: adds a new render pass `Pass3D` before any other rendering wherein we render layers with 3D passes (fill-extrusion layers) to offscreen framebuffers, sharing a depth renderbuffer between those layers in order to render 3D space correctly. Those framebuffers are saved on the RenderLayers and copied back to the map during the translucent pass. Rendering to offscreen framebuffers before we do any clear + draw means we can avoid expensive framebuffer restores. --- platform/android/src/native_map_view.cpp | 8 ++++---- platform/android/src/native_map_view.hpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'platform/android/src') diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index d859d929d3..fb00cec1e2 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -115,6 +115,10 @@ void NativeMapView::bind() { setViewport(0, 0, getFramebufferSize()); } +mbgl::Size NativeMapView::getFramebufferSize() const { + return { static_cast(fbWidth), static_cast(fbHeight) }; +} + /** * From mbgl::RendererBackend. */ @@ -1428,10 +1432,6 @@ void NativeMapView::_destroySurface() { } } -mbgl::Size NativeMapView::getFramebufferSize() const { - return { static_cast(fbWidth), static_cast(fbHeight) }; -} - void NativeMapView::updateAssumedState() { assumeFramebufferBinding(0); assumeViewport(0, 0, getFramebufferSize()); diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 24c88f4e3f..bfd928d347 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -58,6 +58,9 @@ public: // mbgl::RendererBackend // void bind() override; + + mbgl::Size getFramebufferSize() const override; + void updateAssumedState() override; // Deprecated // @@ -282,8 +285,6 @@ private: EGLConfig chooseConfig(const EGLConfig configs[], EGLint numConfigs); - mbgl::Size getFramebufferSize() const; - void updateFps(); private: -- cgit v1.2.1