Choppy frame rate in DirectX/XAML application using SwapChainBackgroundPanel

Answered Choppy frame rate in DirectX/XAML application using SwapChainBackgroundPanel

  • mercoledì 8 agosto 2012 14:05
     
     
    Hello everybody. I am developing graphics app using DirectX & XAML (SwapChainBackgroundPanel type of interaction). I activated frame rate counter in XAML apps using this article and noticed strange thing. When I do nothing in my application the composition thread frame rate equals 0 and 3d model (simple sphere) is rendered with choppy frame rate. However, when I start to trigger Application Bar on and off composition thread frame rate becomes equal 46-49 and everything are rendered smoothly. How can I lock composition thread frame rate at 60 fps no matter if I interact with XAML UI or not?

Tutte le risposte

  • mercoledì 8 agosto 2012 18:02
     
     

    The built in frame rate counter only works for the XAML UI content. It can't display the frame rate of any custom DirectX content you're drawing in a SwapChainBackgroundPanel - you would have to write your own custom frame rate counter for that (as you would in any DX app) since your app fully controls the swap chain's presentation timing.

    In this case if the composition thread frame rate is showing 0, that likely means the XAML framework isn't producing any new content (because it doesn't have to if you're not updating any of the XAML UI - which helps perf and battery life).  When you show the AppBar that means XAML content is updating on screen, so the XAML frame rate will update during that period.

     

  • mercoledì 8 agosto 2012 19:08
     
     

    Thank you for reply, but can you provide information why 3d objects are rendered with higher frame rate when XAML content is updating? My investigation showed that this occurs when XAML UI is rendered without full H/W acceleration (in Virtual Box environment in my case).

  • mercoledì 8 agosto 2012 19:46
     
     

    When are you calling Present() on your swap chain?  Your app is responsible for the frame timing of all SwapChainBackgroundPanel content, so the XAML UI shouldn't have any direct effect on it.  The behavior you're seeing could occur if you're relying on XAML events to call Present() though.

    If you're able to share a minimal app to reproduce the issue (e.g. via SkyDrive) I can take a look.

  • mercoledì 8 agosto 2012 20:00
     
     
    I call Present() inside of CompositionTarget::Rendering event handler. Here I uploaded video which illustrates my words. I have used external camera in order to not affect program performance by the software screen capture solutions so sorry for bad video quality. As you can see from provided video, when I trigger the AppBar (00:04 - 00:23) the sphere is rendered with higher fps then when I don`t. I start to think that difference if fps exists because I call Present() inside of CompositionTarget::Rendering event handler. Am I right about it? If so, where I can call Present() except CompositionTarget::Rendering event handler?
  • giovedì 9 agosto 2012 15:51
     
     Con risposta

    It should be okay to call Present() inside of CompositionTarget::Rendering as long as you aren't doing too much processing on the UI thread.  Another option is to start your own thread and present from that.

    Are you able to test this outside VirtualBox so that hardware acceleration is enabled?  It may be related to your drivers in some way.  According to this: https://www.virtualbox.org/wiki/Guest_OSes

    Windows 8 may not be fully supported yet.

    • Contrassegnato come risposta RenGate giovedì 9 agosto 2012 17:50
    •  
  • giovedì 9 agosto 2012 17:50
     
     

    On real hardware (i5 2410M & GeForce GT540M) all work well, I get hight frame rate no matter if I interact with the UI. So if calling Present() from CompositionTarget::Rendering is ok than this is a problem related to the Virtual Box. Thank you for help.