Open eligt opened 4 years ago
Adding this type of (awful) code to cap the frame rendering to 120 FPS fixes the freezes so maybe too many frames are sent in for rendering when you move/resize the window?
void mainLoop() {
auto now = std::chrono::system_clock::now();
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
drawFrame();
auto diff = std::chrono::system_clock::now() - now;
auto micros = std::chrono::duration_cast<std::chrono::microseconds>(diff);
//std::this_thread::sleep_for( std::chrono::microseconds(16600 - micros.count()) );
std::this_thread::sleep_for( std::chrono::microseconds(8200 - micros.count()) );
now = std::chrono::system_clock::now();
}
vkDeviceWaitIdle(device);
}
Just an extra note on this for anyone stumbling upon it: seems like switching the sample from GLFW to SDL2 fixed the freezes for me.
I was having the same issue running this in Manjaro with X11. I needed to add a 33200 microsecond delay to drag the window smoothly.
I should also mention that without the delay, I was getting a consistent validation error when resizing the window related to imageExtent being out of bounds on "16_swap_chain_recreation.cpp" before modifying the code.
I tried using SDL2 instead of GLFW but the problem persists for me.
Changing any window state, such as position, size, minimization, etc. causes the system to freeze for a certain amount of time, the time it freezes for seems to be directly related to the amount of time spent doing the window transformation (like move or resize).
This is on Lubuntu 18.04 x64 with kernel 5.2.8-050208-generic, with NVIDIA GeForce GTX 1060 using NVIDIA drivers version 435.21.
I'm using code from latest example, 29_multisampling.cpp and it happens both with/without validation layers enabled.
Might be related to https://github.com/Overv/VulkanTutorial/issues/15