mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-03 07:33:29 +00:00
Added the simplest mechanism to decouple emulation from the display link queue.
This commit is contained in:
parent
9da7716c72
commit
a546277f88
@ -12,6 +12,7 @@
|
||||
|
||||
@implementation CSOpenGLView {
|
||||
CVDisplayLinkRef _displayLink;
|
||||
uint32_t _updateIsOngoing;
|
||||
}
|
||||
|
||||
- (void)prepareOpenGL
|
||||
@ -51,9 +52,15 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||
|
||||
- (void)drawAtTime:(const CVTimeStamp *)now
|
||||
{
|
||||
NSLog(@"%0.4f", (double)now->videoTime / (double)now->videoTimeScale);
|
||||
[self.delegate openGLView:self didUpdateToTime:*now];
|
||||
[self drawViewOnlyIfDirty:YES];
|
||||
const uint32_t activityMask = 0x01;
|
||||
if(!OSAtomicTestAndSet(activityMask, &_updateIsOngoing))
|
||||
{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
[self.delegate openGLView:self didUpdateToTime:*now];
|
||||
[self drawViewOnlyIfDirty:YES];
|
||||
OSAtomicTestAndClear(activityMask, &_updateIsOngoing);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
|
Loading…
x
Reference in New Issue
Block a user