As I wrote in an other thread, I am running my world and irrlicht in seperate threads. I want the world to run its own speed and let irrlicht draw the scene indepent of the word update cycle.
I figured, I dont need 3000 FPS, so I activated vsync in order to limit the amount of computation time, irrlicht requires. Now, I have a problem, the irrlicht thread does not yield its ressources in between frames. That meens, the world gets updated only once per frame, which was not the idea. Of course, I could take care of the synchronisation my self, but thats not particularly elegant. s there an option I have to activate in order to tell irrlicht to yield the thread if it is just waiting? Or is it in princliple not guild to do that?
Thx for your help,
Roland
edit: solved
[solved] What does Irrlicht do when vsync is activated?
[solved] What does Irrlicht do when vsync is activated?
Last edited by Roland on Tue Jun 12, 2012 12:13 pm, edited 1 time in total.
Re: What does Irrlicht do when vsync is activated?
Irrlicht uses this to set the corresponding flags to wait for a sync in the drivers. So D3DPRESENT_INTERVAL_ONE in DirectX and eglSwapInterval in OpenGL.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: What does Irrlicht do when vsync is activated?
And what does it do during waiting so that the thread does not yield its ressources?
while(wait){}; ?
while(wait){}; ?
Re: What does Irrlicht do when vsync is activated?
Sorry, you have to ask that the driver vendors. I think neither OpenGL nor DirectX do specify that (or at least I didn't find any comments about it in the documentation I've seen).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: What does Irrlicht do when vsync is activated?
The usual behavior is to sleep, but I wouldn't be surprised if it was a busy-wait in some drivers.
BTW are you running on a single core? Why would yielding matter nowadays?
BTW are you running on a single core? Why would yielding matter nowadays?
Re: What does Irrlicht do when vsync is activated?
vsync is to make a constant dynamic behavior in the scene; (if you limit to 60f/sec will be good);
Re: What does Irrlicht do when vsync is activated?
For my application, the gui is running independently of the core and takes only a fraction of the total computation power. Therefore, I want to give my "world" as much power as possible and not waste half the computation time on the GUI, waiting to take an other turn. On the other hand, I want both to run on independent speeds. I do not want either to depend on the other. Therefore, both run in sperated threads.
For games, the refreshrate should be as constant as possible and I just realised that the desired accuracy can not be provided by the sceduler of a general (= not realtime) OS. So its no wonder the driver makes a busy wait until the time has come to render an other frame. I was somehow hoping to find a "natural" solution for the waiting cycle, but I guess I have to do it manually. Its not importent for my application to have a absolut constant framerate, so I will use a manual sleep command using the boost library.
Thx everyone and cheers!
Roland
PS: Edith rephrased the text a it to make it more readable
For games, the refreshrate should be as constant as possible and I just realised that the desired accuracy can not be provided by the sceduler of a general (= not realtime) OS. So its no wonder the driver makes a busy wait until the time has come to render an other frame. I was somehow hoping to find a "natural" solution for the waiting cycle, but I guess I have to do it manually. Its not importent for my application to have a absolut constant framerate, so I will use a manual sleep command using the boost library.
Thx everyone and cheers!
Roland
PS: Edith rephrased the text a it to make it more readable
Re: What does Irrlicht do when vsync is activated?
I think Irrlicht does actually nothing, it just sends the data to the screen, and waits for the vertical syncronization signal to continue. Irrlicht isn't multithreaded, so i think it is safe to asume it just waits, and keeps all its resources locked, so you can't do anything with it during that time.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: What does Irrlicht do when vsync is activated?
@Mel: This hasn't to do much with Irrlicht at all. Irrlicht just passes the flag on to opengl and directX and they change their behavior when swapping buffers. As far as I can see this is happening inside driver code.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: What does Irrlicht do when vsync is activated?
Yes, the wait happens after the full scene is rendered and the back buffer is to be swapped into the front. This swap will be delayed until the blank has happened. The driver will return immediately, though, so you can do other things. Only if you want to render again, it will block at some point. First, those commands will queue up, though.