Add support for VK_PRESENT_MODE_IMMEDIATE_KHR to macOS Cube demo.
- Only log performance stats on FPS logging if logging style is explicitly set to MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_FRAME_COUNT (unrelated).
This commit is contained in:
parent
2a4e415665
commit
107be116b7
@ -43,13 +43,29 @@
|
||||
|
||||
self.view.wantsLayer = YES; // Back the view with a layer created by the makeBackingLayer method.
|
||||
|
||||
const char* argv[] = { "cube" };
|
||||
// Enabling this will sync the rendering loop with the natural display link (60 fps).
|
||||
// Disabling this will allow the rendering loop to run flat out, limited only by the rendering speed.
|
||||
bool useDisplayLink = true;
|
||||
|
||||
VkPresentModeKHR vkPresentMode = useDisplayLink ? VK_PRESENT_MODE_FIFO_KHR : VK_PRESENT_MODE_IMMEDIATE_KHR;
|
||||
char vkPresentModeStr[64];
|
||||
sprintf(vkPresentModeStr, "%d", vkPresentMode);
|
||||
|
||||
const char* argv[] = { "cube", "--present_mode", vkPresentModeStr };
|
||||
int argc = sizeof(argv)/sizeof(char*);
|
||||
demo_main(&demo, self.view.layer, argc, argv);
|
||||
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
||||
CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, &demo);
|
||||
CVDisplayLinkStart(_displayLink);
|
||||
if (useDisplayLink) {
|
||||
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
||||
CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, &demo);
|
||||
CVDisplayLinkStart(_displayLink);
|
||||
} else {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
while(true) {
|
||||
demo_draw(&demo);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@ MoltenVK 1.2.5
|
||||
Released TBD
|
||||
|
||||
- Ensure non-dispatch compute commands don't interfere with compute encoding state used by dispatch commands.
|
||||
- Add support for `VK_PRESENT_MODE_IMMEDIATE_KHR` to macOS Cube demo.
|
||||
|
||||
|
||||
|
||||
|
@ -4114,7 +4114,6 @@ void MVKDevice::logActivityPerformance(MVKPerformanceTracker& activity, MVKPerfo
|
||||
}
|
||||
|
||||
void MVKDevice::logPerformanceSummary() {
|
||||
if (_activityPerformanceLoggingStyle == MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_IMMEDIATE) { return; }
|
||||
|
||||
// Get a copy to minimize time under lock
|
||||
MVKPerformanceStatistics perfStats;
|
||||
|
@ -175,7 +175,9 @@ void MVKSwapchain::markFrameInterval() {
|
||||
perfLogCntLimit,
|
||||
(1000.0 / _device->_performanceStatistics.queue.frameInterval.averageDuration),
|
||||
mvkGetElapsedMilliseconds() / 1000.0);
|
||||
_device->logPerformanceSummary();
|
||||
if (mvkConfig().activityPerformanceLoggingStyle == MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_FRAME_COUNT) {
|
||||
_device->logPerformanceSummary();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user