mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-7170: added explicit @available for addPresentedHandler()
(cherry picked from commit 7973a4cff4)
This commit is contained in:
@@ -215,23 +215,6 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
// increment used drawables:
|
||||
self.nextDrawableCount++;
|
||||
|
||||
MTLDrawablePresentedHandler presentedHandler = nil;
|
||||
if (@available(macOS 10.15.4, *)) {
|
||||
if (self.perfCountersEnabled) {
|
||||
[self retain];
|
||||
presentedHandler = ^(id <MTLDrawable> drawable) {
|
||||
// note: called anyway even if drawable.present() not called!
|
||||
const CFTimeInterval presentedTime = drawable.presentedTime;
|
||||
if (presentedTime != 0.0) {
|
||||
[self countFramePresentedCallback];
|
||||
} else {
|
||||
[self countFrameDroppedCallback];
|
||||
}
|
||||
[self release];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
id <MTLBlitCommandEncoder> blitEncoder = [commandBuf blitCommandEncoder];
|
||||
|
||||
[blitEncoder
|
||||
@@ -243,8 +226,20 @@ BOOL MTLLayer_isExtraRedrawEnabled() {
|
||||
destinationOrigin:MTLOriginMake(0, 0, 0)];
|
||||
[blitEncoder endEncoding];
|
||||
|
||||
if (presentedHandler != nil) {
|
||||
[mtlDrawable addPresentedHandler:presentedHandler];
|
||||
if (@available(macOS 10.15.4, *)) {
|
||||
if (self.perfCountersEnabled) {
|
||||
[self retain];
|
||||
[mtlDrawable addPresentedHandler:^(id <MTLDrawable> drawable) {
|
||||
// note: called anyway even if drawable.present() not called!
|
||||
const CFTimeInterval presentedTime = drawable.presentedTime;
|
||||
if (presentedTime != 0.0) {
|
||||
[self countFramePresentedCallback];
|
||||
} else {
|
||||
[self countFrameDroppedCallback];
|
||||
}
|
||||
[self release];
|
||||
}];
|
||||
}
|
||||
}
|
||||
if (isDisplaySyncEnabled()) {
|
||||
[commandBuf presentDrawable:mtlDrawable];
|
||||
|
||||
Reference in New Issue
Block a user