Revert to original tDiff calculation, make frame-based tDiff calculation specific to iOS/macOS xcode examples project
This commit is contained in:
parent
121612857c
commit
17aaa7305b
1 changed files with 8 additions and 4 deletions
|
|
@ -255,7 +255,7 @@ VkPipelineShaderStageCreateInfo VulkanExampleBase::loadShader(std::string fileNa
|
||||||
|
|
||||||
void VulkanExampleBase::nextFrame()
|
void VulkanExampleBase::nextFrame()
|
||||||
{
|
{
|
||||||
//auto tStart = std::chrono::high_resolution_clock::now();
|
auto tStart = std::chrono::high_resolution_clock::now();
|
||||||
if (viewUpdated)
|
if (viewUpdated)
|
||||||
{
|
{
|
||||||
viewUpdated = false;
|
viewUpdated = false;
|
||||||
|
|
@ -265,9 +265,12 @@ void VulkanExampleBase::nextFrame()
|
||||||
render();
|
render();
|
||||||
frameCounter++;
|
frameCounter++;
|
||||||
auto tEnd = std::chrono::high_resolution_clock::now();
|
auto tEnd = std::chrono::high_resolution_clock::now();
|
||||||
// SRS - Calculate tDiff as time between frames vs. rendering time for Win32/macOS/iOS vsync portability
|
#if (defined(VK_USE_PLATFORM_IOS_MVK) || (defined(VK_USE_PLATFORM_MACOS_MVK) && !defined(VK_EXAMPLE_XCODE_GENERATED)))
|
||||||
//auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count();
|
// SRS - Calculate tDiff as time between frames vs. rendering time for iOS/macOS displayLink-driven examples project
|
||||||
auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tPrevEnd).count();
|
auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tPrevEnd).count();
|
||||||
|
#else
|
||||||
|
auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count();
|
||||||
|
#endif
|
||||||
frameTimer = (float)tDiff / 1000.0f;
|
frameTimer = (float)tDiff / 1000.0f;
|
||||||
camera.update(frameTimer);
|
camera.update(frameTimer);
|
||||||
if (camera.moving())
|
if (camera.moving())
|
||||||
|
|
@ -740,6 +743,7 @@ void VulkanExampleBase::prepareFrame()
|
||||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) {
|
if (result == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||||
windowResize();
|
windowResize();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VK_CHECK_RESULT(result);
|
VK_CHECK_RESULT(result);
|
||||||
|
|
@ -1750,7 +1754,7 @@ static CVReturn displayLinkOutputCallback(CVDisplayLinkRef displayLink, const CV
|
||||||
}
|
}
|
||||||
|
|
||||||
// SRS - Window resizing already handled by windowResize() in VulkanExampleBase::submitFrame()
|
// SRS - Window resizing already handled by windowResize() in VulkanExampleBase::submitFrame()
|
||||||
// - handling window resize events here is redundant and can cause interaction problems
|
// - handling window resize events here is redundant and can cause thread interaction problems
|
||||||
/*
|
/*
|
||||||
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue