feat(android): Vulkan graphics backend support for Android custom layers (#4348)

Co-authored-by: Vladyslav Odobesku <VladyslavOdobesku@intellias.com>
Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Vladyslav Odobesku
2026-06-26 19:53:00 +03:00
committed by GitHub
parent 9f6f8e3f1b
commit aa90185d42
25 changed files with 791 additions and 67 deletions

View File

@@ -131,7 +131,7 @@ class ExampleCustomLayer : mbgl::style::CustomLayerHost {
public:
~ExampleCustomLayer() {}
void initialize() {
void initialize(const mbgl::style::CustomLayerInitParameters &) override {
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "Initialize");
// Debug info
@@ -163,7 +163,7 @@ public:
GL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), background, GL_STATIC_DRAW));
}
void render(const mbgl::style::CustomLayerRenderParameters &) {
void render(const mbgl::style::CustomLayerRenderParameters &) override {
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "Render");
glUseProgram(program);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
@@ -183,12 +183,12 @@ public:
GL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4));
}
void contextLost() {
void contextLost() override {
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "ContextLost");
program = 0;
}
void deinitialize() {
void deinitialize() override {
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, "DeInitialize");
if (program) {
glDeleteBuffers(1, &buffer);