Advertisement

Update Resolution, Refresh rate and Multisampling without recreating swapchain in full-screen mode

Started by September 04, 2019 04:44 PM
1 comment, last by Adam_42 5 years ago

My application has a internal graphics settings panel that lets the user to change the graphics settings that includes all three options mentioned in the title including V-sync and windowed/fullscreen switching. My approach (given that it'll go full-screen to full-screen) to implement such system follows:

  1. Release all back buffer references.
  2. Go to windowed mode from full-screen using 
    
    swapchain->SetFullscreenState(FALSE, NULL)

     

  3. perform
    
    swapchain->Release();

     

  4. Prepare to recreate swapchain.
  5. Create new DXGI_SWAP_CHAIN_DESC from parameters collected from user settings panel
  6. perform 
    
    pFactory->CreateSwapChain(device, &swap_desc, &swapchain);

     

  7. Recreate the back buffer and views on success.
  8. Switch to full-screen using 
    
    swapchain->SetFullscreenState(TRUE, NULL);

     

Now, is it possible to just use the IDXGISwapChain::ResizeBuffers and IDXGISwapChain::ResizeTarget methods since those are dedicated for such tasks? Since those take Height, Width, DXGI_MODE_DESC it seems like it is possible to set new resolution and refresh rate using the the two above mentioned methods. Is there any risk here? And most importantly, I cannot find any way to update the swapchain's multisampling count and quality level without doing a fresh swapchain reset.

If you don't want to re-create the swapchain to change the multisampling settings, you can always work around that by doing some or more of your rendering to an off-screen buffer using multisampling (if it's enabled), and then copying the result to the swap chain after you've done everything that requires multisampling. For example, you could do the copy as part of a post-processing effect as you need to copy between render targets at that point anyway.

This topic is closed to new replies.

Advertisement