diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/detect.py | 10 | ||||
-rw-r--r-- | platform/android/vulkan/vulkan_context_android.cpp | 6 | ||||
-rw-r--r-- | platform/iphone/detect.py | 48 | ||||
-rw-r--r-- | platform/iphone/display_server_iphone.h | 6 | ||||
-rw-r--r-- | platform/iphone/main.m | 1 | ||||
-rw-r--r-- | platform/iphone/os_iphone.mm | 6 | ||||
-rw-r--r-- | platform/iphone/vulkan_context_iphone.mm | 6 | ||||
-rw-r--r-- | platform/linuxbsd/detect.py | 2 | ||||
-rw-r--r-- | platform/linuxbsd/vulkan_context_x11.cpp | 6 | ||||
-rw-r--r-- | platform/osx/detect.py | 18 | ||||
-rw-r--r-- | platform/osx/vulkan_context_osx.mm | 6 | ||||
-rw-r--r-- | platform/windows/detect.py | 8 | ||||
-rw-r--r-- | platform/windows/vulkan_context_win.cpp | 6 |
13 files changed, 54 insertions, 75 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py index 1b6af8662e..9be6f33b93 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -54,6 +54,7 @@ def get_android_ndk_root(): def get_flags(): return [ ("tools", False), + ("use_volk", False), ] @@ -367,8 +368,13 @@ def configure(env): ) env.Prepend(CPPPATH=["#platform/android"]) - env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED", "VULKAN_ENABLED", "NO_FCNTL"]) - env.Append(LIBS=["OpenSLES", "EGL", "GLESv2", "vulkan", "android", "log", "z", "dl"]) + env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED", "NO_FCNTL"]) + env.Append(LIBS=["OpenSLES", "EGL", "GLESv2", "android", "log", "z", "dl"]) + + if env["vulkan"]: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["use_volk"]: + env.Append(LIBS=["vulkan"]) # Return the project NDK version. diff --git a/platform/android/vulkan/vulkan_context_android.cpp b/platform/android/vulkan/vulkan_context_android.cpp index a031f3beee..f06a30f3a4 100644 --- a/platform/android/vulkan/vulkan_context_android.cpp +++ b/platform/android/vulkan/vulkan_context_android.cpp @@ -30,7 +30,11 @@ #include "vulkan_context_android.h" -#include <vulkan/vulkan_android.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextAndroid::_get_platform_surface_extension() const { return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME; diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index cf358e0878..05e24c5003 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -28,12 +28,6 @@ def get_opts(): "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain", ), ("IPHONESDK", "Path to the iPhone SDK", ""), - BoolVariable( - "use_static_mvk", - "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables" - " validation layers)", - False, - ), BoolVariable("ios_simulator", "Build for iOS Simulator", False), BoolVariable("ios_exceptions", "Enable exceptions", False), ("ios_triple", "Triple for ios toolchain", ""), @@ -43,6 +37,7 @@ def get_opts(): def get_flags(): return [ ("tools", False), + ("use_volk", False), ] @@ -111,12 +106,10 @@ def configure(env): if env["ios_simulator"]: detect_darwin_sdk_path("iphonesimulator", env) env.Append(CCFLAGS=["-mios-simulator-version-min=13.0"]) - env.Append(LINKFLAGS=["-mios-simulator-version-min=13.0"]) env.extra_suffix = ".simulator" + env.extra_suffix else: detect_darwin_sdk_path("iphone", env) env.Append(CCFLAGS=["-miphoneos-version-min=11.0"]) - env.Append(LINKFLAGS=["-miphoneos-version-min=11.0"]) if env["arch"] == "x86" or env["arch"] == "x86_64": env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = "10.9" @@ -162,35 +155,6 @@ def configure(env): # Temp fix for ABS/MAX/MIN macros in iPhone SDK blocking compilation env.Append(CCFLAGS=["-Wno-ambiguous-macro"]) - ## Link flags - - if env["arch"] == "x86" or env["arch"] == "x86_64": - arch_flag = "i386" if env["arch"] == "x86" else env["arch"] - env.Append( - LINKFLAGS=[ - "-arch", - arch_flag, - "-isysroot", - "$IPHONESDK", - "-Xlinker", - "-objc_abi_version", - "-Xlinker", - "2", - "-F$IPHONESDK", - ] - ) - elif env["arch"] == "arm": - env.Append(LINKFLAGS=["-arch", "armv7", "-Wl,-dead_strip"]) - if env["arch"] == "arm64": - env.Append(LINKFLAGS=["-arch", "arm64", "-Wl,-dead_strip"]) - - env.Append( - LINKFLAGS=[ - "-isysroot", - "$IPHONESDK", - ] - ) - env.Prepend( CPPPATH=[ "$IPHONESDK/usr/include", @@ -198,14 +162,8 @@ def configure(env): ] ) - env["ENV"]["CODESIGN_ALLOCATE"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" - env.Prepend(CPPPATH=["#platform/iphone"]) env.Append(CPPDEFINES=["IPHONE_ENABLED", "UNIX_ENABLED", "COREAUDIO_ENABLED"]) - env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - env.Append(LINKFLAGS=["-framework", "IOSurface"]) - - # Use Static Vulkan for iOS. Dynamic Framework works fine too. - env.Append(LINKFLAGS=["-framework", "MoltenVK"]) - env["builtin_vulkan"] = False + if env["vulkan"]: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) diff --git a/platform/iphone/display_server_iphone.h b/platform/iphone/display_server_iphone.h index cd2de550f1..5cfcc1765c 100644 --- a/platform/iphone/display_server_iphone.h +++ b/platform/iphone/display_server_iphone.h @@ -41,7 +41,11 @@ #include "vulkan_context_iphone.h" #import <QuartzCore/CAMetalLayer.h> -#include <vulkan/vulkan_metal.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif #endif class DisplayServerIPhone : public DisplayServer { diff --git a/platform/iphone/main.m b/platform/iphone/main.m index fddd5bd99f..d2c41d4d84 100644 --- a/platform/iphone/main.m +++ b/platform/iphone/main.m @@ -32,7 +32,6 @@ #import <UIKit/UIKit.h> #include <stdio.h> -#include <vulkan/vulkan.h> int gargc; char **gargv; diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index a999929cc4..c88d253691 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -49,7 +49,11 @@ #if defined(VULKAN_ENABLED) #include "servers/rendering/renderer_rd/renderer_compositor_rd.h" #import <QuartzCore/CAMetalLayer.h> -#include <vulkan/vulkan_metal.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif #endif // Initialization order between compilation units is not guaranteed, diff --git a/platform/iphone/vulkan_context_iphone.mm b/platform/iphone/vulkan_context_iphone.mm index 17f2b167b3..5432cdc033 100644 --- a/platform/iphone/vulkan_context_iphone.mm +++ b/platform/iphone/vulkan_context_iphone.mm @@ -29,7 +29,11 @@ /*************************************************************************/ #include "vulkan_context_iphone.h" -#include <vulkan/vulkan_ios.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextIPhone::_get_platform_surface_extension() const { return VK_MVK_IOS_SURFACE_EXTENSION_NAME; diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index eba672ddcb..3e3ed469ed 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -384,7 +384,7 @@ def configure(env): if env["vulkan"]: env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["builtin_vulkan"]: + if not env["use_volk"]: env.ParseConfig("pkg-config vulkan --cflags --libs") if not env["builtin_glslang"]: # No pkgconfig file for glslang so far diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp index 88cb00a8a1..ebaef984e0 100644 --- a/platform/linuxbsd/vulkan_context_x11.cpp +++ b/platform/linuxbsd/vulkan_context_x11.cpp @@ -29,7 +29,11 @@ /*************************************************************************/ #include "vulkan_context_x11.h" -#include <vulkan/vulkan_xlib.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextX11::_get_platform_surface_extension() const { return VK_KHR_XLIB_SURFACE_EXTENSION_NAME; diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 2393f2ea10..6b25daf05d 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -25,12 +25,6 @@ def get_opts(): ("osxcross_sdk", "OSXCross SDK version", "darwin16"), ("MACOS_SDK_PATH", "Path to the macOS SDK", ""), ("VULKAN_SDK_PATH", "Path to the Vulkan SDK", ""), - BoolVariable( - "use_static_mvk", - "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables" - " validation layers)", - False, - ), EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")), BoolVariable("debug_symbols", "Add debugging symbols to release/release_debug builds", True), BoolVariable("separate_debug_symbols", "Create a separate file containing debugging symbols", False), @@ -188,12 +182,10 @@ def configure(env): ) env.Append(LIBS=["pthread", "z"]) - env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"]) - if env["use_static_mvk"]: - env.Append(LINKFLAGS=["-L$VULKAN_SDK_PATH/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/", "-lMoltenVK"]) - env["builtin_vulkan"] = False - elif not env["builtin_vulkan"]: - env.Append(LIBS=["vulkan"]) + if env["vulkan"]: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"]) + if not env["use_volk"]: + env.Append(LINKFLAGS=["-L$VULKAN_SDK_PATH/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/", "-lMoltenVK"]) # env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED']) diff --git a/platform/osx/vulkan_context_osx.mm b/platform/osx/vulkan_context_osx.mm index 7e18e177c1..504955149b 100644 --- a/platform/osx/vulkan_context_osx.mm +++ b/platform/osx/vulkan_context_osx.mm @@ -29,7 +29,11 @@ /*************************************************************************/ #include "vulkan_context_osx.h" -#include <vulkan/vulkan_macos.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextOSX::_get_platform_surface_extension() const { return VK_MVK_MACOS_SURFACE_EXTENSION_NAME; diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 287ece1d29..9154f7749e 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -278,10 +278,8 @@ def configure_msvc(env, manual_msvc_config): ] env.AppendUnique(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["builtin_vulkan"]: + if not env["use_volk"]: LIBS += ["vulkan"] - else: - LIBS += ["cfgmgr32"] # env.AppendUnique(CPPDEFINES = ['OPENGL_ENABLED']) LIBS += ["opengl32"] @@ -456,10 +454,8 @@ def configure_mingw(env): ) env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["builtin_vulkan"]: + if not env["use_volk"]: env.Append(LIBS=["vulkan"]) - else: - env.Append(LIBS=["cfgmgr32"]) ## TODO !!! Re-enable when OpenGLES Rendering Device is implemented !!! # env.Append(CPPDEFINES=['OPENGL_ENABLED']) diff --git a/platform/windows/vulkan_context_win.cpp b/platform/windows/vulkan_context_win.cpp index 191792b329..d720c7e8fe 100644 --- a/platform/windows/vulkan_context_win.cpp +++ b/platform/windows/vulkan_context_win.cpp @@ -29,7 +29,11 @@ /*************************************************************************/ #include "vulkan_context_win.h" -#include <vulkan/vulkan_win32.h> +#ifdef USE_VOLK +#include <volk.h> +#else +#include <vulkan/vulkan.h> +#endif const char *VulkanContextWindows::_get_platform_surface_extension() const { return VK_KHR_WIN32_SURFACE_EXTENSION_NAME; |