locked
Orientation change during splashscreen result in wrong aspect/viewport

    Question

  • Hi, please,

    in our application (not game but use DirectX) a have problem that, if change device orientation during loading (splashscreen) it results in wrong render.

    The same effect is possible to achieve at samples (see attached screenshot of "XAML DirectX 3D shooting game sample"), it happens when turn (change landscape/portrait) device just after tap on app icon. Then render is squashed like it confuse between portrait/landscape.

    If I turn device after splash screen, it works correctly, but if I turn it during splash screen, it do something wrong with render and it stay wrong even after next orientation changes.

    I'm unable to say what exactly is wrong because vievport, camera aspect, back buffer size and all similar variables in debugger seems to be ok. Can it be something with XAML? What can I do to repair it?

    Thanks for any info.

    Monday, February 11, 2013 12:03 PM

All replies

  • Hi dan.gif,

    Does the issue only happen to specific page/app ? If so, could you please share a demo for us to investigate the issue? Thank you!

    Best regards,


    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 13, 2013 6:10 AM
    Moderator
  • It happens for all apps which I try, but I tried only apps where is Xaml+DirectX so which use SwapChainBackgroundPanel.
    Reproduce-ability depens on how long is there splash screen. (Longer loading means higher chance).
    When it happens it stay there for all pages.

    Screenshost is from http://code.msdn.microsoft.com/windowsapps/Metro-style-DirectX-18f98448

    Friday, February 15, 2013 8:46 AM
  • Hi,

    Thanks for the update.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
     
    Thank you for your understanding and support.


    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 15, 2013 9:50 AM
    Moderator
  • Hi,

    please, any change?

    Thanks.

    Tuesday, March 5, 2013 9:03 AM
  • Hi,

    You can use ApplicationView.Value to determine your app's orientation and perhaps rearrange the stuff - http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.viewmanagement.applicationview.value.aspx

    However, if that doesn't help, you can also look at DisplayProperties.CurrentOrientation to detect the screen's orientations and take a call - http://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.display.displayproperties.currentorientation.aspx


    Ashish Sahu [MSFT]


    Wednesday, March 6, 2013 6:47 PM
  • Sorry,

    but I don't understand what can I do about it. For me it looks like bug in SwapChainBackgroundPanel.

    There isn't problem in rearrange but that the SwapChainBackgroundPanel repaint only part of screen.
    Can you then repair the demo? (XAML DirectX 3D shooting game sample)

    Thank you very much.

    Thursday, March 7, 2013 8:43 AM
  • Hi,

    I have asked a few of my colleagues to try this out and we were never able to reproduce this issue on the Surface RT devices. What hardware are you using? Do you have any other hardware where you can try this?

    This might more than what we can do on the forums. Can you please open a support ticket so that we can give it due attention it needs. To open a ticket, go to http://getsupport.microsoft.com, select "Technical support for Windows Store app development" as problem type, select "DirectX and game" as the category and then choose a method that suits you best. You also have an option to pay for the ticket using your Store account other than a credit card and a contract ID.


    Ashish Sahu [MSFT]

    Friday, March 15, 2013 7:28 PM
  • I can reproduce this on my Surface RT. I took a video of it and uploaded it to my SkyDrive. You can view it/download it here: http://sdrv.ms/XI73Qe . Seeing it may help you reproduce it.

    When I add the following lines of code to App::OnWindowSizeChanged, the expected values are output even though the viewport displays the problems evident in the video:

    	auto v = ApplicationView::Value;
    	OutputDebugStringW(v.ToString()->Data());
    	OutputDebugStringW(L"\n");
    

    So when it switches to portrait on the initial rotation while the game is loading

    FullScreenPortrait

    is output to the console in Visual Studio. When I rotate it back to landscape then

    FullScreenLandscape

    is output to the console.

    Also, I've set breakpoints and all the values it is getting when it receives a window size change are correct (i.e. it's getting 1366x768 when it goes to landscape and 768x1366 when it goes to portrait). The only code error I found was that in DirectXBase::CreateWindowSizeDependentResources, the sample always creates the renderTargetViewDesc (line 467) with D3D11_RTV_DIMENSION_TEXTURE2DARRAY even though Feature Level 9.x devices do not support this. Nonetheless on the Surface RT no error is produced by the subsequent call to ID3D11Device::CreateRenderTargetView (likely because there is only 1 texture in the "array") and adding in the following code before calling CreateRenderTargetView does not resolve the problem:

    	if (m_featureLevel < D3D_FEATURE_LEVEL_10_0)
    	{
    		renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
    		renderTargetViewDesc.Texture2D.MipSlice = 0;
    	}
    
    

    It is much easier to reproduce the problem if you are remote debugging the app and you are using the Microsoft Symbol Servers (configured in VS2012 in TOOLS->Options->Debugging->Symbols) since fetching and loading the symbols (even when locally cached) will slow down the start up quite a bit such that it give you more time to rotate the device once the splash screen first appears.

    My best guess is that it's either a graphics driver error or an error in the OS. I don't have access to the source code for either so I couldn't tell you which it is.


    XNA/DirectX MVP | Website | Blog | @mikebmcl

    Saturday, March 16, 2013 6:26 AM
  • MikeBMcL: Thanks for the video and reproduce info.

    Please, is there some progress, or info about workaround?

    Monday, April 29, 2013 9:13 AM
  • What I cannot understand is: People from Microsoft seem not to care about obvious bugs. It's a shame...
    Monday, June 10, 2013 8:14 AM
  • There is a workaround. But don't use it because it can trigger another bug.

    But I want to show the workaround nevertheless.

    Just call DeactivateTemporarily() and then ReactivateFromTemporaryDeactivation():

    void TDirectX::DeactivateTemporarily() {
    
    	SetTheSwapChain(nullptr);
    }
    
    
    void TDirectX::ReactivateFromTemporaryDeactivation() {
    
    	SetTheSwapChain(m_swapChain.Get());
    }
    
    
    void TDirectX::SetTheSwapChain(IDXGISwapChain1* swapChain) {
    
    	ComPtr<ISwapChainBackgroundPanelNative> dxRootPanelAsSwapChainBackgroundPanel;
    
        reinterpret_cast<IUnknown*>(m_swapChainPanel)->QueryInterface(
            IID_PPV_ARGS(&dxRootPanelAsSwapChainBackgroundPanel)
            );
    
        DX::ThrowIfFailed(
            dxRootPanelAsSwapChainBackgroundPanel->SetSwapChain(swapChain)
            );
    }
    But as I said: There is another bug in Windows RT (not Windows 8 Core/Pro) which is triggered when you change the SwapChain. In few cases your app could freeze totally. So don't use this workaround. I only show it so maybe someone could find a better workaround.
    Monday, June 10, 2013 8:18 AM