Files
haikuports/sys-libs/vulkan/patches/vulkan-1.2.199.patchset
2021-11-26 07:59:50 +01:00

130 lines
5.4 KiB
Plaintext

From 7079185366d6b93b92206e8cf9f4be60809d0872 Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Mon, 4 Oct 2021 03:12:53 +0900
Subject: basic fixes for haiku
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eba079c..7eae8d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -207,7 +207,7 @@ if(UNIX)
)
endif()
-if(UNIX AND NOT APPLE) # i.e.: Linux
+if(UNIX AND NOT APPLE AND NOT HAIKU) # i.e.: Linux
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)
diff --git a/loader/allocation.h b/loader/allocation.h
index 6c84050..2a5ecec 100644
--- a/loader/allocation.h
+++ b/loader/allocation.h
@@ -39,8 +39,8 @@ void loader_device_heap_free(const struct loader_device *device, void *pMemory);
void *loader_device_heap_realloc(const struct loader_device *device, void *pMemory, size_t orig_size, size_t size,
VkSystemAllocationScope alloc_scope);
-#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__HAIKU__)
#define loader_stack_alloc(size) alloca(size)
#elif defined(_WIN32)
#define loader_stack_alloc(size) _alloca(size)
-#endif // defined(_WIN32)
\ No newline at end of file
+#endif // defined(_WIN32)
diff --git a/loader/get_environment.c b/loader/get_environment.c
index bf878da..fcf924d 100644
--- a/loader/get_environment.c
+++ b/loader/get_environment.c
@@ -37,7 +37,7 @@
#endif // !defined(VULKAN_NON_CMAKE_BUILD)
// Environment variables
-#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__HAIKU__)
bool is_high_integrity() { return geteuid() != getuid() || getegid() != getgid(); }
@@ -45,11 +45,12 @@ char *loader_getenv(const char *name, const struct loader_instance *inst) {
// 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 NULL;
return getenv(name);
}
char *loader_secure_getenv(const char *name, const struct loader_instance *inst) {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
// Apple does not appear to have a secure getenv implementation.
// The main difference between secure getenv and getenv is that secure getenv
// returns NULL if the process is being run with elevated privileges by a normal user.
@@ -169,4 +170,4 @@ void loader_free_getenv(char *val, const struct loader_instance *inst) {
(void)inst;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/loader/loader.h b/loader/loader.h
index cfebfba..fe150ae 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -55,12 +55,13 @@ static inline struct loader_instance_dispatch_table *loader_get_instance_dispatc
}
static inline void loader_init_dispatch(void *obj, const void *data) {
+/*
#ifdef DEBUG
assert(valid_loader_magic_value(obj) &&
"Incompatible ICD, first dword must be initialized to "
"ICD_LOADER_MAGIC. See loader/README.md for details.");
#endif
-
+*/
loader_set_dispatch(obj, data);
}
@@ -161,4 +162,4 @@ VkResult setup_loader_term_phys_devs(struct loader_instance *inst);
VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array);
char *loader_get_next_path(char *path);
VkResult add_data_files_in_path(const struct loader_instance *inst, char *search_path, bool is_directory_list,
- struct loader_data_files *out_files, bool use_first_found_manifest);
\ No newline at end of file
+ struct loader_data_files *out_files, bool use_first_found_manifest);
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 507a901..40c84d7 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -42,7 +42,7 @@
#include "dlopen_fuchsia.h"
#endif // defined(__Fuchsia__)
-#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__HAIKU__)
#include <unistd.h>
// Note: The following file is for dynamic loading:
#include <dlfcn.h>
@@ -102,7 +102,7 @@
// Override layer information
#define VK_OVERRIDE_LAYER_NAME "VK_LAYER_LUNARG_override"
-#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) || defined(__HAIKU__)
/* Linux-specific common code: */
// VK Library Filenames, Paths, etc.:
@@ -195,7 +195,7 @@ static inline char *loader_platform_executable_path(char *buffer, size_t size) {
return buffer;
}
-#elif defined(__Fuchsia__)
+#elif defined(__Fuchsia__) || defined(__HAIKU__)
static inline char *loader_platform_executable_path(char *buffer, size_t size) { return NULL; }
#elif defined(__QNXNTO__)
--
2.30.2