Flipping Chain vs. Offscreen Surface

Started by
8 comments, last by JonW 21 years, 3 months ago
Hello, Are there any advantages of using Flip to double buffer, as opposed to just making an offscreen backbuffer and Blit-ing it to the primary surface? I wouldn't think you would notice any speed improvements. The reason I ask is a want to add a windowed mode to my game, and it would be easier to just use an offscreen surface all the time instead of managing both methods. Thanks in advance. [Edited by - JonW on February 20, 2008 1:45:40 PM]
Advertisement
hi,

first, i''m not sure that flip method''s allowed in windowed mode.
i''ll explain why....

The main difference between to use flip method and blitting method is performance.

when you blit your backbuffer on primary, you copy (!) the memory.
When you call flip function, DirectDraw just change pointer''adress between the primary and the backbuffer, ther''s no memory copied!

that''s why it increase performance, and that''s why i think you can''t use flip method in windowed mode, of course both surface must have same dimension.

anyway, refer to the official documentation, to fix it.

i hope that you understand me, with my so bad english i know that''s difficult....

i try to improve it !

++
VietCoder
ps: i remember that''s the equivalent method to the flip in windowed mode is some layer methods...i saw it when i used dx6.1, maybe u ca find better now.
Will I see any performance hit if I use Blit instead of Flip for fullscreen mode also?
The blitting will take more time than flipping, though the cards are so good at it now you might not notice the difference.

Flipping requires one DWORD to change. Blitting requires 786,432 DWORDs to change (for 1024x768x32).
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I think the more important issue is why are you finding it hard to manage both methods? It really shouldn''t be.
Thanks for the quick replies.

I don''t really mind managing two different methods, but it would be easier not to have to.

Something like this:

m_lpddsPrimary->BlitFast (m_lpddsBackBuffer, ...);

Is simpler than this:

if (m_bFullscreen)
m_lpddsPrimary->Flip (m_lppdsBackBuffer, ...);

else
m_lpddsPrimary->BlitFast (m_lpddsBackBuffer, ...);

But I guess that is not a very good example. The creation code would be longer

Oh well, call me lazy.
You should do both. Use offscreen surfaces for your bitmaps and when you whant your game to run smooth then flip surfaces and dont forget to use Cls().


p.s. You will have to create the function Cls() but it pretty simple and there are some tutorials on the net to do so

Kevin
Kevin
With page flipping you don''t have to copy anything, the back buffer becomes the front buffer instantly. This uses more memory, but this doesn''t matter anymore. Video card now have more ram then my whole computer a few years ago

in windowed mode you don''t have the whole frontbuffer to yourself so you have to copy. The VRAM runs at like 500MHZ DDR now so it doesn''t really matter!!! I get over 600 fps in 800x600x32bit windowed mode if not much is drawn. Also with the copy method you can alpha-blend the scene onto the front-buffer

They both use the same memory, two surfaces!
quote:Original post by JonWoyame
Will I see any performance hit if I use Blit instead of Flip for fullscreen mode also?


Just to reiterate, absolutely.

If you want a bit of extra performance, at the cost of a chunk of v.mem, look into triple buffering.

This topic is closed to new replies.

Advertisement