★ wanayoo — archive 1999 https://github.com/Overv/VulkanTutorial/issues/166Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing window states using tutorial code freezes system for some time #166

Open
eligt opened this issue Feb 17, 2020 · 5 comments
Open

Changing window states using tutorial code freezes system for some time #166

eligt opened this issue Feb 17, 2020 · 5 comments

Comments

@eligt
Copy link

@eligt eligt commented Feb 17, 2020

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 #15

@eligt
Copy link
Author

@eligt eligt commented Feb 21, 2020

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);
	}
@eligt
Copy link
Author

@eligt eligt commented Mar 10, 2020

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.

@RussellHolgate
Copy link

@RussellHolgate RussellHolgate commented May 26, 2020

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.

@RussellHolgate
Copy link

@RussellHolgate RussellHolgate commented May 26, 2020

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.

@RussellHolgate
Copy link

@RussellHolgate RussellHolgate commented May 30, 2020

I tried using SDL2 instead of GLFW but the problem persists for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.