Merge pull request #1927 from billhollings/demo-support-immediate-present-mode
Add support for VK_PRESENT_MODE_IMMEDIATE_KHR to macOS Cube demo.
This commit is contained in:
commit
0332055cff
@ -43,13 +43,29 @@
|
|||||||
|
|
||||||
self.view.wantsLayer = YES; // Back the view with a layer created by the makeBackingLayer method.
|
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*);
|
int argc = sizeof(argv)/sizeof(char*);
|
||||||
demo_main(&demo, self.view.layer, argc, argv);
|
demo_main(&demo, self.view.layer, argc, argv);
|
||||||
|
|
||||||
|
if (useDisplayLink) {
|
||||||
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
||||||
CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, &demo);
|
CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, &demo);
|
||||||
CVDisplayLinkStart(_displayLink);
|
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
|
Released TBD
|
||||||
|
|
||||||
- Ensure non-dispatch compute commands don't interfere with compute encoding state used by dispatch commands.
|
- 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() {
|
void MVKDevice::logPerformanceSummary() {
|
||||||
if (_activityPerformanceLoggingStyle == MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_IMMEDIATE) { return; }
|
|
||||||
|
|
||||||
// Get a copy to minimize time under lock
|
// Get a copy to minimize time under lock
|
||||||
MVKPerformanceStatistics perfStats;
|
MVKPerformanceStatistics perfStats;
|
||||||
|
@ -175,8 +175,10 @@ void MVKSwapchain::markFrameInterval() {
|
|||||||
perfLogCntLimit,
|
perfLogCntLimit,
|
||||||
(1000.0 / _device->_performanceStatistics.queue.frameInterval.averageDuration),
|
(1000.0 / _device->_performanceStatistics.queue.frameInterval.averageDuration),
|
||||||
mvkGetElapsedMilliseconds() / 1000.0);
|
mvkGetElapsedMilliseconds() / 1000.0);
|
||||||
|
if (mvkConfig().activityPerformanceLoggingStyle == MVK_CONFIG_ACTIVITY_PERFORMANCE_LOGGING_STYLE_FRAME_COUNT) {
|
||||||
_device->logPerformanceSummary();
|
_device->logPerformanceSummary();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MVK_MACOS
|
#if MVK_MACOS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user