multiple realtime graphics forms in own threads, global 60fps limit?
I'm using XNA and creating a bunch of forms that roll their own 'game loop' to handle drawing and such. Each new form is opened on its own thread, with a sub开发者_开发问答sequent Application.Run(form) to make the thread handle the messages for that form.
When I started I noticed that despite me not implementing any kind of frame limiting timing, the window drew at 60 fps. This was the number I was aiming for anyway so I left it at that.
However now I discovered that when I open multiple windows, the original 60 fps gets divided evenly between them: 2 windows 30 each, 3 20 each, etc.
I also tried a loop with Application.DoEvents instead of Application.Run, but with the same results.
Anyone know where this 60fps limit coming from, how to overcome it?
Go to your graphic driver settings window. Turn off VSYNC.
I'm not an XNA expert, but it sounds that you're being limited by vsync, did you check that?
You say "forms" which leads me to believe you are running in windows on the desktop and not using a dedicated full screen display?
I believe that with Vista and Windows 7, the desktop compositor ("dwm") handles all of the actual drawing. It probably runs at 60 fps (or less when on battery). I am not sure why it divides the FPS between the two windows, but it could be some interaction of locking between graphics calls.
You can't benefit from multi threading drawing calls to the GPU. The GPU, although very good at parallel processing in it's own right, interacts with the CPU one thing at a time only and everything is blocked until it finishes the task at hand. Two draw calls on one thread will take just as long as two Draw calls on separate threads. Actually slower because of threading overhead.
精彩评论