diff --git a/gfx/drivers_context/macos_ctx.m b/gfx/drivers_context/macos_ctx.m new file mode 100644 index 0000000000..c4d6e7d3ad --- /dev/null +++ b/gfx/drivers_context/macos_ctx.m @@ -0,0 +1,889 @@ +// +// cocoa_ctx.m +// RetroArch +// +// Created by Stuart Carnie on 5/10/18. +// + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#if TARGET_OS_IPHONE +#include +#else +#include +#endif +#if defined(HAVE_COCOA) +#include +#include +#include +#include +#elif defined(HAVE_COCOATOUCH) +#include +#ifdef HAVE_AVFOUNDATION +#import +#endif +#endif + +#include +#include + +#import "../../ui/drivers/cocoa/cocoa_common.h" +#include "../video_driver.h" +#include "../../configuration.h" +#include "../../verbosity.h" +#ifdef HAVE_VULKAN +#include "../common/vulkan_common.h" +#endif +#if __has_feature(objc_arc) +#define BRIDGE __bridge +#else +#define BRIDGE +#endif + +#if defined(HAVE_COCOATOUCH) +#define GLContextClass EAGLContext +#define GLFrameworkID CFSTR("com.apple.opengles") +#define RAScreen UIScreen + +#ifndef UIUserInterfaceIdiomTV +#define UIUserInterfaceIdiomTV 2 +#endif + +#ifndef UIUserInterfaceIdiomCarPlay +#define UIUserInterfaceIdiomCarPlay 3 +#endif + +@interface EAGLContext (OSXCompat) @end +@implementation EAGLContext (OSXCompat) ++ (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; } +- (void)makeCurrentContext { [EAGLContext setCurrentContext:self]; } +@end + +#else + +@interface NSScreen (IOSCompat) @end +@implementation NSScreen (IOSCompat) +- (CGRect)bounds +{ + CGRect cgrect = NSRectToCGRect(self.frame); + return CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect)); +} +- (float) scale { return 1.0f; } +@end + +#define GLContextClass NSOpenGLContext +#define GLFrameworkID CFSTR("com.apple.opengl") +#define RAScreen NSScreen +#endif + +static enum gfx_ctx_api cocoagl_api = GFX_CTX_NONE; + +typedef struct cocoa_ctx_data +{ + bool core_hw_context_enable; +#ifdef HAVE_VULKAN + gfx_ctx_vulkan_data_t vk; + unsigned width; + unsigned height; + unsigned swap_interval; +#endif +} cocoa_ctx_data_t; + +#if defined(HAVE_COCOATOUCH) + +static GLKView *g_view; +UIView *g_pause_indicator_view; +#endif + +static GLContextClass* g_hw_ctx; +static GLContextClass* g_context; + +static int g_fast_forward_skips; +static bool g_is_syncing = true; +static bool g_use_hw_ctx = false; + +#if defined(HAVE_COCOA) +#include "../../ui/drivers/ui_cocoa.h" +static NSOpenGLPixelFormat* g_format; + +void *glcontext_get_ptr(void) +{ + return g_context; +} +#endif + +static unsigned g_minor = 0; +static unsigned g_major = 0; + +/* forward declaration */ +void *nsview_get_ptr(void); + +#if defined(HAVE_COCOATOUCH) +static void glkitview_init_xibs(void) +{ + /* iOS Pause menu and lifecycle. */ + UINib *xib = (UINib*)[UINib nibWithNibName:BOXSTRING("PauseIndicatorView") bundle:nil]; + g_pause_indicator_view = [[xib instantiateWithOwner:[RetroArch_iOS get] options:nil] lastObject]; +} +#endif + +void *glkitview_init(void) +{ +#if defined(HAVE_COCOATOUCH) + glkitview_init_xibs(); + + g_view = [GLKView new]; + g_view.multipleTouchEnabled = YES; + g_view.enableSetNeedsDisplay = NO; + [g_view addSubview:g_pause_indicator_view]; + + return (BRIDGE void *)((GLKView*)g_view); +#else + return nsview_get_ptr(); +#endif +} + +#if defined(HAVE_COCOATOUCH) +void cocoagl_bind_game_view_fbo(void) +{ +#ifdef HAVE_AVFOUNDATION + /* Implicitly initializes your audio session */ + AVAudioSession *audio_session = [AVAudioSession sharedInstance]; + [audio_session setCategory:AVAudioSessionCategoryAmbient error:nil]; + [audio_session setActive:YES error:nil]; +#endif + if (g_context) + [g_view bindDrawable]; +} +#endif + +static float get_from_selector(Class obj_class, id obj_id, SEL selector, CGFloat *ret) +{ + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: + [obj_class instanceMethodSignatureForSelector:selector]]; + [invocation setSelector:selector]; + [invocation setTarget:obj_id]; + [invocation invoke]; + [invocation getReturnValue:ret]; +#if __has_feature(objc_arc) +#else + [invocation release]; +#endif + return *ret; +} + +void *get_chosen_screen(void) +{ + settings_t *settings = config_get_ptr(); + NSArray *screens = [RAScreen screens]; + if (!screens || !settings) + return NULL; + + if (settings->uints.video_monitor_index >= screens.count) + { + RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead."); + return (BRIDGE void*)screens; + } + + return ((BRIDGE void*)[screens objectAtIndex:settings->uints.video_monitor_index]); +} + + +float get_backing_scale_factor(void) +{ + static float + backing_scale_def = 0.0f; + RAScreen *screen = NULL; + + (void)screen; + + if (backing_scale_def != 0.0f) + return backing_scale_def; + + backing_scale_def = 1.0f; +#ifdef HAVE_COCOA + screen = (BRIDGE RAScreen*)get_chosen_screen(); + + if (screen) + { + SEL selector = NSSelectorFromString(BOXSTRING("backingScaleFactor")); + if ([screen respondsToSelector:selector]) + { + CGFloat ret; + CocoaView *g_view = (CocoaView*)nsview_get_ptr(); + backing_scale_def = (float)get_from_selector + ([[g_view window] class], [g_view window], selector, &ret); + } + } +#endif + + return backing_scale_def; +} + +void cocoagl_gfx_ctx_update(void) +{ + if (cocoagl_api == GFX_CTX_VULKAN_API) { + return; + } + +#if defined(HAVE_COCOA) +#if MAC_OS_X_VERSION_10_7 + CGLUpdateContext(g_hw_ctx.CGLContextObj); + CGLUpdateContext(g_context.CGLContextObj); +#else + [g_hw_ctx update]; + [g_context update]; +#endif +#endif +} + +static void cocoagl_gfx_ctx_destroy(void *data) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + if (!cocoa_ctx) + return; + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + [GLContextClass clearCurrentContext]; + +#if defined(HAVE_COCOA) + [g_context clearDrawable]; + if (g_context) + [g_context release]; + g_context = nil; + if (g_format) + [g_format release]; + g_format = nil; + if (g_hw_ctx) + { + [g_hw_ctx clearDrawable]; + [g_hw_ctx release]; + } + g_hw_ctx = nil; +#endif + [GLContextClass clearCurrentContext]; + g_context = nil; + break; + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + vulkan_context_destroy(&cocoa_ctx->vk, cocoa_ctx->vk.vk_surface != VK_NULL_HANDLE); + if (cocoa_ctx->vk.context.queue_lock) { + slock_free(cocoa_ctx->vk.context.queue_lock); + } + memset(&cocoa_ctx->vk, 0, sizeof(cocoa_ctx->vk)); + +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + + free(cocoa_ctx); +} + +static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_driver) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*) + calloc(1, sizeof(cocoa_ctx_data_t)); + + if (!cocoa_ctx) + return NULL; + + switch (cocoagl_api) + { + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (!vulkan_context_init(&cocoa_ctx->vk, VULKAN_WSI_MVK_MACOS)) + { + goto error; + } +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + + return cocoa_ctx; + +error: + cocoagl_gfx_ctx_destroy(&cocoa_ctx); + return NULL; +} + +static enum gfx_ctx_api cocoagl_gfx_ctx_get_api(void *data) +{ + return cocoagl_api; +} + +static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor) +{ + (void)data; + switch (api) + { +#if defined(HAVE_COCOATOUCH) + case GFX_CTX_OPENGL_ES_API: + break; +#elif defined(HAVE_COCOA) + case GFX_CTX_OPENGL_API: + break; +#ifdef HAVE_VULKAN + case GFX_CTX_VULKAN_API: + break; +#endif +#endif + case GFX_CTX_NONE: + default: + return false; + } + + cocoagl_api = api; + g_minor = minor; + g_major = major; + + return true; +} + +static void cocoagl_gfx_ctx_swap_interval(void *data, unsigned interval) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + { +#if defined(HAVE_COCOATOUCH) // < No way to disable Vsync on iOS? + // Just skip presents so fast forward still works. + g_is_syncing = interval ? true : false; + g_fast_forward_skips = interval ? 0 : 3; +#elif defined(HAVE_COCOA) + GLint value = interval ? 1 : 0; + [g_context setValues:&value forParameter:NSOpenGLCPSwapInterval]; +#endif + break; + } + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + if (cocoa_ctx->swap_interval != interval) + { + cocoa_ctx->swap_interval = interval; + if (cocoa_ctx->vk.swapchain) + { + cocoa_ctx->vk.need_new_swapchain = true; + } + } +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + +} + +static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) +{ + (void)data; + +#ifdef HAVE_COCOA + if (state) + [NSCursor unhide]; + else + [NSCursor hide]; +#endif +} + +static bool cocoagl_gfx_ctx_set_video_mode(void *data, + video_frame_info_t *video_info, + unsigned width, unsigned height, bool fullscreen) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + cocoa_ctx->width = width; + cocoa_ctx->height = height; + +#if defined(HAVE_COCOA) + CocoaView *g_view = (CocoaView*)nsview_get_ptr(); +#endif + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + { +#if defined(HAVE_COCOA) + if ([g_view respondsToSelector: @selector(setWantsBestResolutionOpenGLSurface:)]) + [g_view setWantsBestResolutionOpenGLSurface:YES]; + + NSOpenGLPixelFormatAttribute attributes [] = { + NSOpenGLPFAColorSize, + 24, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAAllowOfflineRenderers, + NSOpenGLPFADepthSize, + (NSOpenGLPixelFormatAttribute)16, // 16 bit depth buffer + 0, /* profile */ + 0, /* profile enum */ + (NSOpenGLPixelFormatAttribute)0 + }; + +#if MAC_OS_X_VERSION_10_7 + if (g_major == 3 && (g_minor >= 1 && g_minor <= 3)) + { + attributes[6] = NSOpenGLPFAOpenGLProfile; + attributes[7] = NSOpenGLProfileVersion3_2Core; + } +#endif + +#if MAC_OS_X_VERSION_10_10 + if (g_major == 4 && g_minor == 1) + { + attributes[6] = NSOpenGLPFAOpenGLProfile; + attributes[7] = NSOpenGLProfileVersion4_1Core; + } +#endif + + g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + if (g_format == nil) + { + /* NSOpenGLFPAAllowOfflineRenderers is + not supported on this OS version. */ + attributes[3] = (NSOpenGLPixelFormatAttribute)0; + g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + } +#endif + + if (g_use_hw_ctx) + g_hw_ctx = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:nil]; + g_context = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:(g_use_hw_ctx) ? g_hw_ctx : nil]; + [g_context setView:g_view]; +#else + if (g_use_hw_ctx) + g_hw_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + g_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + g_view.context = g_context; +#endif + + [g_context makeCurrentContext]; + break; + } + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + RARCH_LOG("[macOS]: Native window size: %u x %u.\n", cocoa_ctx->width, cocoa_ctx->height); + if (!vulkan_surface_create(&cocoa_ctx->vk, VULKAN_WSI_MVK_MACOS, NULL, + g_view, cocoa_ctx->width, cocoa_ctx->height, + cocoa_ctx->swap_interval)) + { + RARCH_ERR("[macOS]: Failed to create surface.\n"); + return false; + } +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + +#if defined(HAVE_COCOA) + static bool has_went_fullscreen = false; + /* TODO: Screen mode support. */ + + if (fullscreen) + { + if (!has_went_fullscreen) + { + [g_view enterFullScreenMode:get_chosen_screen() withOptions:nil]; + cocoagl_gfx_ctx_show_mouse(data, false); + } + } + else + { + if (has_went_fullscreen) + { + [g_view exitFullScreenModeWithOptions:nil]; + [[g_view window] makeFirstResponder:g_view]; + cocoagl_gfx_ctx_show_mouse(data, true); + } + + [[g_view window] setContentSize:NSMakeSize(width, height)]; + } + + has_went_fullscreen = fullscreen; +#endif + + /* TODO: Maybe iOS users should be able to show/hide the status bar here? */ + + return true; +} + +float cocoagl_gfx_ctx_get_native_scale(void) +{ + static CGFloat ret = 0.0f; + SEL selector = NSSelectorFromString(BOXSTRING("nativeScale")); + RAScreen *screen = (BRIDGE RAScreen*)get_chosen_screen(); + + if (ret != 0.0f) + return ret; + if (!screen) + return 0.0f; + + if ([screen respondsToSelector:selector]) + return (float)get_from_selector([screen class], screen, selector, &ret); + + ret = 1.0f; + selector = NSSelectorFromString(BOXSTRING("scale")); + if ([screen respondsToSelector:selector]) + ret = screen.scale; + return ret; +} + +static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) +{ + float screenscale = cocoagl_gfx_ctx_get_native_scale(); +#if defined(HAVE_COCOA) + CGRect size; + GLsizei backingPixelWidth, backingPixelHeight; + CocoaView *g_view = (CocoaView*)nsview_get_ptr(); + CGRect cgrect = NSRectToCGRect([g_view frame]); +#if MAC_OS_X_VERSION_10_7 + SEL selector = NSSelectorFromString(BOXSTRING("convertRectToBacking:")); + if ([g_view respondsToSelector:selector]) + cgrect = NSRectToCGRect([g_view convertRectToBacking:[g_view bounds]]); +#endif + backingPixelWidth = CGRectGetWidth(cgrect); + backingPixelHeight = CGRectGetHeight(cgrect); + size = CGRectMake(0, 0, backingPixelWidth, backingPixelHeight); +#else + CGRect size = g_view.bounds; +#endif + *width = CGRectGetWidth(size) * screenscale; + *height = CGRectGetHeight(size) * screenscale; +} + +#if defined(HAVE_COCOA) +static void cocoagl_gfx_ctx_update_title(void *data, void *data2) +{ + ui_window_cocoa_t view; + const ui_window_t *window = ui_companion_driver_get_window_ptr(); + + view.data = (CocoaView*)nsview_get_ptr(); + + if (window) + { + char title[128]; + + title[0] = '\0'; + + video_driver_get_window_title(title, sizeof(title)); + + if (title[0]) + window->set_title(&view, title); + } +} +#endif + +static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type, + float *value) +{ + RAScreen *screen = (BRIDGE RAScreen*)get_chosen_screen(); +#if defined(HAVE_COCOA) + NSDictionary *description = [screen deviceDescription]; + NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue]; + CGSize display_physical_size = CGDisplayScreenSize( + [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); + + float display_width = display_pixel_size.width; + float display_height = display_pixel_size.height; + float physical_width = display_physical_size.width; + float physical_height = display_physical_size.height; + float scale = get_backing_scale_factor(); + float dpi = (display_width/ physical_width) * 25.4f * scale; +#elif defined(HAVE_COCOATOUCH) + float scale = cocoagl_gfx_ctx_get_native_scale(); + CGRect screen_rect = [screen bounds]; + float display_height = screen_rect.size.height; + float physical_width = screen_rect.size.width * scale; + float physical_height = screen_rect.size.height * scale; + float dpi = 160 * scale; + unsigned idiom_type = UI_USER_INTERFACE_IDIOM(); + + switch (idiom_type) + { + case -1: /* UIUserInterfaceIdiomUnspecified */ + /* TODO */ + break; + case UIUserInterfaceIdiomPad: + dpi = 132 * scale; + break; + case UIUserInterfaceIdiomPhone: + dpi = 163 * scale; + break; + case UIUserInterfaceIdiomTV: + case UIUserInterfaceIdiomCarPlay: + /* TODO */ + break; + } +#endif + + (void)display_height; + + switch (type) + { + case DISPLAY_METRIC_MM_WIDTH: + *value = physical_width; + break; + case DISPLAY_METRIC_MM_HEIGHT: + *value = physical_height; + break; + case DISPLAY_METRIC_DPI: + *value = dpi; + break; + case DISPLAY_METRIC_NONE: + default: + *value = 0; + return false; + } + + return true; +} + +static bool cocoagl_gfx_ctx_has_focus(void *data) +{ + (void)data; +#if defined(HAVE_COCOATOUCH) + return ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive); +#else + return [NSApp isActive]; +#endif +} + +static bool cocoagl_gfx_ctx_suppress_screensaver(void *data, bool enable) +{ + (void)data; + (void)enable; + + return false; +} + +#if !defined(HAVE_COCOATOUCH) +static bool cocoagl_gfx_ctx_has_windowed(void *data) +{ + return true; +} +#endif + +#ifdef HAVE_VULKAN +static void *cocoagl_gfx_ctx_get_context_data(void *data) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + return &cocoa_ctx->vk.context; +} +#endif + + +static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + if (!(--g_fast_forward_skips < 0)) + return; + +#if defined(HAVE_COCOA) + [g_context flushBuffer]; + [g_hw_ctx flushBuffer]; +#elif defined(HAVE_COCOATOUCH) + if (g_view) + [g_view display]; +#endif + + g_fast_forward_skips = g_is_syncing ? 0 : 3; + break; + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + vulkan_present(&cocoa_ctx->vk, cocoa_ctx->vk.context.current_swapchain_index); + vulkan_acquire_next_image(&cocoa_ctx->vk); +#endif + break; + case GFX_CTX_NONE: + default: + break; + } +} + +static gfx_ctx_proc_t cocoagl_gfx_ctx_get_proc_address(const char *symbol_name) +{ + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + return (gfx_ctx_proc_t)CFBundleGetFunctionPointerForName(CFBundleGetBundleWithIdentifier(GLFrameworkID), + (BRIDGE CFStringRef)BOXSTRING(symbol_name) + ); + case GFX_CTX_NONE: + default: + break; + } + + return NULL; +} + +static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + break; + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + cocoa_ctx->width = width; + cocoa_ctx->height = height; + + if (vulkan_create_swapchain(&cocoa_ctx->vk, width, height, cocoa_ctx->swap_interval)) + { + cocoa_ctx->vk.context.invalid_swapchain = true; + vulkan_acquire_next_image(&cocoa_ctx->vk); + } + else + { + RARCH_ERR("[macOS/Vulkan]: Failed to update swapchain.\n"); + return false; + } + + cocoa_ctx->vk.need_new_swapchain = false; +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + + return true; +} + + +static void cocoagl_gfx_ctx_check_window(void *data, bool *quit, + bool *resize, unsigned *width, unsigned *height, bool is_shutdown) +{ + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + unsigned new_width, new_height; + + *quit = false; + + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + break; + case GFX_CTX_VULKAN_API: +#ifdef HAVE_VULKAN + *resize = cocoa_ctx->vk.need_new_swapchain; +#endif + break; + case GFX_CTX_NONE: + default: + break; + } + + cocoagl_gfx_ctx_get_video_size(data, &new_width, &new_height); + if (new_width != *width || new_height != *height) + { + *width = new_width; + *height = new_height; + *resize = true; + } +} + +static void cocoagl_gfx_ctx_input_driver(void *data, + const char *name, + const input_driver_t **input, void **input_data) +{ + *input = NULL; + *input_data = NULL; +} + +static void cocoagl_gfx_ctx_bind_hw_render(void *data, bool enable) +{ + (void)data; + switch (cocoagl_api) + { + case GFX_CTX_OPENGL_API: + case GFX_CTX_OPENGL_ES_API: + g_use_hw_ctx = enable; + + if (enable) + [g_hw_ctx makeCurrentContext]; + else + [g_context makeCurrentContext]; + break; + case GFX_CTX_NONE: + default: + break; + } +} + +static uint32_t cocoagl_gfx_ctx_get_flags(void *data) +{ + uint32_t flags = 0; + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + BIT32_SET(flags, GFX_CTX_FLAGS_NONE); + + if (cocoa_ctx->core_hw_context_enable) + BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT); + + return flags; +} + +static void cocoagl_gfx_ctx_set_flags(void *data, uint32_t flags) +{ + (void)flags; + cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; + + if (BIT32_GET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT)) + cocoa_ctx->core_hw_context_enable = true; +} + +const gfx_ctx_driver_t gfx_ctx_cocoagl = { + .init = cocoagl_gfx_ctx_init, + .destroy = cocoagl_gfx_ctx_destroy, + .get_api = cocoagl_gfx_ctx_get_api, + .bind_api = cocoagl_gfx_ctx_bind_api, + .swap_interval = cocoagl_gfx_ctx_swap_interval, + .set_video_mode = cocoagl_gfx_ctx_set_video_mode, + .get_video_size = cocoagl_gfx_ctx_get_video_size, + .get_metrics = cocoagl_gfx_ctx_get_metrics, +#if defined(HAVE_COCOA) + .update_window_title = cocoagl_gfx_ctx_update_title, +#endif + .check_window = cocoagl_gfx_ctx_check_window, + .set_resize = cocoagl_gfx_ctx_set_resize, + .has_focus = cocoagl_gfx_ctx_has_focus, + .suppress_screensaver = cocoagl_gfx_ctx_suppress_screensaver, +#if !defined(HAVE_COCOATOUCH) + .has_windowed = cocoagl_gfx_ctx_has_windowed, +#endif + .swap_buffers = cocoagl_gfx_ctx_swap_buffers, + .input_driver = cocoagl_gfx_ctx_input_driver, + .get_proc_address = cocoagl_gfx_ctx_get_proc_address, + .ident = "macOS", + .get_flags = cocoagl_gfx_ctx_get_flags, + .set_flags = cocoagl_gfx_ctx_set_flags, + .bind_hw_render = cocoagl_gfx_ctx_bind_hw_render, + .get_context_data = cocoagl_gfx_ctx_get_context_data, +}; diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index 02ed545433..7cf8d9a2a8 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -28,7 +28,8 @@ #endif #if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) -#include "../gfx/drivers_context/cocoa_gl_ctx.m" +//#include "../gfx/drivers_context/cocoa_gl_ctx.m" +#include "../gfx/drivers_context/macos_ctx.m" #include "../ui/drivers/cocoa/cocoa_common.m" #if defined(HAVE_COCOATOUCH) diff --git a/pkg/apple/BaseConfig.xcconfig b/pkg/apple/BaseConfig.xcconfig new file mode 100644 index 0000000000..327ca6fb89 --- /dev/null +++ b/pkg/apple/BaseConfig.xcconfig @@ -0,0 +1,25 @@ +// +// BaseConfig.xcconfig +// RetroArch +// +// Created by Stuart Carnie on 5/10/18. +// +VULKAN_PACKAGE_PATH = /Volumes/Data/projects/frameworks/vulkan/moltenvk/Package + +// macOS +VULKAN_FRAMEWORK_PATH[sdk=macosx*] = $(VULKAN_PACKAGE_PATH)/$(CONFIGURATION)/MoltenVK/macOS + + +// general +FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(inherited) $(LOCAL_LIBRARY_DIR)/Frameworks $(VULKAN_FRAMEWORK_PATH) +LIBRARY_SEARCH_PATHS[sdk=macosx*] = $(inherited) $(VULKAN_FRAMEWORK_PATH) + +// OTHER_LDFLAGS = $(inherited) -lMoltenVK -framework MoltenVK + +OTHER_CFLAGS = $(inherited) -DHAVE_RUNAHEAD -DHAVE_GRIFFIN -DHAVE_FLAC -DHAVE_DR_FLAC -DHAVE_DR_MP3 -DHAVE_LROUND -DFLAC__HAS_OGG=0 -DHAVE_CHD -DHAVE_STB_VORBIS -DHAVE_MINIUPNPC -DHAVE_BUILTINMINIUPNPC -DHAVE_UPDATE_ASSETS -DHAVE_LANGEXTRA -DHAVE_CHEEVOS -DHAVE_IMAGEVIEWER -DHAVE_IOHIDMANAGER -DHAVE_CORETEXT -DHAVE_RGUI -DHAVE_MENU -DOSX -DHAVE_OPENGL -DHAVE_CC_RESAMPLER -DHAVE_GLSL -DINLINE=inline -D__LIBRETRO__ -DHAVE_COREAUDIO -DHAVE_DYNAMIC -DHAVE_OVERLAY -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_COCOA -DHAVE_MAIN -DHAVE_NETWORKGAMEPAD -DHAVE_NETWORKING -DRARCH_INTERNAL -DHAVE_THREADS -DHAVE_DYLIB -DHAVE_7ZIP -DHAVE_MATERIALUI -DHAVE_HID -DHAVE_XMB -DHAVE_SEGA -DHAVE_SHADERPIPELINE -DHAVE_MMAP -DHAVE_LIBRETRODB -DHAVE_GETOPT_LONG -DHAVE_VULKAN -DHAVE_SLANG -DHAVE_GLSLANG -DHAVE_SPIRV_CROSS -DWANT_GLSLANG -DGLSLANG_OSINCLUDE_UNIX + +SRCBASE = $(SRCROOT)/../.. +DEPS_DIR = $(SRCBASE)/deps +HEADER_SEARCH_PATHS = $(inherited) $(SRCBASE) $(SRCBASE)/gfx/include $(SRCBASE)/libretro-common/include $(DEPS_DIR)/libFLAC/include $(DEPS_DIR)/7zip $(DEPS_DIR)/stb $(DEPS_DIR) $(DEPS_DIR)/SPIRV-Cross $(DEPS_DIR)/glslang $(DEPS_DIR)/glslang/glslang/glslang/Public $(DEPS_DIR)/glslang/glslang/glslang/MachineIndependent $(DEPS_DIR)/glslang/glslang/SPIRV $(DEPS_DIR)/glslang/glslang/glslang/OSDependent/Unix +CLANG_CXX_LANGUAGE_STANDARD=c++11 +LD_RUNPATH_SEARCH_PATHS = @executable_path diff --git a/pkg/apple/RetroArch.xcodeproj/project.pbxproj b/pkg/apple/RetroArch.xcodeproj/project.pbxproj index 73e4e0c3bf..f748f0376a 100644 --- a/pkg/apple/RetroArch.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch.xcodeproj/project.pbxproj @@ -3,10 +3,18 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ + 0569A1F420A76DF5000A89D5 /* libMoltenVK.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0569A1F120A76DAD000A89D5 /* libMoltenVK.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 05A8E23820A63CB40084ABDA /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A8E23720A63CB40084ABDA /* Metal.framework */; }; + 05A8E23A20A63CED0084ABDA /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A8E23920A63CED0084ABDA /* IOSurface.framework */; }; + 05A8E23C20A63CF50084ABDA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A8E23B20A63CF50084ABDA /* QuartzCore.framework */; }; + 05D7753520A567A400646447 /* griffin_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753320A5678300646447 /* griffin_cpp.cpp */; }; + 05D7753620A567A500646447 /* griffin_cpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753320A5678300646447 /* griffin_cpp.cpp */; }; + 05D7753720A567A700646447 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; + 05D7753820A567A800646447 /* griffin_glslang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05D7753420A5678400646447 /* griffin_glslang.cpp */; }; 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 500845251B89300700CE6073 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 500845261B89300700CE6073 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; @@ -35,6 +43,16 @@ /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ + 0536DF8D20A6BDAC00BBB67F /* Embed Libraries */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Libraries"; + runOnlyForDeploymentPostprocessing = 0; + }; 500845351B89300700CE6073 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -53,27 +71,108 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 841CBB831A8A33B60066E9F1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 7; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 841CBB871A8A34330066E9F1 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; - dstSubfolderSpec = 7; + dstSubfolderSpec = 6; files = ( + 0569A1F420A76DF5000A89D5 /* libMoltenVK.dylib in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0566E3A620A41B670088249A /* dynamic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dynamic.h; path = ../../dynamic.h; sourceTree = ""; }; + 0566E3A720A41B670088249A /* dynamic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dynamic.c; path = ../../dynamic.c; sourceTree = ""; }; + 0566E3A820A41D4C0088249A /* frontend_driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = frontend_driver.c; path = ../../frontend/frontend_driver.c; sourceTree = ""; }; + 0566E3A920A41D4C0088249A /* frontend_driver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = frontend_driver.h; path = ../../frontend/frontend_driver.h; sourceTree = ""; }; + 0566E3AB20A41D4D0088249A /* frontend.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = frontend.c; path = ../../frontend/frontend.c; sourceTree = ""; }; + 0566E3AC20A41D4D0088249A /* frontend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = frontend.h; path = ../../frontend/frontend.h; sourceTree = ""; }; + 0569A1E820A6C25B000A89D5 /* core_type.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_type.h; path = ../../core_type.h; sourceTree = ""; }; + 0569A1E920A6C25C000A89D5 /* core_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_info.h; path = ../../core_info.h; sourceTree = ""; }; + 0569A1EA20A6C25C000A89D5 /* core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../core.h; sourceTree = ""; }; + 0569A1EB20A6C25C000A89D5 /* core_impl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = core_impl.c; path = ../../core_impl.c; sourceTree = ""; }; + 0569A1EC20A6C25C000A89D5 /* core_info.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = core_info.c; path = ../../core_info.c; sourceTree = ""; }; + 0569A1ED20A6C296000A89D5 /* retroarch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = retroarch.c; path = ../../retroarch.c; sourceTree = ""; }; + 0569A1EE20A6C296000A89D5 /* retroarch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = retroarch.h; path = ../../retroarch.h; sourceTree = ""; }; + 0569A1F120A76DAD000A89D5 /* libMoltenVK.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMoltenVK.dylib; path = ../../../../frameworks/vulkan/moltenvk/Package/Release/MoltenVK/macOS/libMoltenVK.dylib; sourceTree = ""; }; + 0575CEAE20A401AF0074E046 /* platform_darwin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = platform_darwin.m; path = ../../frontend/drivers/platform_darwin.m; sourceTree = ""; }; + 0575CEB120A401F90074E046 /* cgl_ctx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cgl_ctx.c; path = ../../gfx/drivers_context/cgl_ctx.c; sourceTree = ""; }; + 0575CEB220A401F90074E046 /* cocoa_gl_ctx.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = cocoa_gl_ctx.m; path = ../../gfx/drivers_context/cocoa_gl_ctx.m; sourceTree = ""; }; + 0575CEB320A403220074E046 /* android_ctx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = android_ctx.c; path = ../../gfx/drivers_context/android_ctx.c; sourceTree = ""; }; + 0575CEB420A4034B0074E046 /* wgl_ctx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = wgl_ctx.c; path = ../../gfx/drivers_context/wgl_ctx.c; sourceTree = ""; }; + 0575CEB520A403830074E046 /* video_driver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = video_driver.h; path = ../../gfx/video_driver.h; sourceTree = ""; }; + 0575CEB620A403830074E046 /* video_driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = video_driver.c; path = ../../gfx/video_driver.c; sourceTree = ""; }; + 0575CEB820A403C40074E046 /* gl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = gl.c; path = ../../gfx/drivers/gl.c; sourceTree = ""; }; + 0575CEB920A403CF0074E046 /* vulkan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = vulkan.c; path = ../../gfx/drivers/vulkan.c; sourceTree = ""; }; + 0575CEBB20A4047E0074E046 /* gl_common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = gl_common.c; path = ../../gfx/common/gl_common.c; sourceTree = ""; }; + 0575CEBC20A4047E0074E046 /* vulkan_common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = vulkan_common.h; path = ../../gfx/common/vulkan_common.h; sourceTree = ""; }; + 0575CEBD20A4047E0074E046 /* vulkan_common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = vulkan_common.c; path = ../../gfx/common/vulkan_common.c; sourceTree = ""; }; + 0575CEBE20A4047E0074E046 /* gl_common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = gl_common.h; path = ../../gfx/common/gl_common.h; sourceTree = ""; }; + 0575CEC020A404BB0074E046 /* shader_vulkan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = shader_vulkan.h; path = ../../gfx/drivers_shader/shader_vulkan.h; sourceTree = ""; }; + 0575CEC120A404BB0074E046 /* slang_process.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = slang_process.h; path = ../../gfx/drivers_shader/slang_process.h; sourceTree = ""; }; + 0575CEC220A404BB0074E046 /* slang_reflection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = slang_reflection.h; path = ../../gfx/drivers_shader/slang_reflection.h; sourceTree = ""; }; + 0575CEC320A404BB0074E046 /* shader_glsl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = shader_glsl.h; path = ../../gfx/drivers_shader/shader_glsl.h; sourceTree = ""; }; + 0575CEC420A404BB0074E046 /* slang_preprocess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = slang_preprocess.h; path = ../../gfx/drivers_shader/slang_preprocess.h; sourceTree = ""; }; + 0575CEC520A404BB0074E046 /* slang_reflection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = slang_reflection.cpp; path = ../../gfx/drivers_shader/slang_reflection.cpp; sourceTree = ""; }; + 0575CEC620A404BB0074E046 /* shader_gl_cg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = shader_gl_cg.c; path = ../../gfx/drivers_shader/shader_gl_cg.c; sourceTree = ""; }; + 0575CEC720A404BB0074E046 /* slang_preprocess.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = slang_preprocess.cpp; path = ../../gfx/drivers_shader/slang_preprocess.cpp; sourceTree = ""; }; + 0575CEC820A404BB0074E046 /* shader_null.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = shader_null.c; path = ../../gfx/drivers_shader/shader_null.c; sourceTree = ""; }; + 0575CEC920A404BB0074E046 /* glslang_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = glslang_util.h; path = ../../gfx/drivers_shader/glslang_util.h; sourceTree = ""; }; + 0575CECA20A404BB0074E046 /* glslang_util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = glslang_util.cpp; path = ../../gfx/drivers_shader/glslang_util.cpp; sourceTree = ""; }; + 0575CECB20A404BB0074E046 /* shader_vulkan.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = shader_vulkan.cpp; path = ../../gfx/drivers_shader/shader_vulkan.cpp; sourceTree = ""; }; + 0575CECC20A404BB0074E046 /* slang_process.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = slang_process.cpp; path = ../../gfx/drivers_shader/slang_process.cpp; sourceTree = ""; }; + 0575CECD20A404BB0074E046 /* shader_glsl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = shader_glsl.c; path = ../../gfx/drivers_shader/shader_glsl.c; sourceTree = ""; }; + 0575CECF20A405440074E046 /* ui_companion_driver.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ui_companion_driver.c; path = ../../ui/ui_companion_driver.c; sourceTree = ""; }; + 0575CED020A405440074E046 /* ui_companion_driver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_companion_driver.h; path = ../../ui/ui_companion_driver.h; sourceTree = ""; }; + 0575CED320A405580074E046 /* ui_cocoa_msg_window.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_msg_window.m; sourceTree = ""; }; + 0575CED420A405580074E046 /* cocoa_common.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = cocoa_common.m; sourceTree = ""; }; + 0575CED520A405580074E046 /* cocoatouch_menu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = cocoatouch_menu.m; sourceTree = ""; }; + 0575CED620A405580074E046 /* ui_cocoa_browser_window.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_browser_window.m; sourceTree = ""; }; + 0575CED720A405580074E046 /* ui_cocoa_window.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_window.m; sourceTree = ""; }; + 0575CED820A405580074E046 /* ui_cocoa_application.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ui_cocoa_application.m; sourceTree = ""; }; + 0575CED920A405580074E046 /* cocoa_common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cocoa_common.h; sourceTree = ""; }; + 0575CEDA20A4056D0074E046 /* ui_cocoa.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ui_cocoa.m; path = ../../ui/drivers/ui_cocoa.m; sourceTree = ""; }; + 0575CEDB20A4056D0074E046 /* ui_cocoatouch.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ui_cocoatouch.m; path = ../../ui/drivers/ui_cocoatouch.m; sourceTree = ""; }; + 0575CEDC20A4056D0074E046 /* ui_null.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = ui_null.c; path = ../../ui/drivers/ui_null.c; sourceTree = ""; }; + 0575CEDD20A4056D0074E046 /* ui_cocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ui_cocoa.h; path = ../../ui/drivers/ui_cocoa.h; sourceTree = ""; }; + 05A8E21C20A62FE20084ABDA /* vksym.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = vksym.h; path = ../../gfx/common/vksym.h; sourceTree = ""; }; + 05A8E21F20A639650084ABDA /* libretro_vulkan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = libretro_vulkan.h; path = "../../libretro-common/include/libretro_vulkan.h"; sourceTree = ""; }; + 05A8E22020A639650084ABDA /* libretro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = libretro.h; path = "../../libretro-common/include/libretro.h"; sourceTree = ""; }; + 05A8E22320A63BC20084ABDA /* vk_layer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vk_layer.h; sourceTree = ""; }; + 05A8E22420A63BC20084ABDA /* vk_icd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vk_icd.h; sourceTree = ""; }; + 05A8E22520A63BC20084ABDA /* vulkan_vi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_vi.h; sourceTree = ""; }; + 05A8E22620A63BC20084ABDA /* vulkan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan.h; sourceTree = ""; }; + 05A8E22720A63BC20084ABDA /* vk_platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vk_platform.h; sourceTree = ""; }; + 05A8E22820A63BC20084ABDA /* vulkan.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = vulkan.hpp; sourceTree = ""; }; + 05A8E22920A63BC20084ABDA /* vulkan_wayland.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_wayland.h; sourceTree = ""; }; + 05A8E22A20A63BC20084ABDA /* vulkan_win32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_win32.h; sourceTree = ""; }; + 05A8E22B20A63BC20084ABDA /* vulkan_macos.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_macos.h; sourceTree = ""; }; + 05A8E22C20A63BC20084ABDA /* vulkan_xlib_xrandr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_xlib_xrandr.h; sourceTree = ""; }; + 05A8E22D20A63BC20084ABDA /* vulkan_xcb.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_xcb.h; sourceTree = ""; }; + 05A8E22E20A63BC20084ABDA /* vulkan_mir.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_mir.h; sourceTree = ""; }; + 05A8E22F20A63BC20084ABDA /* vulkan_xlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_xlib.h; sourceTree = ""; }; + 05A8E23020A63BC20084ABDA /* vulkan_intel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_intel.h; sourceTree = ""; }; + 05A8E23120A63BC20084ABDA /* vulkan_ios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_ios.h; sourceTree = ""; }; + 05A8E23220A63BC20084ABDA /* vulkan_core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_core.h; sourceTree = ""; }; + 05A8E23320A63BC20084ABDA /* vk_sdk_platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vk_sdk_platform.h; sourceTree = ""; }; + 05A8E23420A63BC20084ABDA /* vulkan_android.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_android.h; sourceTree = ""; }; + 05A8E23620A63C130084ABDA /* vulkan_symbol_wrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vulkan_symbol_wrapper.h; sourceTree = ""; }; + 05A8E23720A63CB40084ABDA /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; + 05A8E23920A63CED0084ABDA /* IOSurface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOSurface.framework; path = System/Library/Frameworks/IOSurface.framework; sourceTree = SDKROOT; }; + 05A8E23B20A63CF50084ABDA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 05A8E24420A64AC60084ABDA /* wayland_ctx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = wayland_ctx.c; path = ../../gfx/drivers_context/wayland_ctx.c; sourceTree = ""; }; + 05A8E24520A656EA0084ABDA /* win32_common.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = win32_common.c; path = ../../gfx/common/win32_common.c; sourceTree = ""; }; + 05A8E24620A656EA0084ABDA /* win32_common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = win32_common.h; path = ../../gfx/common/win32_common.h; sourceTree = ""; }; + 05D7752F20A559B700646447 /* macos_ctx.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = macos_ctx.m; path = ../../gfx/drivers_context/macos_ctx.m; sourceTree = ""; }; + 05D7753120A55D2700646447 /* BaseConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = BaseConfig.xcconfig; sourceTree = ""; }; + 05D7753320A5678300646447 /* griffin_cpp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_cpp.cpp; path = ../../griffin/griffin_cpp.cpp; sourceTree = ""; }; + 05D7753420A5678400646447 /* griffin_glslang.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = griffin_glslang.cpp; path = ../../griffin/griffin_glslang.cpp; sourceTree = ""; }; + 05D7753920A5685500646447 /* Makefile.griffin */ = {isa = PBXFileReference; lastKnownFileType = text; name = Makefile.griffin; path = ../../Makefile.griffin; sourceTree = ""; }; + 05D7753A20A5685500646447 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../Makefile; sourceTree = ""; }; + 05D7753B20A5685500646447 /* Makefile.common */ = {isa = PBXFileReference; lastKnownFileType = text; name = Makefile.common; path = ../../Makefile.common; sourceTree = ""; }; 089C165DFE840E0CC02AAC07 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = OSX/en.lproj/InfoPlist.strings; sourceTree = ""; }; 1DDD58150DA1D0A300B32029 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = OSX/en.lproj/MainMenu.xib; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; @@ -114,6 +213,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 05A8E23C20A63CF50084ABDA /* QuartzCore.framework in Frameworks */, + 05A8E23A20A63CED0084ABDA /* IOSurface.framework in Frameworks */, + 05A8E23820A63CB40084ABDA /* Metal.framework in Frameworks */, 5061C8A41AE47E510080AE14 /* libz.dylib in Frameworks */, 84DD5EA91A89E4BE007336C1 /* CoreAudio.framework in Frameworks */, 84DD5EB31A89E6C0007336C1 /* AudioUnit.framework in Frameworks */, @@ -127,6 +229,195 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0575CEAC20A401960074E046 /* frontend */ = { + isa = PBXGroup; + children = ( + 0575CEAD20A401A00074E046 /* drivers */, + 0566E3A820A41D4C0088249A /* frontend_driver.c */, + 0566E3A920A41D4C0088249A /* frontend_driver.h */, + 0566E3AB20A41D4D0088249A /* frontend.c */, + 0566E3AC20A41D4D0088249A /* frontend.h */, + ); + name = frontend; + sourceTree = ""; + }; + 0575CEAD20A401A00074E046 /* drivers */ = { + isa = PBXGroup; + children = ( + 0575CEAE20A401AF0074E046 /* platform_darwin.m */, + ); + name = drivers; + sourceTree = ""; + }; + 0575CEAF20A401DB0074E046 /* gfx */ = { + isa = PBXGroup; + children = ( + 0575CEBA20A4046C0074E046 /* common */, + 0575CEB720A403B10074E046 /* drivers */, + 0575CEBF20A4049D0074E046 /* drivers_shader */, + 0575CEB020A401E90074E046 /* drivers_context */, + 05A8E22120A63BB00084ABDA /* include */, + 0575CEB620A403830074E046 /* video_driver.c */, + 0575CEB520A403830074E046 /* video_driver.h */, + ); + name = gfx; + sourceTree = ""; + }; + 0575CEB020A401E90074E046 /* drivers_context */ = { + isa = PBXGroup; + children = ( + 0575CEB320A403220074E046 /* android_ctx.c */, + 0575CEB120A401F90074E046 /* cgl_ctx.c */, + 0575CEB220A401F90074E046 /* cocoa_gl_ctx.m */, + 05D7752F20A559B700646447 /* macos_ctx.m */, + 05A8E24420A64AC60084ABDA /* wayland_ctx.c */, + 0575CEB420A4034B0074E046 /* wgl_ctx.c */, + ); + name = drivers_context; + sourceTree = ""; + }; + 0575CEB720A403B10074E046 /* drivers */ = { + isa = PBXGroup; + children = ( + 0575CEB820A403C40074E046 /* gl.c */, + 0575CEB920A403CF0074E046 /* vulkan.c */, + ); + name = drivers; + sourceTree = ""; + }; + 0575CEBA20A4046C0074E046 /* common */ = { + isa = PBXGroup; + children = ( + 0575CEBB20A4047E0074E046 /* gl_common.c */, + 0575CEBE20A4047E0074E046 /* gl_common.h */, + 05A8E21C20A62FE20084ABDA /* vksym.h */, + 0575CEBD20A4047E0074E046 /* vulkan_common.c */, + 0575CEBC20A4047E0074E046 /* vulkan_common.h */, + 05A8E24520A656EA0084ABDA /* win32_common.c */, + 05A8E24620A656EA0084ABDA /* win32_common.h */, + ); + name = common; + sourceTree = ""; + }; + 0575CEBF20A4049D0074E046 /* drivers_shader */ = { + isa = PBXGroup; + children = ( + 0575CECA20A404BB0074E046 /* glslang_util.cpp */, + 0575CEC920A404BB0074E046 /* glslang_util.h */, + 0575CEC620A404BB0074E046 /* shader_gl_cg.c */, + 0575CECD20A404BB0074E046 /* shader_glsl.c */, + 0575CEC320A404BB0074E046 /* shader_glsl.h */, + 0575CEC820A404BB0074E046 /* shader_null.c */, + 0575CECB20A404BB0074E046 /* shader_vulkan.cpp */, + 0575CEC020A404BB0074E046 /* shader_vulkan.h */, + 0575CEC720A404BB0074E046 /* slang_preprocess.cpp */, + 0575CEC420A404BB0074E046 /* slang_preprocess.h */, + 0575CECC20A404BB0074E046 /* slang_process.cpp */, + 0575CEC120A404BB0074E046 /* slang_process.h */, + 0575CEC520A404BB0074E046 /* slang_reflection.cpp */, + 0575CEC220A404BB0074E046 /* slang_reflection.h */, + ); + name = drivers_shader; + sourceTree = ""; + }; + 0575CECE20A405370074E046 /* ui */ = { + isa = PBXGroup; + children = ( + 0575CED120A405490074E046 /* drivers */, + 0575CECF20A405440074E046 /* ui_companion_driver.c */, + 0575CED020A405440074E046 /* ui_companion_driver.h */, + ); + name = ui; + sourceTree = ""; + }; + 0575CED120A405490074E046 /* drivers */ = { + isa = PBXGroup; + children = ( + 0575CED220A405580074E046 /* cocoa */, + 0575CEDD20A4056D0074E046 /* ui_cocoa.h */, + 0575CEDA20A4056D0074E046 /* ui_cocoa.m */, + 0575CEDB20A4056D0074E046 /* ui_cocoatouch.m */, + 0575CEDC20A4056D0074E046 /* ui_null.c */, + ); + name = drivers; + sourceTree = ""; + }; + 0575CED220A405580074E046 /* cocoa */ = { + isa = PBXGroup; + children = ( + 0575CED320A405580074E046 /* ui_cocoa_msg_window.m */, + 0575CED420A405580074E046 /* cocoa_common.m */, + 0575CED520A405580074E046 /* cocoatouch_menu.m */, + 0575CED620A405580074E046 /* ui_cocoa_browser_window.m */, + 0575CED720A405580074E046 /* ui_cocoa_window.m */, + 0575CED820A405580074E046 /* ui_cocoa_application.m */, + 0575CED920A405580074E046 /* cocoa_common.h */, + ); + name = cocoa; + path = ../../ui/drivers/cocoa; + sourceTree = ""; + }; + 05A8E21D20A639480084ABDA /* libretro-common */ = { + isa = PBXGroup; + children = ( + 05A8E21E20A639510084ABDA /* include */, + ); + name = "libretro-common"; + sourceTree = ""; + }; + 05A8E21E20A639510084ABDA /* include */ = { + isa = PBXGroup; + children = ( + 05A8E23520A63C130084ABDA /* vulkan */, + 05A8E21F20A639650084ABDA /* libretro_vulkan.h */, + 05A8E22020A639650084ABDA /* libretro.h */, + ); + name = include; + sourceTree = ""; + }; + 05A8E22120A63BB00084ABDA /* include */ = { + isa = PBXGroup; + children = ( + 05A8E22220A63BC20084ABDA /* vulkan */, + ); + name = include; + sourceTree = ""; + }; + 05A8E22220A63BC20084ABDA /* vulkan */ = { + isa = PBXGroup; + children = ( + 05A8E22320A63BC20084ABDA /* vk_layer.h */, + 05A8E22420A63BC20084ABDA /* vk_icd.h */, + 05A8E22520A63BC20084ABDA /* vulkan_vi.h */, + 05A8E22620A63BC20084ABDA /* vulkan.h */, + 05A8E22720A63BC20084ABDA /* vk_platform.h */, + 05A8E22820A63BC20084ABDA /* vulkan.hpp */, + 05A8E22920A63BC20084ABDA /* vulkan_wayland.h */, + 05A8E22A20A63BC20084ABDA /* vulkan_win32.h */, + 05A8E22B20A63BC20084ABDA /* vulkan_macos.h */, + 05A8E22C20A63BC20084ABDA /* vulkan_xlib_xrandr.h */, + 05A8E22D20A63BC20084ABDA /* vulkan_xcb.h */, + 05A8E22E20A63BC20084ABDA /* vulkan_mir.h */, + 05A8E22F20A63BC20084ABDA /* vulkan_xlib.h */, + 05A8E23020A63BC20084ABDA /* vulkan_intel.h */, + 05A8E23120A63BC20084ABDA /* vulkan_ios.h */, + 05A8E23220A63BC20084ABDA /* vulkan_core.h */, + 05A8E23320A63BC20084ABDA /* vk_sdk_platform.h */, + 05A8E23420A63BC20084ABDA /* vulkan_android.h */, + ); + name = vulkan; + path = ../../gfx/include/vulkan; + sourceTree = ""; + }; + 05A8E23520A63C130084ABDA /* vulkan */ = { + isa = PBXGroup; + children = ( + 05A8E23620A63C130084ABDA /* vulkan_symbol_wrapper.h */, + ); + name = vulkan; + path = "../../libretro-common/include/vulkan"; + sourceTree = ""; + }; 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( @@ -168,6 +459,7 @@ 29B97314FDCFA39411CA2CEA /* RetroArch */ = { isa = PBXGroup; children = ( + 05D7753120A55D2700646447 /* BaseConfig.xcconfig */, 840222FA1A889EA2009AB261 /* Core */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, @@ -176,6 +468,9 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, 5008453B1B89300700CE6073 /* Info.plist */, + 05D7753A20A5685500646447 /* Makefile */, + 05D7753B20A5685500646447 /* Makefile.common */, + 05D7753920A5685500646447 /* Makefile.griffin */, ); indentWidth = 3; name = RetroArch; @@ -186,6 +481,19 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( + 05A8E21D20A639480084ABDA /* libretro-common */, + 0575CECE20A405370074E046 /* ui */, + 0575CEAC20A401960074E046 /* frontend */, + 0575CEAF20A401DB0074E046 /* gfx */, + 0569A1EB20A6C25C000A89D5 /* core_impl.c */, + 0569A1EC20A6C25C000A89D5 /* core_info.c */, + 0569A1E920A6C25C000A89D5 /* core_info.h */, + 0569A1E820A6C25B000A89D5 /* core_type.h */, + 0569A1EA20A6C25C000A89D5 /* core.h */, + 0566E3A720A41B670088249A /* dynamic.c */, + 0566E3A620A41B670088249A /* dynamic.h */, + 0569A1ED20A6C296000A89D5 /* retroarch.c */, + 0569A1EE20A6C296000A89D5 /* retroarch.h */, ); name = "Other Sources"; sourceTree = ""; @@ -204,6 +512,10 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 0569A1F120A76DAD000A89D5 /* libMoltenVK.dylib */, + 05A8E23B20A63CF50084ABDA /* QuartzCore.framework */, + 05A8E23920A63CED0084ABDA /* IOSurface.framework */, + 05A8E23720A63CB40084ABDA /* Metal.framework */, 5061C8A31AE47E510080AE14 /* libz.dylib */, 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, @@ -216,6 +528,8 @@ children = ( 509F0C9C1AA23AFC00619ECC /* griffin_objc.m */, 840222FB1A889EE2009AB261 /* griffin.c */, + 05D7753320A5678300646447 /* griffin_cpp.cpp */, + 05D7753420A5678400646447 /* griffin_glslang.cpp */, ); name = Core; sourceTree = ""; @@ -257,8 +571,8 @@ 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, 8D11072E0486CEB800E47090 /* Frameworks */, - 841CBB831A8A33B60066E9F1 /* CopyFiles */, 841CBB871A8A34330066E9F1 /* CopyFiles */, + 0536DF8D20A6BDAC00BBB67F /* Embed Libraries */, ); buildRules = ( ); @@ -279,7 +593,7 @@ LastUpgradeCheck = 0640; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RetroArch" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -323,6 +637,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 05D7753820A567A800646447 /* griffin_glslang.cpp in Sources */, + 05D7753620A567A500646447 /* griffin_cpp.cpp in Sources */, 500845291B89300700CE6073 /* griffin_objc.m in Sources */, 5008452A1B89300700CE6073 /* griffin.c in Sources */, ); @@ -332,6 +648,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 05D7753720A567A700646447 /* griffin_glslang.cpp in Sources */, + 05D7753520A567A400646447 /* griffin_cpp.cpp in Sources */, 509F0C9D1AA23AFC00619ECC /* griffin_objc.m in Sources */, 840222FC1A889EE2009AB261 /* griffin.c in Sources */, ); @@ -433,26 +751,12 @@ ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(LOCAL_LIBRARY_DIR)/Frameworks", - ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../..", - "$(SRCROOT)/../../gfx/include", - "$(SRCROOT)/../../libretro-common/include", - "$(SRCROOT)/../../deps/libFLAC/include", - "$(SRCROOT)/../../deps/7zip", - "$(SRCROOT)/../../deps/stb", - "$(SRCROOT)/../../deps", - ); INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = RetroArch; }; @@ -464,24 +768,10 @@ ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(LOCAL_LIBRARY_DIR)/Frameworks", - ); GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; - HEADER_SEARCH_PATHS = ( - "$(SRCROOT)/../..", - "$(SRCROOT)/../../gfx/include", - "$(SRCROOT)/../../libretro-common/include", - "$(SRCROOT)/../../deps/libFLAC/include", - "$(SRCROOT)/../../deps/7zip", - "$(SRCROOT)/../../deps/stb", - "$(SRCROOT)/../../deps", - ); INFOPLIST_FILE = "$(SRCROOT)/OSX/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - MACOSX_DEPLOYMENT_TARGET = 10.5; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = RetroArch; }; @@ -489,64 +779,14 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 05D7753120A55D2700646447 /* BaseConfig.xcconfig */; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.11; ONLY_ACTIVE_ARCH = NO; - OTHER_CFLAGS = ( - "-DHAVE_RUNAHEAD", - "-DHAVE_GRIFFIN", - "-DHAVE_FLAC", - "-DHAVE_DR_FLAC", - "-DHAVE_DR_MP3", - "-DHAVE_LROUND", - "-DFLAC__HAS_OGG=0", - "-DHAVE_CHD", - "-DHAVE_STB_VORBIS", - "-DHAVE_MINIUPNPC", - "-DHAVE_BUILTINMINIUPNPC", - "-DHAVE_UPDATE_ASSETS", - "-DHAVE_LANGEXTRA", - "-DHAVE_CHEEVOS", - "-DHAVE_IMAGEVIEWER", - "-DHAVE_IOHIDMANAGER", - "-DHAVE_CORETEXT", - "-DHAVE_RGUI", - "-DHAVE_MENU", - "-DOSX", - "-DHAVE_OPENGL", - "-DHAVE_CC_RESAMPLER", - "-DHAVE_GLSL", - "-DINLINE=inline", - "-D__LIBRETRO__", - "-DHAVE_COREAUDIO", - "-DHAVE_DYNAMIC", - "-DHAVE_OVERLAY", - "-DHAVE_ZLIB", - "-DHAVE_RPNG", - "-DHAVE_RJPEG", - "-DHAVE_RBMP", - "-DHAVE_RTGA", - "-DHAVE_COCOA", - "-DHAVE_MAIN", - "-DHAVE_NETWORKGAMEPAD", - "-DHAVE_NETWORKING", - "-DRARCH_INTERNAL", - "-DHAVE_THREADS", - "-DHAVE_DYLIB", - "-DHAVE_7ZIP", - "-DHAVE_MATERIALUI", - "-DHAVE_HID", - "-DHAVE_XMB", - "-DHAVE_SEGA", - "-DHAVE_SHADERPIPELINE", - "-DHAVE_MMAP", - "-DHAVE_LIBRETRODB", - "-DHAVE_GETOPT_LONG", - ); PREBINDING = NO; SDKROOT = macosx; }; @@ -554,62 +794,12 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 05D7753120A55D2700646447 /* BaseConfig.xcconfig */; buildSettings = { GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = ( - "-DHAVE_RUNAHEAD", - "-DHAVE_GRIFFIN", - "-DHAVE_FLAC", - "-DHAVE_DR_FLAC", - "-DHAVE_DR_MP3", - "-DHAVE_LROUND", - "-DFLAC__HAS_OGG=0", - "-DHAVE_CHD", - "-DHAVE_STB_VORBIS", - "-DHAVE_MINIUPNPC", - "-DHAVE_BUILTINMINIUPNPC", - "-DHAVE_UPDATE_ASSETS", - "-DHAVE_LANGEXTRA", - "-DHAVE_CHEEVOS", - "-DHAVE_IMAGEVIEWER", - "-DHAVE_IOHIDMANAGER", - "-DHAVE_CORETEXT", - "-DHAVE_RGUI", - "-DHAVE_MENU", - "-DOSX", - "-DHAVE_OPENGL", - "-DHAVE_CC_RESAMPLER", - "-DHAVE_GLSL", - "-DINLINE=inline", - "-D__LIBRETRO__", - "-DHAVE_COREAUDIO", - "-DHAVE_DYNAMIC", - "-DHAVE_OVERLAY", - "-DHAVE_ZLIB", - "-DHAVE_RPNG", - "-DHAVE_RJPEG", - "-DHAVE_RBMP", - "-DHAVE_RTGA", - "-DHAVE_COCOA", - "-DHAVE_MAIN", - "-DHAVE_NETWORKGAMEPAD", - "-DHAVE_NETWORKING", - "-DRARCH_INTERNAL", - "-DHAVE_THREADS", - "-DHAVE_DYLIB", - "-DHAVE_7ZIP", - "-DHAVE_MATERIALUI", - "-DHAVE_HID", - "-DHAVE_XMB", - "-DHAVE_SEGA", - "-DHAVE_SHADERPIPELINE", - "-DHAVE_MMAP", - "-DHAVE_LIBRETRODB", - "-DHAVE_GETOPT_LONG", - ); + MACOSX_DEPLOYMENT_TARGET = 10.11; PREBINDING = NO; SDKROOT = macosx; }; diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index 4052a3d66a..b8183a2dba 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -101,6 +101,8 @@ void get_ios_version(int *major, int *minor); @end +CocoaView* recreate_cocoa_view(); + #endif #define BOXSTRING(x) [NSString stringWithUTF8String:x] diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 3c823d5a1c..625ea94941 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -19,6 +19,9 @@ #include "cocoa_common.h" #ifdef HAVE_COCOA #include "../ui_cocoa.h" +#ifdef HAVE_VULKAN +#import +#endif #endif #include @@ -50,6 +53,18 @@ void *nsview_get_ptr(void) { return g_instance; } + +CocoaView* recreate_cocoa_view() +{ + NSWindow* window = g_instance.window; + [g_instance removeFromSuperview]; + g_instance = nil; + [[CocoaView get] setFrame: [[window contentView] bounds]]; + [[window contentView] setAutoresizesSubviews:YES]; + [[window contentView] addSubview:[CocoaView get]]; + [window makeFirstResponder:[CocoaView get]]; + return [CocoaView get]; +} #endif /* forward declarations */ @@ -65,6 +80,29 @@ void *glkitview_init(void); cocoa_input_data_t *apple = (cocoa_input_data_t*)input_driver_get_data(); (void)apple; } + +#ifdef HAVE_VULKAN +/** Indicates that the view wants to draw using the backing layer instead of using drawRect:. */ +-(BOOL) wantsUpdateLayer +{ + return YES; +} + +/** Returns a Metal-compatible layer. */ ++(Class) layerClass +{ + return [CAMetalLayer class]; +} + +/** If the wantsLayer property is set to YES, this method will be invoked to return a layer instance. */ +-(CALayer*) makeBackingLayer +{ + CALayer* layer = [self.class.layerClass layer]; + CGSize viewScale = [self convertSizeToBacking: CGSizeMake(1.0, 1.0)]; + layer.contentsScale = MIN(viewScale.width, viewScale.height); + return layer; +} +#endif #endif + (CocoaView*)get @@ -83,6 +121,8 @@ void *glkitview_init(void); [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; ui_window_cocoa_t cocoa_view; cocoa_view.data = (CocoaView*)self; + //self.wantsLayer = YES; + [self registerForDraggedTypes:[NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil]]; #elif defined(HAVE_COCOATOUCH)