mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-11-23 07:10:23 +00:00
!37 增加layer搜索路径保证swapchain layer被优先加载
Merge pull request !37 from Andrew0229/fix_layer
This commit is contained in:
commit
8b5f1310fb
9
BUILD.gn
9
BUILD.gn
@ -35,9 +35,7 @@ config("vulkan_internal_config") {
|
||||
ldflags = [ "-Wl,-Bsymbolic" ]
|
||||
|
||||
defines += [
|
||||
"SYSCONFDIR=\"/system/etc\"",
|
||||
"FALLBACK_CONFIG_DIRS=\"/vendor/etc\"",
|
||||
"FALLBACK_DATA_DIRS=\"/data\"",
|
||||
"SYSCONFDIR=\"/system/etc:/system/etc/vulkan/swapchain:/vendor/etc\"",
|
||||
"VK_USE_PLATFORM_OHOS",
|
||||
]
|
||||
}
|
||||
@ -95,7 +93,10 @@ ohos_shared_library("vulkan_loader") {
|
||||
|
||||
configs = [ ":vulkan_internal_config" ]
|
||||
public_configs = [ ":vulkan_loader_config" ]
|
||||
external_deps = [ "hilog:libhilog" ]
|
||||
external_deps = [
|
||||
"hilog:libhilog",
|
||||
"init:libbegetutil",
|
||||
]
|
||||
public_external_deps = [ "vulkan-headers:vulkan_headers" ]
|
||||
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "allocation.h"
|
||||
#include "log.h"
|
||||
#include "param/sys_param.h"
|
||||
|
||||
// Environment variables
|
||||
#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
@ -37,10 +38,21 @@
|
||||
bool is_high_integrity() { return geteuid() != getuid() || getegid() != getgid(); }
|
||||
|
||||
char *loader_getenv(const char *name, const struct loader_instance *inst) {
|
||||
#ifdef __OHOS__
|
||||
CachedHandle g_Handle = CachedParameterCreate(name, "");
|
||||
int changed = 0;
|
||||
const char *res = CachedParameterGetChanged(g_Handle, &changed);
|
||||
loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_INFO_BIT, 0, "loader_getenv name:%s, res:%s", name, res);
|
||||
if (res == NULL || res[0] == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
return (char *)res;
|
||||
#else
|
||||
// No allocation of memory necessary for Linux, but we should at least touch
|
||||
// the inst pointer to get rid of compiler warnings.
|
||||
(void)inst;
|
||||
return getenv(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *loader_secure_getenv(const char *name, const struct loader_instance *inst) {
|
||||
|
@ -2895,7 +2895,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
|
||||
char *xdg_config_home = loader_secure_getenv("XDG_CONFIG_HOME", inst);
|
||||
char *xdg_config_dirs = loader_secure_getenv("XDG_CONFIG_DIRS", inst);
|
||||
|
||||
#if !defined(__Fuchsia__) && !defined(__QNXNTO__)
|
||||
#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__)
|
||||
if (NULL == xdg_config_dirs || '\0' == xdg_config_dirs[0]) {
|
||||
xdg_config_dirs = FALLBACK_CONFIG_DIRS;
|
||||
}
|
||||
@ -2904,7 +2904,7 @@ static VkResult read_data_files_in_search_paths(const struct loader_instance *in
|
||||
char *xdg_data_home = loader_secure_getenv("XDG_DATA_HOME", inst);
|
||||
char *xdg_data_dirs = loader_secure_getenv("XDG_DATA_DIRS", inst);
|
||||
|
||||
#if !defined(__Fuchsia__) && !defined(__QNXNTO__)
|
||||
#if !defined(__Fuchsia__) && !defined(__QNXNTO__) && !defined(__OHOS__)
|
||||
if (NULL == xdg_data_dirs || '\0' == xdg_data_dirs[0]) {
|
||||
xdg_data_dirs = FALLBACK_DATA_DIRS;
|
||||
}
|
||||
|
@ -343,7 +343,11 @@ static inline const char *loader_platform_open_library_error(const char *libPath
|
||||
return dlerror();
|
||||
#endif
|
||||
}
|
||||
static inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); }
|
||||
static inline void loader_platform_close_library(loader_platform_dl_handle library) {
|
||||
#if !defined (__OHOS__)
|
||||
dlclose(library);
|
||||
#endif
|
||||
}
|
||||
static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) {
|
||||
assert(library);
|
||||
assert(name);
|
||||
|
Loading…
Reference in New Issue
Block a user