How can I reduce the full screen paging view latency in a UWP app?

I have a DirectX11 UWP app. I am creating a swap chain using IDXGIFactory2::CreateSwapChainForCoreWindow

both normal parameters.

::DXGI_SWAP_CHAIN_DESC1 desc{};
desc.Width              = back_buffer_width;
desc.Height             = back_buffer_height;
desc.Format             = DXGI_FORMAT_B8G8R8A8_UNORM;
desc.SampleDesc.Count   = 1;
desc.SampleDesc.Quality = 0;
desc.BufferUsage        = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.BufferCount        = 2;
desc.SwapEffect         = DXGI_SWAP_EFFECT_FLIP_DISCARD;
desc.Flags              = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH | DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
desc.Scaling            = DXGI_SCALING_NONE;
desc.AlphaMode          = DXGI_ALPHA_MODE_IGNORE;
::Microsoft::WRL::ComPtr< ::IDXGISwapChain1 > p_swap_chain;
Validate_OkResult
(
    p_dxgi_factory->CreateSwapChainForCoreWindow
    (
        p_d3d_device.Get()
    ,   reinterpret_cast< ::IUnknown * >(h_window) // passing ::Windows::UI::Core::CoreWindow ^
    ,   ::std::addressof(desc)
    ,   nullptr
    ,   &p_swap_chain
    )
);
Validate_OkResult(p_swap_chain->SetMaximumFrameLatency(1)); // 1 is minimum allowed value

      

When I try to change it to full screen by calling ::IDXGISwapChain::SetFullscreenState

, it fails with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE

and I get the following diagnostic:

DXGI ERROR: IDXGISwapChain :: SetFullscreenState: Core Window SwapChains cannot go fullscreen as they are considered to be permanently finished. [VARIOUS ERROR # 163:]

DXGI ERROR: IDXGISwapChain :: SetFullscreenState: Fullscreen is not available for modern applications. All swapchains must be windowed. [VARIOUS ERROR # 206:]

I figured out that I can switch fullscreen mode with ApplicationView

:

::Windows::UI::ViewManagement::ApplicationView ^ h_view(::Windows::UI::ViewManagement::ApplicationView::GetForCurrentView());
if(h_view->IsFullScreenMode)
{
    h_view->ExitFullScreenMode();
}
else
{
    h_view->TryEnterFullScreenMode();
}

      

However, this method only hides the taskbar, hides the window frame, and maximizes the window. I thought that when presenting a flip model in this case it should be possible to get the low latency benefits of regular full screen swap chains, but that doesn't seem like two works and the swap chain continues to build. Composite flip is still used for the view and the view timeout remains the same ~ 30ms as in windowed mode. Do I need to disable composition altogether or is there some other way to avoid the extra latency applied by composition?

+3


source to share


1 answer


After some experimentation, I was able to find a solution: disabling system overlays in addition to reversing the pointer will disable the composition in full screen mode, and the presentation will be performed as an independent flip. The following code should be added to the method implementation ::Windows::ApplicationModel::Core::IFrameworkView::SetWindow

:

::Windows::UI::Input::PointerVisualizationSettings ^ h_visualization_settings{::Windows::UI::Input::PointerVisualizationSettings::GetForCurrentView()};
h_visualization_settings->IsContactFeedbackEnabled = false;
h_visualization_settings->IsBarrelButtonFeedbackEnabled = false;
::Windows::UI::ViewManagement::ApplicationView ^ h_view{::Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()};
h_view->FullScreenSystemOverlayMode = ::Windows::UI::ViewManagement::FullScreenSystemOverlayMode::Minimal;

      



Note that it does not turn off the overlays completely, it just shows a little bar, you have to click first to display the corresponding overlay element like the taskbar.

0


source







All Articles