Merge pull request #6944 from stuartcarnie/sgc-metal

feat(Metal): Support vsync enable / disable
This commit is contained in:
Twinaphex 2018-07-04 19:08:01 +02:00 committed by GitHub
commit c8fc27099d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -29,6 +29,9 @@ typedef struct
@property (nonatomic, readonly) id<MTLLibrary> library;
@property (nonatomic, readwrite) MTLClearColor clearColor;
/*! @brief Specifies whether rendering is synchronized with the display */
@property (nonatomic, readwrite) bool displaySyncEnabled;
/*! @brief Returns the command buffer used for pre-render work,
* such as mip maps for applying filters
* */

View File

@ -60,6 +60,7 @@
_inflightSemaphore = dispatch_semaphore_create(MAX_INFLIGHT);
_device = d;
_layer = layer;
_layer.displaySyncEnabled = YES;
_library = l;
_commandQueue = [_device newCommandQueue];
_clearColor = MTLClearColorMake(0, 0, 0, 1);
@ -99,6 +100,16 @@
return self;
}
- (void)setDisplaySyncEnabled:(bool)displaySyncEnabled
{
_layer.displaySyncEnabled = displaySyncEnabled;
}
- (bool)displaySyncEnabled
{
return _layer.displaySyncEnabled;
}
- (bool)_initMainState
{
return YES;

View File

@ -75,8 +75,11 @@ static bool metal_frame(void *data, const void *frame,
info:video_info];
}
static void metal_set_nonblock_state(void *data, bool state)
static void metal_set_nonblock_state(void *data, bool non_block)
{
RARCH_LOG("[Metal]: set non block: %s\n", non_block ? "ON" : "OFF");
MetalDriver *md = (__bridge MetalDriver *)data;
md.context.displaySyncEnabled = !non_block;
}
static bool metal_alive(void *data)