Răsfoiți Sursa

Update detect.py

Sam Green 5 ani în urmă
părinte
comite
f40ff128b5

+ 7 - 0
platform/iphone/app_delegate.h

@@ -28,13 +28,20 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
+#if defined(OPENGL_ENABLED)
 #import "gl_view.h"
+#endif
 #import "view_controller.h"
 #import <UIKit/UIKit.h>
 
 #import <CoreMotion/CoreMotion.h>
 
+#if defined(OPENGL_ENABLED)
 @interface AppDelegate : NSObject <UIApplicationDelegate, GLViewDelegate> {
+#endif
+#if defined(VULKAN_ENABLED)
+@interface AppDelegate : NSObject <UIApplicationDelegate> {
+#endif
 	//@property (strong, nonatomic) UIWindow *window;
 	ViewController *view_controller;
 	bool is_focus_out;

+ 14 - 2
platform/iphone/app_delegate.mm

@@ -32,7 +32,9 @@
 
 #include "core/project_settings.h"
 #include "drivers/coreaudio/audio_driver_coreaudio.h"
+#if defined(OPENGL_ENABLED)
 #import "gl_view.h"
+#endif
 #include "main/main.h"
 #include "os_iphone.h"
 
@@ -412,10 +414,12 @@ static void on_focus_in(ViewController *view_controller, bool *is_focus_out) {
 OS::VideoMode _get_video_mode() {
 	int backingWidth;
 	int backingHeight;
+#if defined(OPENGL_ENABLED)
 	glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
 			GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
 	glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
 			GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+#endif
 
 	OS::VideoMode vm;
 	vm.fullscreen = true;
@@ -426,7 +430,7 @@ OS::VideoMode _get_video_mode() {
 };
 
 static int frame_count = 0;
-- (void)drawView:(GLView *)view;
+- (void)drawView:(UIView *)view;
 {
 
 	switch (frame_count) {
@@ -634,6 +638,7 @@ static int frame_count = 0;
 		return FALSE;
 	};
 
+#if defined(OPENGL_ENABLED)
 	// WARNING: We must *always* create the GLView after we have constructed the
 	// OS with iphone_main. This allows the GLView to access project settings so
 	// it can properly initialize the OpenGL context
@@ -642,7 +647,7 @@ static int frame_count = 0;
 
 	view_controller = [[ViewController alloc] init];
 	view_controller.view = glView;
-	window.rootViewController = view_controller;
+
 
 	_set_keep_screen_on(bool(GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true)) ? YES : NO);
 	glView.useCADisplayLink =
@@ -650,6 +655,13 @@ static int frame_count = 0;
 	printf("cadisaplylink: %d", glView.useCADisplayLink);
 	glView.animationInterval = 1.0 / kRenderingFrequency;
 	[glView startAnimation];
+#endif
+
+#if defined(VULKAN_ENABLED)
+	view_controller = [[ViewController alloc] init];
+#endif
+
+	window.rootViewController = view_controller;
 
 	// Show the window
 	[window makeKeyAndVisible];

+ 10 - 3
platform/iphone/detect.py

@@ -149,7 +149,7 @@ def configure(env):
                           '-framework', 'Foundation',
                           '-framework', 'GameController',
                           '-framework', 'MediaPlayer',
-                          '-framework', 'OpenGLES',
+                          '-framework', 'Metal',
                           '-framework', 'QuartzCore',
                           '-framework', 'Security',
                           '-framework', 'SystemConfiguration',
@@ -170,11 +170,18 @@ def configure(env):
         env.Append(CPPDEFINES=['ICLOUD_ENABLED'])
 
     env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
-                         '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
                          '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
                          ])
 
     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', 'GLES_ENABLED', 'COREAUDIO_ENABLED'])
+    env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'COREAUDIO_ENABLED'])
+
+    env.Append(CPPDEFINES=['VULKAN_ENABLED'])
+    env.Append(LINKFLAGS=['-framework', 'IOSurface'])
+    if (env['use_static_mvk']):
+        env.Append(LINKFLAGS=['-framework', 'MoltenVK'])
+        env['builtin_vulkan'] = False
+    elif not env['builtin_vulkan']:
+        env.Append(LIBS=['vulkan'])

+ 8 - 3
platform/iphone/os_iphone.cpp

@@ -38,7 +38,7 @@
 
 #if defined(VULKAN_ENABLED)
 #include "servers/visual/rasterizer_rd/rasterizer_rd.h"
-#import <QuartzCore/CAMetalLayer.h>
+// #import <QuartzCore/CAMetalLayer.h>
 #include <vulkan/vulkan_metal.h>
 #endif
 
@@ -110,6 +110,7 @@ int OSIPhone::get_current_video_driver() const {
 }
 
 Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+	video_driver_index = p_video_driver;
 
 #if defined(OPENGL_ENABLED)
 	bool gl_initialization_error = false;
@@ -130,15 +131,19 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
 	}
 #endif
 
-	video_driver_index = p_video_driver;
+#if defined(VULKAN_ENABLED)
+	RasterizerRD::make_current();
+#endif
+
+	
 	visual_server = memnew(VisualServerRaster);
 	// FIXME: Reimplement threaded rendering
 	if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
 		visual_server = memnew(VisualServerWrapMT(visual_server, false));
 	}
-
 	visual_server->init();
 	//visual_server->cursor_set_visible(false, 0);
+
 #if defined(OPENGL_ENABLED)
 	// reset this to what it should be, it will have been set to 0 after visual_server->init() is called
 	RasterizerStorageGLES2::system_fbo = gl_view_base_fb;

+ 5 - 0
platform/iphone/os_iphone.h

@@ -46,6 +46,11 @@
 #include "servers/visual/rasterizer.h"
 #include "servers/visual_server.h"
 
+#if defined(VULKAN_ENABLED)
+#include "drivers/vulkan/rendering_device_vulkan.h"
+#include "platform/iphone/vulkan_context_iphone.h"
+#endif
+
 class OSIPhone : public OS_Unix {
 
 private: