I am following that great tutorial: vulkan-tutorial
And noticed strange behavior on the stage where some animation appears. To exclude my own mistakes I copy-pasted full code from that tutorial stage: code.cpp
Plus I changed 2 things:
- glm::perspective angle from 45 to 25, for more zoom
- inside chooseSwapPresentMode I commented if block so it unconditionally return VK_PRESENT_MODE_FIFO_KHR;
What is the problem actually:
With every PresentMode that limits framerate to 60 fps on my 60Hz monitor here is visible glitches, that looks like tearing, but I am not sure it is, because: I see not a single line break between top and bottom, but some artifacts in between, and it can be captured with OBS. Looks like present happens for the frame that is still in processing, not sure.
If I use any other PresentMode that gives 2000-5000 fps (depends on resolution), that effect is not visible. I thought that FIFO is designed to prevent tearing, and IMMEDIATE allows tearing. Not the other way around xD
I checked frame times that used to calculate rotate angle, they are all around 0.0166 seconds with minor deviation, so this is not a problem, rotate angle changes by the same amount every frame. I am not sure where the problem might be, but drawFrame() function with bunch of semaphores looks suspicious: is it ok there with imageAvailableSemaphores & renderFinishedSemaphores? If I add a bunch of excessive vkDeviceWaitIdle and/or vkQueueWaitIdle around draw and presentation (just for test purposes) that “tearing” effect almost disappears.
Here is recorded video for youtube: youtube video
Here is one screen with even less perspective angle and more resolution for better view:
Win10, NVidia GTX 1080Ti driver v452.06, i5 2500K.