Archived

This topic is now archived and is closed to further replies.

Flipping or Discarding in windowed mode

This topic is 5652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently learning Direct3D 8 and I''ve come upon something that I find a bit odd. I have this simple windowed application. If I set the ''SwapEffect'' member of my presentation parameters structure to D3DSWAPEFFECT_FLIP, I get a higher frame rate than if I set it to D3DSWAPEFFECT_DISCARD. Why? Since the app is running in a window, aren''t both methods actually displaying a frame by copying it to the screen? Why is D3DSWAPEFFECT_FLIP faster then? Unless I misunderstood something, the Direct3D documentation seems to say that D3DSWAPEFFECT_DISCARD is normally faster.

Share this post


Link to post
Share on other sites
It depends. If you are building your application in debug mode using D3DSWAPEFFECT_DISCARD will be slower. When using D3DSWAPEFFECT_DISCARD you are telling the gfx card that you don''t need the information stored in any backbuffers. This means that the information in the backbuffer is considered invalid after a call to Present(). It might in some cases be valid though and if you read from the backbuffer, you might get correct results on some cards but not on others. Using D3DSWAPEFFECT_DISCARD in debug mode, makes Direct3D fill the backbuffers with garbage to prevent you from accidently reading valid data from the backbuffers. Filling the backbuffers with garbage takes time, and therefore using D3DSWAPEFFECT_DISCARD in debug mode will be slower. It should be faster if you build in release mode.



Real programmers don''t document, if it was hard to write it should be hard to understand


Share this post


Link to post
Share on other sites