Vulkan – Khronos' API for High-efficiency Graphics and Compute on GPUs
I encountered an interesting problem and couldn't find information online. After some time, I was able to fix it, but I still want to share it.
I was trying to get the code on https://vulkan-tutorial.com/ to run on android phones. Everything worked fine, but I only got around 45 fps on my device. Even rendering nothing didn't help. The fps were locked to around 45 only some spikes to 50-60fps.
Profiling showed me that vkQueuePresentKHR takes an average of 12ms.
After some research, I found a post talking about how changing minImageCount in VkSwapchainCreateInfoKHR influenced the fps if vsync was enabled.
I played around and it really chanced my fps. (All tests used VK_PRESENT_MODE_FIFO_KHR)
Using minImageCount of 2 resulted in 30 fps, minImageCount 3 gave me 45 fps and minImageCount of 4 60fps.
Changing MAX_FRAMES_IN_FLIGHT had no impact.
It made only a difference on my Samsung device. My OnePlus 8t had all the time 60 fps.
So, I've been following vulkan-tutorial.com, except I've been using the bindings to Vulkan in Julia, and have reached the stage where you should have a triangle in your window. My code returns no errors, but the window is blank. The shaders compiled successfully as far as I can tell.
My code: https://pastebin.com/3Z19tHW7