summaryrefslogtreecommitdiff
path: root/platform/iphone
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 /platform/iphone
parent67fc611bda7b55b3eeab87f683a5c95ea0d0313f (diff)
Use "volk" instead of statically linked Vulkan loader.
Diffstat (limited to 'platform/iphone')
-rw-r--r--platform/iphone/detect.py10
-rw-r--r--platform/iphone/display_server_iphone.h6
-rw-r--r--platform/iphone/main.m1
-rw-r--r--platform/iphone/os_iphone.mm6
-rw-r--r--platform/iphone/vulkan_context_iphone.mm6
5 files changed, 18 insertions, 11 deletions
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index cf358e0878..0b7f5601e6 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),
]
@@ -208,4 +203,5 @@ def configure(env):
# 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;