1
0
Fork 0

Update detect.py

This commit is contained in:
Sam Green 2020-02-21 21:42:34 -08:00
parent e03e607230
commit f40ff128b5
5 changed files with 44 additions and 8 deletions

View File

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

View File

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

View File

@ -149,7 +149,7 @@ def configure(env):
'-framework', 'Foundation', '-framework', 'Foundation',
'-framework', 'GameController', '-framework', 'GameController',
'-framework', 'MediaPlayer', '-framework', 'MediaPlayer',
'-framework', 'OpenGLES', '-framework', 'Metal',
'-framework', 'QuartzCore', '-framework', 'QuartzCore',
'-framework', 'Security', '-framework', 'Security',
'-framework', 'SystemConfiguration', '-framework', 'SystemConfiguration',
@ -170,11 +170,18 @@ def configure(env):
env.Append(CPPDEFINES=['ICLOUD_ENABLED']) env.Append(CPPDEFINES=['ICLOUD_ENABLED'])
env.Prepend(CPPPATH=['$IPHONESDK/usr/include', env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
'$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers',
'$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
]) ])
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
env.Prepend(CPPPATH=['#platform/iphone']) 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'])

View File

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

View File

@ -46,6 +46,11 @@
#include "servers/visual/rasterizer.h" #include "servers/visual/rasterizer.h"
#include "servers/visual_server.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 { class OSIPhone : public OS_Unix {
private: private: