mirror of
https://github.com/BtbN/FFmpeg-Builds.git
synced 2025-06-12 13:27:38 +02:00
Add libplacebo
This commit is contained in:
@ -1,75 +0,0 @@
|
||||
From 45fd7a314a2dc4b39bacbd91369128e04adc0699 Mon Sep 17 00:00:00 2001
|
||||
From: Syoyo Fujita <syoyo@lighttransport.com>
|
||||
Date: Thu, 28 May 2020 21:38:16 +0900
|
||||
Subject: [PATCH 1/4] Fix build on MinGW cross compiling environment.
|
||||
|
||||
---
|
||||
loader/CMakeLists.txt | 4 +++-
|
||||
loader/loader.rc | 4 ++++
|
||||
loader/loader_windows.c | 12 ++++++++++++
|
||||
3 files changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
|
||||
index 56aece671..6e7971845 100644
|
||||
--- a/loader/CMakeLists.txt
|
||||
+++ b/loader/CMakeLists.txt
|
||||
@@ -187,7 +187,7 @@ if(WIN32)
|
||||
if (USE_MASM)
|
||||
enable_language(ASM_MASM)
|
||||
endif ()
|
||||
- if(CMAKE_ASM_MASM_COMPILER_WORKS OR JWASM_FOUND)
|
||||
+ if((CMAKE_ASM_MASM_COMPILER_WORKS AND NOT CMAKE_CROSSCOMPILING) OR JWASM_FOUND)
|
||||
if(MINGW)
|
||||
set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS})
|
||||
elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND)
|
||||
@@ -207,6 +207,8 @@ if(WIN32)
|
||||
add_library(loader-unknown-chain OBJECT unknown_ext_chain.c)
|
||||
set_target_properties(loader-unknown-chain PROPERTIES CMAKE_C_FLAGS_DEBUG "${MODIFIED_C_FLAGS_DEBUG}")
|
||||
target_compile_options(loader-unknown-chain PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
|
||||
+
|
||||
+ target_include_directories(loader-unknown-chain PRIVATE "$<TARGET_PROPERTY:Vulkan::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
# For MacOS, use the C code and force the compiler's tail-call optimization instead of using assembly code.
|
||||
diff --git a/loader/loader.rc b/loader/loader.rc
|
||||
index 44193ea33..456ac70a2 100644
|
||||
--- a/loader/loader.rc
|
||||
+++ b/loader/loader.rc
|
||||
@@ -19,7 +19,11 @@
|
||||
// Author: Charles Giessen <charles@lunarg.com>
|
||||
//
|
||||
|
||||
+#if defined(__MINGW32__)
|
||||
+#include <winresrc.h>
|
||||
+#else
|
||||
#include "winres.h"
|
||||
+#endif
|
||||
|
||||
// All set through CMake
|
||||
#define VER_FILE_VERSION 1, 0, 1111, 2222
|
||||
diff --git a/loader/loader_windows.c b/loader/loader_windows.c
|
||||
index aff3b276e..e1579bf3a 100644
|
||||
--- a/loader/loader_windows.c
|
||||
+++ b/loader/loader_windows.c
|
||||
@@ -58,6 +58,18 @@
|
||||
typedef HRESULT(APIENTRY *PFN_CreateDXGIFactory1)(REFIID riid, void **ppFactory);
|
||||
static PFN_CreateDXGIFactory1 fpCreateDXGIFactory1;
|
||||
|
||||
+#if defined(__MINGW32__)
|
||||
+// MinGW header may not have some definitions(cfgmgr32.h).
|
||||
+#if !defined(CM_GETIDLIST_FILTER_CLASS)
|
||||
+#define CM_GETIDLIST_FILTER_CLASS (0x200)
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(CM_GETIDLIST_FILTER_PRESENT)
|
||||
+#define CM_GETIDLIST_FILTER_PRESENT (0x100)
|
||||
+#endif
|
||||
+
|
||||
+#endif // __MINGW32__
|
||||
+
|
||||
void windows_initialization(void) {
|
||||
char dll_location[MAX_PATH];
|
||||
HMODULE module_handle = NULL;
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 8f83fc25f149a53566e0367d185c2a10d2b5b50e Mon Sep 17 00:00:00 2001
|
||||
From: BtbN <btbn@btbn.de>
|
||||
Date: Mon, 7 Sep 2020 20:07:39 +0200
|
||||
Subject: [PATCH 2/4] Fixes for MinGW build
|
||||
|
||||
Adapted from https://github.com/msys2/MINGW-packages/blob/348f1d46d9d273a2cc928deadf9d9114f7a69c2f/mingw-w64-vulkan-loader/002-proper-def-files-for-32bit.patch
|
||||
---
|
||||
loader/CMakeLists.txt | 2 +-
|
||||
loader/vk_loader_platform.h | 4 +++-
|
||||
tests/framework/layer/wrap_objects.cpp | 4 +++-
|
||||
3 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
|
||||
index 6e7971845..b5bc0a98a 100644
|
||||
--- a/loader/CMakeLists.txt
|
||||
+++ b/loader/CMakeLists.txt
|
||||
@@ -364,11 +364,11 @@ else()
|
||||
)
|
||||
# cmake-format: on
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
target_compile_definitions(vulkan PRIVATE _XOPEN_SOURCE=500) # hush compiler warnings for readlink
|
||||
endif()
|
||||
-endif()
|
||||
|
||||
# Generate pkg-config file.
|
||||
include(FindPkgConfig QUIET)
|
||||
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
|
||||
index ecb8e1006..2e138aeaa 100644
|
||||
--- a/loader/vk_loader_platform.h
|
||||
+++ b/loader/vk_loader_platform.h
|
||||
@@ -76,7 +76,9 @@
|
||||
#include "vk_layer_dispatch_table.h"
|
||||
#include "vk_loader_extensions.h"
|
||||
|
||||
-#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
+#if defined(_WIN32)
|
||||
+#define LOADER_EXPORT __declspec(dllexport)
|
||||
+#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
diff --git a/tests/framework/layer/wrap_objects.cpp b/tests/framework/layer/wrap_objects.cpp
|
||||
index 8f617a6d3..e7b1996f6 100644
|
||||
--- a/tests/framework/layer/wrap_objects.cpp
|
||||
+++ b/tests/framework/layer/wrap_objects.cpp
|
||||
@@ -29,7 +29,9 @@
|
||||
#include "loader/vk_loader_layer.h"
|
||||
|
||||
#if !defined(VK_LAYER_EXPORT)
|
||||
-#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
+#if defined(_WIN32)
|
||||
+#define VK_LAYER_EXPORT __declspec(dllexport)
|
||||
+#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 6c963fb60da75e53214579507d7717acadb08c0f Mon Sep 17 00:00:00 2001
|
||||
From: BtbN <btbn@btbn.de>
|
||||
Date: Mon, 7 Sep 2020 20:33:23 +0200
|
||||
Subject: [PATCH 3/4] Define appropiate minimum Windows-Version
|
||||
|
||||
---
|
||||
loader/vk_loader_platform.h | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
|
||||
index 2e138aeaa..d956e803a 100644
|
||||
--- a/loader/vk_loader_platform.h
|
||||
+++ b/loader/vk_loader_platform.h
|
||||
@@ -30,6 +30,11 @@
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
+
|
||||
+#define WINVER 0x0601
|
||||
+#define _WIN32_WINNT 0x0601
|
||||
+#define STRSAFE_NO_DEPRECATE 1
|
||||
+
|
||||
// WinSock2.h must be included *BEFORE* windows.h
|
||||
#include <winsock2.h>
|
||||
#endif // _WIN32
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,159 +0,0 @@
|
||||
From 73d8fb89c6897648ef9e0340793cb2487695488f Mon Sep 17 00:00:00 2001
|
||||
From: BtbN <btbn@btbn.de>
|
||||
Date: Sun, 4 Apr 2021 23:29:53 +0200
|
||||
Subject: [PATCH 4/4] Unlock building static loader on any OS
|
||||
|
||||
Based in parts on https://github.com/shinchiro/mpv-winbuild-cmake/blob/master/packages/vulkan-0001-cross-compile-static-linking-hacks.patch
|
||||
---
|
||||
CMakeLists.txt | 2 --
|
||||
loader/CMakeLists.txt | 23 ++++++++++++++++++++++-
|
||||
loader/loader.h | 3 +++
|
||||
loader/loader_windows.c | 2 ++
|
||||
loader/vk_loader_platform.h | 16 ++++++++++++++++
|
||||
5 files changed, 43 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 703bcb1ba..43a25d8aa 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -95,9 +95,7 @@ if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
-if(APPLE)
|
||||
option(BUILD_STATIC_LOADER "Build a loader that can be statically linked" OFF)
|
||||
-endif()
|
||||
|
||||
if(WIN32)
|
||||
# Optional: Allow specify the exact version used in the loader dll
|
||||
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
|
||||
index b5bc0a98a..f74079954 100644
|
||||
--- a/loader/CMakeLists.txt
|
||||
+++ b/loader/CMakeLists.txt
|
||||
@@ -251,6 +251,22 @@ if(WIN32)
|
||||
target_compile_options(loader-opt PUBLIC ${MSVC_LOADER_COMPILE_OPTIONS})
|
||||
target_include_directories(loader-opt PRIVATE "$<TARGET_PROPERTY:Vulkan::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
|
||||
+ if(BUILD_STATIC_LOADER)
|
||||
+ add_library(vulkan
|
||||
+ STATIC
|
||||
+ $<TARGET_OBJECTS:loader-opt>
|
||||
+ $<TARGET_OBJECTS:loader-norm>
|
||||
+ $<TARGET_OBJECTS:loader-unknown-chain>
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/loader.rc)
|
||||
+ set_target_properties(vulkan
|
||||
+ PROPERTIES LINK_FLAGS_DEBUG
|
||||
+ "/ignore:4098"
|
||||
+ OUTPUT_NAME
|
||||
+ vulkan-1
|
||||
+ PREFIX
|
||||
+ lib)
|
||||
+ else()
|
||||
add_library(vulkan
|
||||
SHARED
|
||||
$<TARGET_OBJECTS:loader-opt>
|
||||
@@ -269,6 +285,8 @@ if(WIN32)
|
||||
set_target_properties(vulkan
|
||||
PROPERTIES
|
||||
OUTPUT_NAME vulkan-1)
|
||||
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS LOADER_DYNAMIC_LIB)
|
||||
+ endif()
|
||||
|
||||
target_link_libraries(vulkan Vulkan::Headers)
|
||||
|
||||
@@ -291,16 +309,18 @@ else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-typedef-redefinition")
|
||||
endif()
|
||||
|
||||
- if(APPLE AND BUILD_STATIC_LOADER)
|
||||
+ if(BUILD_STATIC_LOADER)
|
||||
add_library(vulkan STATIC ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS})
|
||||
else()
|
||||
add_library(vulkan SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS})
|
||||
endif()
|
||||
add_dependencies(vulkan loader_asm_gen_files)
|
||||
+ if (NOT BUILD_STATIC_LOADER)
|
||||
# set version based on LOADER_GENERATED_HEADER_VERSION used to generate the code
|
||||
set_target_properties(vulkan
|
||||
PROPERTIES SOVERSION "1"
|
||||
VERSION ${LOADER_GENERATED_HEADER_VERSION})
|
||||
+ endif()
|
||||
target_link_libraries(vulkan ${CMAKE_DL_LIBS} m)
|
||||
if (NOT ANDROID)
|
||||
target_link_libraries(vulkan pthread)
|
||||
@@ -377,6 +397,7 @@ if(PKG_CONFIG_FOUND)
|
||||
foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
|
||||
set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
|
||||
endforeach()
|
||||
+ set(PRIVATE_LIBS "${PRIVATE_LIBS} -lshlwapi -lcfgmgr32")
|
||||
if(WIN32)
|
||||
set(VULKAN_LIB_SUFFIX "-1")
|
||||
# Set libdir path as in cmake's FindVulkan.cmake
|
||||
diff --git a/loader/loader.h b/loader/loader.h
|
||||
index cfebfba67..62dcaeb81 100644
|
||||
--- a/loader/loader.h
|
||||
+++ b/loader/loader.h
|
||||
@@ -66,6 +66,9 @@ static inline void loader_init_dispatch(void *obj, const void *data) {
|
||||
|
||||
// Global variables used across files
|
||||
extern struct loader_struct loader;
|
||||
+#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;
|
||||
extern loader_platform_thread_mutex loader_preload_icd_lock;
|
||||
diff --git a/loader/loader_windows.c b/loader/loader_windows.c
|
||||
index e1579bf3a..8a7daef04 100644
|
||||
--- a/loader/loader_windows.c
|
||||
+++ b/loader/loader_windows.c
|
||||
@@ -98,6 +98,7 @@ void windows_initialization(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
+#if defined(LOADER_DYNAMIC_LIB)
|
||||
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
@@ -114,6 +115,7 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
+#endif
|
||||
|
||||
bool windows_add_json_entry(const struct loader_instance *inst,
|
||||
char **reg_data, // list of JSON files
|
||||
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
|
||||
index d956e803a..fab7b44f5 100644
|
||||
--- a/loader/vk_loader_platform.h
|
||||
+++ b/loader/vk_loader_platform.h
|
||||
@@ -456,9 +456,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;
|
||||
--
|
||||
2.25.1
|
||||
|
Reference in New Issue
Block a user