Hi,
Today I've been looking into a problem I have for some time now and which seems to be a pretty general problem if I google about it: serious mouselag when enabling VSync. I did some reading about it and I think I finally understand what is going wrong, although I still fail to fix the problem.
The cullprit is the Directx command buffer, which is sometimes filled a lot faster by the CPU than the GPU can follow. The frames the GPU outputs are thus lagging behind the CPU.
Looking into the Directx helpfiles it should be possible to flush the command buffers (I realise this is not something you should do in practice) by using a DirectX Event query, issue a D3DISSUE_END just before EndScene() and "while-looping" until the needed data for the current frame is available right after Present(). Though, this doesn't seem to work for me.
I created a very simple test program which creates a fullscreen app with D3DPRESENT_INTERVAL_FOUR as presentationinterval (the problem is very noticable here), it renders the hardware cursor and an "X" symbol which is rendered by the GPU ( and which should be on the same spot as the mousecursor). Moving the mouse around clearly shows the problem (the "X" lags behind the mouse).
A link to the the code (VS2008 solution) and executable are hosted here: http://docs.google.com/uc?id=0B0ndu...WFjN2QtYTJlNjAwMjFkYzdm&export=download&hl=nl
Perhaps someone here knows another way of purging the command buffer? Does anyone have experience with this problem and perhaps knows has a solution?
Thanks a lot in advance!
Bert.
Today I've been looking into a problem I have for some time now and which seems to be a pretty general problem if I google about it: serious mouselag when enabling VSync. I did some reading about it and I think I finally understand what is going wrong, although I still fail to fix the problem.
The cullprit is the Directx command buffer, which is sometimes filled a lot faster by the CPU than the GPU can follow. The frames the GPU outputs are thus lagging behind the CPU.
Looking into the Directx helpfiles it should be possible to flush the command buffers (I realise this is not something you should do in practice) by using a DirectX Event query, issue a D3DISSUE_END just before EndScene() and "while-looping" until the needed data for the current frame is available right after Present(). Though, this doesn't seem to work for me.
I created a very simple test program which creates a fullscreen app with D3DPRESENT_INTERVAL_FOUR as presentationinterval (the problem is very noticable here), it renders the hardware cursor and an "X" symbol which is rendered by the GPU ( and which should be on the same spot as the mousecursor). Moving the mouse around clearly shows the problem (the "X" lags behind the mouse).
A link to the the code (VS2008 solution) and executable are hosted here: http://docs.google.com/uc?id=0B0ndu...WFjN2QtYTJlNjAwMjFkYzdm&export=download&hl=nl
Perhaps someone here knows another way of purging the command buffer? Does anyone have experience with this problem and perhaps knows has a solution?
Thanks a lot in advance!
Bert.