• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2021 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #include "libANGLE/renderer/vulkan/android/AHBFunctions.h"
8 
9 #include <dlfcn.h>
10 
11 namespace rx
12 {
13 
14 namespace
15 {
16 
17 template <class T>
AssignFn(void * handle,const char * name,T & fn)18 void AssignFn(void *handle, const char *name, T &fn)
19 {
20     fn = reinterpret_cast<T>(dlsym(handle, name));
21 }
22 
23 }  // namespace
24 
AHBFunctions()25 AHBFunctions::AHBFunctions()
26 {
27     void *handle = dlopen(nullptr, RTLD_NOW);
28     AssignFn(handle, "AHardwareBuffer_acquire", mAcquireFn);
29     AssignFn(handle, "AHardwareBuffer_describe", mDescribeFn);
30     AssignFn(handle, "AHardwareBuffer_release", mReleaseFn);
31 }
32 
33 AHBFunctions::~AHBFunctions() = default;
34 
35 }  // namespace rx
36