• Advertisement
Sign in to follow this  

Swap Chain Buffer Count

This topic is 1905 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

What exactly should I set for BufferCount in the DXGI_SWAP_CHAIN_DESC structure if I want double buffering? The SDK documentation sets this value to 1. But wouldn't that only create one buffer? Shouldn't I set this field to 2 if I want a front buffer and a back buffer? The docs say "you typically include the front buffer in this value". That has me a little confused... Edited by sunnysideup

Share this post


Link to post
Share on other sites
Advertisement
You should set

BufferCount = 2,

Sorry to contradict you here Stuntdk. If you read the MSDN documentation it says :


BufferCount
Type: UINT
A value that describes the number of buffers in the swap chain. When you call IDXGIFactory::CreateSwapChain to create a full-screen swap chain, you typically include the front buffer in this value. For more information about swap-chain buffers, see Remarks.
[/quote]

That implies that including the front buffer your BufferCount = 1, because you typically include the front buffer in this value. Also, if BufferCount was the back-buffer count, then you should be able to set it to zero, which you can't. If you try setting it to zero, your application will throw an invalid call exception. Edited by Gavin Williams

Share this post


Link to post
Share on other sites
I am by no means an expert, and still learning so I may stand corrected.
I got my information from reading Frank D. Luna "3D Game Programming With DirectX11".

He describes the BufferCount as the number of backbuffers, and throughout all his code use only the value of 1 (at least as far as I've gotten into it)
Could there perhaps be a difference whether you are using windowed or fullscreen mode?

Update:
Actually I just checked the RasterTek tutorials and Braynzar tutorials, and they both describe the BufferCount as the number of backbuffers and set it to 1 for double buffering.

I also see the somewhat conflicting explanation on MSDN, so hopefully an expert can explain some of this? Edited by Stuntdk

Share this post


Link to post
Share on other sites
The "front buffer" in this case is the buffer that is going to be presented at the next Present, so one buffer is enough. When using the discard swap flag, you'll probably just get new actual buffer-memory at Present while the frame that just finished drawing will be queued for presenting. The driver commonly buffers 3 frames ahead anyway, so in reality you should have more than enough buffering with 1 buffer. At least that's my take on it.
If you mess with the settings to override this behavior, and want to manually make sure you triple-buffer, then maybe you should make it 2..

Share this post


Link to post
Share on other sites
If you actually had a single memory buffer for the display you wouldn't call Present at all, and every pixel would be visible on the screen as it was drawn (after the vertical blank passed it). Like in DOS where you had a pointer to the screen memory buffer. I don't think D3D or DXGI exposes such functionality.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205075(v=vs.85).aspx has some more info under Presentation, which says there must always be a back-buffer and a front-buffer. Perhaps the documentation just has it wrong, depending on what the "front buffer" actually means.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement