DirectDraw: Can I keep the primary surface Locked?

464 Views Asked by At

I have a legacy game which uses DirectDraw2 which does its drawing into two buffers, a front and back, where the front is the primary surface (on-screen) and the back is an off-screen buffer. Now in the main loop it nicely Locks the front buffer, does its drawing to back and front, and then Unlocks again. However, in the same game the main menu code just keeps the front buffer locked the entire time.

Following these two seemingly contradictory observations, I have a couple of questions on Lock and Unlock, that are not answered by MSDN, nor by Google.

  • Can the video card display to the monitor whilst the front buffer is locked?
  • If it can, are there any benefits to unlocking again; assuming we don't intend to perform any hardware blits.
  • What happens if you Lock during a vsync update? Does it wait, or do you just get access to the buffer?
  • What determines the 'framerate', in terms of number of updates to the monitor. Is this every time Unlock is called, or does it just adhere to the screen refresh rate, independently of our locking/unlocking. In that case, do we get tearing?

I thought that it would work sort of like Direct3D, where you lock the vertex buffer, but need to unlock it before the GPU can work on it.

0

There are 0 best solutions below