mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 03:40:24 +00:00
Merge pull request #6944 from stuartcarnie/sgc-metal
feat(Metal): Support vsync enable / disable
This commit is contained in:
commit
c8fc27099d
@ -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
|
||||
* */
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user