Fix Metal build

This commit is contained in:
Jean-André Santoni 2019-11-30 12:49:52 +07:00
parent f349784bd6
commit c0dfcd2adf
No known key found for this signature in database
GPG Key ID: 9D694E373914CC36
3 changed files with 68 additions and 100 deletions

View File

@ -40,33 +40,6 @@ extern MTLPixelFormat SelectOptimalPixelFormat(MTLPixelFormat fmt);
@interface MetalView : MTKView @interface MetalView : MTKView
@end @end
#ifdef HAVE_COCOA_METAL
@protocol ApplePlatform
/*! @brief renderView returns the current render view based on the viewType */
@property (readonly) id renderView;
/*! @brief isActive returns true if the application has focus */
@property (readonly) bool hasFocus;
@property (readwrite) apple_view_type_t viewType;
/*! @brief setVideoMode adjusts the video display to the specified mode */
- (void)setVideoMode:(gfx_ctx_mode_t)mode;
/*! @brief setCursorVisible specifies whether the cursor is visible */
- (void)setCursorVisible:(bool)v;
/*! @brief controls whether the screen saver should be disabled and
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
@end
extern id<ApplePlatform> apple_platform;
#endif
@interface FrameView : NSObject @interface FrameView : NSObject
@property(nonatomic, readonly) RPixelFormat format; @property(nonatomic, readonly) RPixelFormat format;

View File

@ -12,25 +12,43 @@
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep. /* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/ */
- (void)flagsChanged:(NSEvent *)event - (void)flagsChanged:(NSEvent *)event {
{
} }
- (void)keyDown:(NSEvent *)event - (void)keyDown:(NSEvent *)event {
{
} }
- (void)keyUp:(NSEvent *)event - (void)keyUp:(NSEvent *)event {
{
} }
@end @end
#endif
#if defined(HAVE_COCOA_METAL) @protocol ApplePlatform
/*! @brief renderView returns the current render view based on the viewType */
@property(readonly) id renderView;
/*! @brief isActive returns true if the application has focus */
@property(readonly) bool hasFocus;
@property(readwrite) apple_view_type_t viewType;
/*! @brief setVideoMode adjusts the video display to the specified mode */
- (void)setVideoMode:(gfx_ctx_mode_t)mode;
/*! @brief setCursorVisible specifies whether the cursor is visible */
- (void)setCursorVisible:(bool)v;
/*! @brief controls whether the screen saver should be disabled and
* the displays should not sleep.
*/
- (bool)setDisableDisplaySleep:(bool)disable;
@end
extern id<ApplePlatform> apple_platform;
id<ApplePlatform> apple_platform; id<ApplePlatform> apple_platform;
@interface RetroArch_OSX : NSObject <ApplePlatform, NSApplicationDelegate> @interface RetroArch_OSX : NSObject<ApplePlatform, NSApplicationDelegate> {
{
NSWindow *_window; NSWindow *_window;
apple_view_type_t _vt; apple_view_type_t _vt;
NSView *_renderView; NSView *_renderView;

View File

@ -41,29 +41,6 @@
#include "../../tasks/tasks_internal.h" #include "../../tasks/tasks_internal.h"
#include ".././verbosity.h" #include ".././verbosity.h"
#if defined(HAVE_COCOA_METAL)
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
@interface WindowListener : NSResponder<NSWindowDelegate>
@end
@implementation WindowListener
/* Similarly to SDL, we'll respond to key events by doing nothing so we don't beep.
*/
- (void)flagsChanged:(NSEvent *)event
{}
- (void)keyDown:(NSEvent *)event
{}
- (void)keyUp:(NSEvent *)event
{}
@end
#endif
static void app_terminate(void) static void app_terminate(void)
{ {
[[NSApplication sharedApplication] terminate:nil]; [[NSApplication sharedApplication] terminate:nil];