summaryrefslogtreecommitdiff
path: root/thirdparty/vulkan/patches
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2021-08-12 14:24:54 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2021-08-12 14:25:15 +0300
commitd7957a2a2091a00c8ccdebb6900e5a0f21aa205d (patch)
tree86b99a97ef9540d46183ac9667c58cb124880821 /thirdparty/vulkan/patches
parent67fc611bda7b55b3eeab87f683a5c95ea0d0313f (diff)
Use "volk" instead of statically linked Vulkan loader.
Diffstat (limited to 'thirdparty/vulkan/patches')
-rw-r--r--thirdparty/vulkan/patches/VKEnumStringHelper-use-volk.patch17
-rw-r--r--thirdparty/vulkan/patches/VMA-use-volk.patch17
-rw-r--r--thirdparty/vulkan/patches/Vulkan-Loader-pr475.patch37
-rw-r--r--thirdparty/vulkan/patches/Vulkan-Loader-revert-pr260.patch57
4 files changed, 34 insertions, 94 deletions
diff --git a/thirdparty/vulkan/patches/VKEnumStringHelper-use-volk.patch b/thirdparty/vulkan/patches/VKEnumStringHelper-use-volk.patch
new file mode 100644
index 0000000000..0fd22281d9
--- /dev/null
+++ b/thirdparty/vulkan/patches/VKEnumStringHelper-use-volk.patch
@@ -0,0 +1,17 @@
+diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
+index 4c36430341..004a861774 100755
+--- a/thirdparty/vulkan/vk_enum_string_helper.h
++++ b/thirdparty/vulkan/vk_enum_string_helper.h
+@@ -36,7 +36,11 @@
+ #endif
+
+ #include <string>
+-#include <vulkan/vulkan.h>
++#ifdef USE_VOLK
++ #include <volk.h>
++#else
++ #include <vulkan/vulkan.h>
++#endif
+
+
+ static inline const char* string_VkResult(VkResult input_value)
diff --git a/thirdparty/vulkan/patches/VMA-use-volk.patch b/thirdparty/vulkan/patches/VMA-use-volk.patch
new file mode 100644
index 0000000000..4ba84c9a60
--- /dev/null
+++ b/thirdparty/vulkan/patches/VMA-use-volk.patch
@@ -0,0 +1,17 @@
+diff --git a/thirdparty/vulkan/vk_mem_alloc.h b/thirdparty/vulkan/vk_mem_alloc.h
+index 8a42699e7f..510fa4d3ef 100644
+--- a/thirdparty/vulkan/vk_mem_alloc.h
++++ b/thirdparty/vulkan/vk_mem_alloc.h
+@@ -1771,7 +1771,11 @@ available through VmaAllocatorCreateInfo::pRecordSettings.
+ #endif
+
+ #ifndef VULKAN_H_
+- #include <vulkan/vulkan.h>
++ #ifdef USE_VOLK
++ #include <volk.h>
++ #else
++ #include <vulkan/vulkan.h>
++ #endif
+ #endif
+
+ #if VMA_RECORDING_ENABLED
diff --git a/thirdparty/vulkan/patches/Vulkan-Loader-pr475.patch b/thirdparty/vulkan/patches/Vulkan-Loader-pr475.patch
deleted file mode 100644
index 5303768f5c..0000000000
--- a/thirdparty/vulkan/patches/Vulkan-Loader-pr475.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From e1c938170bba5879d95bf2d7b57b4d1d68557cd5 Mon Sep 17 00:00:00 2001
-From: Brecht Sanders <brecht@sanders.org>
-Date: Tue, 29 Sep 2020 18:14:55 +0200
-Subject: [PATCH] loader: Fixes build with MinGW-w64 8.0.0.
-
-See http://winlibs.com for a release of such GCC compiler
-See issue https://github.com/KhronosGroup/Vulkan-Loader/issues/474
----
- loader/loader.c | 7 +++++++
- 1 file changed, 7 insertions(+), 0 deletions(-)
-
-diff --git a/loader/loader.c b/loader/loader.c
-index 4d8865e13..509f2f420 100644
---- a/loader/loader.c
-+++ b/loader/loader.c
-@@ -71,6 +71,9 @@
- #include <devpkey.h>
- #include <winternl.h>
- #include <strsafe.h>
-+#ifdef __MINGW32__
-+#undef strcpy // fix error with redfined strcpy when building with MinGW-w64
-+#endif
- #include <dxgi1_6.h>
- #include "adapters.h"
-
-@@ -695,7 +698,11 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char *
- LPCSTR value_name) {
- static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}";
- static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}";
-+#ifdef CM_GETIDLIST_FILTER_PRESENT
- const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT;
-+#else
-+ const ULONG flags = 0x300;
-+#endif
-
- wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {}
- ULONG childGuidSize = sizeof(childGuid);
diff --git a/thirdparty/vulkan/patches/Vulkan-Loader-revert-pr260.patch b/thirdparty/vulkan/patches/Vulkan-Loader-revert-pr260.patch
deleted file mode 100644
index 1267e560df..0000000000
--- a/thirdparty/vulkan/patches/Vulkan-Loader-revert-pr260.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-diff --git a/thirdparty/vulkan/loader/loader.c b/thirdparty/vulkan/loader/loader.c
-index 87d08d5116..c7cdb47122 100644
---- a/thirdparty/vulkan/loader/loader.c
-+++ b/thirdparty/vulkan/loader/loader.c
-@@ -7330,7 +7330,7 @@ out:
- return result;
- }
-
--#if defined(_WIN32)
-+#if defined(_WIN32) && defined(LOADER_DYNAMIC_LIB)
- BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
- switch (reason) {
- case DLL_PROCESS_ATTACH:
-diff --git a/thirdparty/vulkan/loader/loader.h b/thirdparty/vulkan/loader/loader.h
-index 5e9495521b..56745a968d 100644
---- a/thirdparty/vulkan/loader/loader.h
-+++ b/thirdparty/vulkan/loader/loader.h
-@@ -420,6 +420,9 @@ static inline void loader_init_dispatch(void *obj, const void *data) {
- // Global variables used across files
- extern struct loader_struct loader;
- extern THREAD_LOCAL_DECL struct loader_instance *tls_instance;
-+#if defined(_WIN32) && !defined(LOADER_DYNAMIC_LIB)
-+extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init);
-+#endif
- extern loader_platform_thread_mutex loader_lock;
- extern loader_platform_thread_mutex loader_json_lock;
-
-diff --git a/thirdparty/vulkan/loader/vk_loader_platform.h b/thirdparty/vulkan/loader/vk_loader_platform.h
-index 7824e35d6b..62e8e3ae09 100644
---- a/thirdparty/vulkan/loader/vk_loader_platform.h
-+++ b/thirdparty/vulkan/loader/vk_loader_platform.h
-@@ -330,9 +330,25 @@ typedef HANDLE loader_platform_thread;
- // The once init functionality is not used when building a DLL on Windows. This is because there is no way to clean up the
- // resources allocated by anything allocated by once init. This isn't a problem for static libraries, but it is for dynamic
- // ones. When building a DLL, we use DllMain() instead to allow properly cleaning up resources.
-+#if defined(LOADER_DYNAMIC_LIB)
- #define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var)
- #define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var)
- #define LOADER_PLATFORM_THREAD_ONCE(ctl, func)
-+#else
-+#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) INIT_ONCE var = INIT_ONCE_STATIC_INIT;
-+#define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) INIT_ONCE var;
-+#define LOADER_PLATFORM_THREAD_ONCE(ctl, func) loader_platform_thread_once_fn(ctl, func)
-+static BOOL CALLBACK InitFuncWrapper(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) {
-+ void (*func)(void) = (void (*)(void))Parameter;
-+ func();
-+ return TRUE;
-+}
-+static void loader_platform_thread_once_fn(void *ctl, void (*func)(void)) {
-+ assert(func != NULL);
-+ assert(ctl != NULL);
-+ InitOnceExecuteOnce((PINIT_ONCE)ctl, InitFuncWrapper, (void *)func, NULL);
-+}
-+#endif
-
- // Thread IDs:
- typedef DWORD loader_platform_thread_id;