XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

DXGI::SwapChain::ResizeTarget not working

Last post 17/07/2009 8:33 by Simon Kozlov. 4 replies.
  • 09/04/2009 1:26

    DXGI::SwapChain::ResizeTarget not working

    I've made progress with DXGI after struggling for 2 months now. However, I cannot get DXGI::SwapChain::ResizeTarget to do its job!

    Calling this method seems to have no effect on my application. I have been trying for months on figuring out a way to tell DXGI to use a given fullscreen resolution when switching from windowed back to fullscreen.

    If I set the DXGI_SWAP_CHAIN_FLAG_ALLOW flag, then DXGI will go one step up from the window's resolution, which is not my target resolution.

    If I set the flag to 0, DXGI will go to the current desktop resolution from before the application started.

    For instance - suppose I always want fullscreen to be 1280X768, however my desktop is set at 1280x1024. there seems to be no way to do it.

    I then tried calling ResizeTarget in both cases and the window remained the DXGI chosen size instead of my chosen size. A call to GetClientRect showed no change before and after. However, the method did not return a fail code.

    If anyone can come up with a way to tell DXGI to retain a windowed resolution and a fullscreen resolution to use when transitioning back and forth, please let me know.

    I noticed the DX10 samples also have the same troublesome behavior. When going from windowed to fullscreen they seem to change to the desktop resolution instead of the fullscreen resolution you started with.
  • 14/05/2009 15:01 In reply to

    Re: DXGI::SwapChain::ResizeTarget not working

    I am new to d3d 10 but maybe it is because of vista skin using directx too.
  • 09/06/2009 2:49 In reply to

    Re: DXGI::SwapChain::ResizeTarget not working

    Christopher Pisz:
    I've made progress with DXGI after struggling for 2 months now. However, I cannot get DXGI::SwapChain::ResizeTarget to do its job!

    Calling this method seems to have no effect on my application. I have been trying for months on figuring out a way to tell DXGI to use a given fullscreen resolution when switching from windowed back to fullscreen.

    Do you call ResizeTarget() when at fullscreen or before going to FS?
  • 09/06/2009 20:38 In reply to

    Re: DXGI::SwapChain::ResizeTarget not working

    If your windows "stretches" on fullscreen when using widescreen u need to set 2 flags to get the requested resolution on fullscreen

    swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_CENTERED;
    swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

    to switch from windowed to fullscreen and back i use this code:


    BOOL bFullscreen = FALSE;
    g_pRenderDevice->GetSwapChain()->GetFullscreenState( &bFullscreen, NULL );
    DXGI_SWAP_CHAIN_DESC scd;
    g_pRenderDevice->GetSwapChain()->GetDesc( &scd );
    g_pRenderDevice->GetSwapChain()->SetFullscreenState( !bFullscreen, NULL );
    g_pRenderDevice->GetSwapChain()->ResizeTarget( &scd.BufferDesc );

  • 17/07/2009 8:33 In reply to

    Re: DXGI::SwapChain::ResizeTarget not working

    Do I understand correctly that you want to make your application fullscreen with 1024x768 fullscreen resolution?

    Here's the way to do it in DXGI:
    1) Create swapchain with DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH set (otherwise, DXGI won't try to switch desktop resolutions)

    2) Call ResizeTarget with DXGI_MODE_DESC with Width = 1024, Height = 768 and everything else set to zero.

    DXGI_MODE_DESC desc;
    ZeroMemory(&desc, sizeof (desc));
    desc->Width = 1024;
    desc->Height = 768;

    pSwapChain->ResizeTarget(&desc);

    3) Finally, make swapchain go fullscreen:
    pSwapChain->SetFullscreenState(TRUE, pOutput);

    Now you should be in fullscreen and kicking with the right mode set (1024x768).
    Note that swapchains backbuffers are not necessary the same resolution (by default, they remained the same size as on swapchain creation), so you could still see lower resolution image in fullscreen.
    The right way to deal with it is calling ResizeBuffers with the right backbuffer resolution (in your case, 1024x768).

    4) pSwapChain->ResizeBuffers(backbuffercount, 1024, 768, backbufferformat, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH);

    In fact, it's recommended that app calls ResizeBuffers as a reaction to WM_SIZE message, which then would happen automatically on ResizeTarget/SetFullscrenState.

    Hope that helps.





Page 1 of 1 (5 items) Previous Next