Micro-optimize display link callback
Use a GCD block rather than a runtime selector with a boxed number
This commit is contained in:
parent
26ea343f95
commit
6a6b0b47a3
2 changed files with 3 additions and 12 deletions
|
|
@ -84,11 +84,9 @@
|
|||
CGDirectDisplayID displayID = entry->displayID;
|
||||
if (should_dispatch) entry->pending_dispatch = true;
|
||||
os_unfair_lock_unlock(lock);
|
||||
if (should_dispatch) {
|
||||
NSNumber *arg = [NSNumber numberWithUnsignedInt:displayID];
|
||||
[NSApp performSelectorOnMainThread:@selector(render_frame_received:) withObject:arg waitUntilDone:NO];
|
||||
[arg release];
|
||||
}
|
||||
if (should_dispatch) dispatch_async(dispatch_get_main_queue(), ^{
|
||||
_glfwDispatchRenderFrame(displayID);
|
||||
});
|
||||
}
|
||||
return kCVReturnSuccess;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -500,7 +500,6 @@ - (void)applicationDidHide:(NSNotification *)notification
|
|||
|
||||
@interface GLFWApplication : NSApplication
|
||||
- (void)tick_callback;
|
||||
- (void)render_frame_received:(id)displayIDAsID;
|
||||
@end
|
||||
|
||||
@implementation GLFWApplication
|
||||
|
|
@ -509,12 +508,6 @@ - (void)tick_callback
|
|||
_glfwDispatchTickCallback();
|
||||
}
|
||||
|
||||
- (void)render_frame_received:(id)displayIDAsID
|
||||
{
|
||||
CGDirectDisplayID displayID = [(NSNumber*)displayIDAsID unsignedIntValue];
|
||||
_glfwDispatchRenderFrame(displayID);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue