Add Android Vulkan backend (#2711)

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
Adrian Cojocaru
2024-09-06 17:40:57 +03:00
committed by GitHub
parent 4b5d06d908
commit ea09bdf2b6
79 changed files with 2580 additions and 1400 deletions

View File

@@ -10,6 +10,7 @@
#include <optional>
#include <jni/jni.hpp>
#include <android/native_window.h>
namespace mbgl {
@@ -26,6 +27,11 @@ namespace android {
class AndroidRendererBackend;
class AndroidSurface {
public:
static constexpr auto Name() { return "android/view/Surface"; };
};
/**
* The MapRenderer is a peer class that encapsulates the actions
* performed on the GL Thread.
@@ -105,7 +111,7 @@ private:
// Renders a frame.
void render(JNIEnv&);
void onSurfaceCreated(JNIEnv&);
void onSurfaceCreated(JNIEnv&, const jni::Object<AndroidSurface>& surface);
void onSurfaceChanged(JNIEnv&, jint width, jint height);
@@ -132,12 +138,14 @@ private:
std::unique_ptr<AndroidRendererBackend> backend;
std::unique_ptr<Renderer> renderer;
std::unique_ptr<ActorRef<Renderer>> rendererRef;
std::unique_ptr<ANativeWindow, std::function<void(ANativeWindow*)>> window;
std::shared_ptr<UpdateParameters> updateParameters;
std::mutex updateMutex;
bool framebufferSizeChanged = false;
std::atomic<bool> destroyed{false};
bool swapBehaviorFlush{true};
std::unique_ptr<SnapshotCallback> snapshotCallback;
mapbox::base::WeakPtrFactory<Scheduler> weakFactory{this};