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

frame rate drops proportionally to number of process instances #67

Open
shnifer opened this issue May 3, 2018 · 5 comments
Open

frame rate drops proportionally to number of process instances #67

shnifer opened this issue May 3, 2018 · 5 comments

Comments

@shnifer
Copy link

shnifer commented May 3, 2018

Hello!
I added SwapInterval(1) to example/gl21-cube and it gives me a nice 60 fps. But if i run a second cube.exe at the same time they both show only 60/2=30 fps. Third instance drops fps to 60/3 = 20 and so on.
CPU and memory usage is under 30%.
What is the reason, and how can i fix it?

(my system: AMD Athlon II X4, Win 7, Radeon HD 7800 series)

@slimsag
Copy link
Member

slimsag commented May 3, 2018

  1. Where did you add the SwapInterval(1) call? Did you make any other modifications?
  2. Does the same happen if you make the same modification to gl41core-cube ?

@shnifer
Copy link
Author

shnifer commented May 4, 2018

i made two small modifications:

  1. SwapInterval(1) before main loop
  2. counter of fps, that print it once per second
	setupScene()
	tick:=time.Tick(time.Second)
	n:=0
	glfw.SwapInterval(1)
	for !window.ShouldClose() {
		select{
		case <-tick:
			log.Println(n)
			n=0
		default:
			n++
		}
		drawScene()
		window.SwapBuffers()
		glfw.PollEvents()
	}

i can not check gl41core-cube now. But problems with gl21-cube are important anyway, while gl2 is used by ebiten (and maybe some other engines)

@dmitshur
Copy link
Member

dmitshur commented May 4, 2018

I can't reproduce on macOS:

image

Perhaps it's an issue that affects Windows only. Or it could be something specific to your system (video card, drivers, etc.).

If you set vsync off with glfw.SwapInterval(0), what FPS do you get with just one cube instance? And multiple cube instances?

Maybe the slowdown you're seeing is just that your video card can't render multiple applications fast enough to maintain 60 FPS. It's a very simple example, so the performance should be good, but it is a possibility that you should verify.

@shnifer
Copy link
Author

shnifer commented May 4, 2018

With SwapInterval(0) (or just without this call at all) I got monstrous 4000-4500 "fps". If I run 4 instances fps drops to ~2500. Just 2 times slower, not 4 (while taking ~80% of CPU)
so performance of my system is not a key. Something is wrong with vsync in my context

@ManPython
Copy link

Yes it's some problem with this all - w7x64sp1.
Any progress here?

And next problem is that when moving window then animation is paused.

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

No branches or pull requests

4 participants