Hash :
122a1cc5
Author :
Date :
2021-01-26T20:06:24
Fix several vulkan backend problem on Android. * Load AHardwarebuffer API dynamically, so vulkan backend can be built with old NDK, but can work with newer android releases. * Do not link with libvulkan on android. * Expose EGL_ANDROID_get_native_client_buffer extension with vulkan backend. Bug: chromium:1170339 Change-Id: Idf7f6867a86ae40ba6d57a86e419c610ba404ba8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2653506 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "libANGLE/renderer/vulkan/android/AHBFunctions.h"
#include <dlfcn.h>
namespace rx
{
namespace
{
template <class T>
void AssignFn(void *handle, const char *name, T &fn)
{
fn = reinterpret_cast<T>(dlsym(handle, name));
}
} // namespace
AHBFunctions::AHBFunctions()
{
void *handle = dlopen(nullptr, RTLD_NOW);
AssignFn(handle, "AHardwareBuffer_acquire", mAcquireFn);
AssignFn(handle, "AHardwareBuffer_describe", mDescribeFn);
AssignFn(handle, "AHardwareBuffer_release", mReleaseFn);
}
AHBFunctions::~AHBFunctions() = default;
} // namespace rx