locked
DirectX Core App versus XAML + DirectX app

    General discussion

  • I recently tried both versions of porting my DirectX11 C++ engine to windows store apps.

    The first version involves creating the SwapChain yourself, and then rendering stuff, pretty straight forward if you're coming from a Win32 background as I do.

    The second option, with XAML involves something a bit weird : recreating the backbuffer render target AT EVERY FRAME. Seriously, why is this needed ?

    Initially I was like OK, let's see if this problem has a performance hit.

    And today I realized the performance penalty is around 40% (going from 50FPS with XAML to 70FPS without)  on my GTX 560 Ti for a 1920x1080 engine running 100+ dinstinct shaders in a scene, so it's a pretty heavy workload for the GPU. This is also on a Core i7 2600 so the CPU bottlenecking the performance is just out of the question. The XAML I had only involved 3 buttons and a TextBlock, so it wasn't all that heavy really.

    Now, the thing is that I wanted some windows 8 style buttons ontop of my app, to integrate well with the system, but if that's going to eat 40% of the performance I'd rather write some simple shaders to render squares and I'm done.

    Why has microsoft taken such a low-performance route though ?


    • Edited by dieinus Monday, November 26, 2012 4:37 AM
    • Changed type Jesse Jiang Monday, December 10, 2012 3:34 AM
    Monday, November 26, 2012 4:35 AM

All replies

  • Look at the Direct2D+XAML template app in VS2012. It uses a SwapChainBackgroundPanel and doesn't require recreating the render target each frame.
    Monday, November 26, 2012 12:49 PM
  • You may also take a look this blog titled "Combining XAML and DirectX" at http://blogs.msdn.com/b/windowsappdev/archive/2012/03/15/combining-xaml-and-directx.aspx.

    For a commercial Windows store app, XAML+DirectX may be the only way to go. A pure DirectX app using CoreWindow is useless, who need an app with no user interaction after all?

    Monday, November 26, 2012 3:02 PM
  • You may also take a look this blog titled "Combining XAML and DirectX" at http://blogs.msdn.com/b/windowsappdev/archive/2012/03/15/combining-xaml-and-directx.aspx.

    For a commercial Windows store app, XAML+DirectX may be the only way to go. A pure DirectX app using CoreWindow is useless, who need an app with no user interaction after all?

    I don't know where you got your info but I just checked and CoreWindow has event handlers you can set up from C++ code. There's a variable called PointerCursor which the documentation says it's used for both mouse arrow and touch device, and then you have something like this :

    window->PointerPressed += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Windows8App::OnPointerPressed); window->PointerMoved += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Windows8App::OnPointerMoved); window->PointerReleased += ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &Windows8App::OnPointerReleased);

    window->CharacterReceived += ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &Windows8App::CharacterReceived);

    So there you go, mouse/touch and keyboard input :)
       



    • Edited by dieinus Tuesday, November 27, 2012 12:41 PM
    Tuesday, November 27, 2012 12:33 PM
  • The pointer (mouse/touch/stylus) input is only useful when users are presented with XAML controls. Without XAML, how can you show an application about dialog to the users?
    Wednesday, November 28, 2012 4:33 PM
  • The pointer (mouse/touch/stylus) input is only useful when users are presented with XAML controls. Without XAML, how can you show an application about dialog to the users?
    I could simply render a polygon with text on top, would look like a dialog. So where's the problem, again? :) And I agree with Skyrape, XAML + D3D is slower than D3D.... sadly.
    Wednesday, November 28, 2012 9:06 PM
  • Yesterday I looked at a laptop with Core i3 and Windows 8. I clicked on the store app and man, it took ~1 minute to start. Now what does the store have that it takes so much to load ? Just an array of rectangles. Given the low performance I could make my own Windows 8 look-alike rendering library. It's just a bunch of rectangles in the end, and I wouldn't be surprised if someone makes this eventually.



    • Edited by dieinus Tuesday, December 04, 2012 12:25 AM
    Tuesday, December 04, 2012 12:24 AM
  • Yesterday I looked at a laptop with Core i3 and Windows 8. I clicked on the store app and man, it took ~1 minute to start. Now what does the store have that it takes so much to load ? Just an array of rectangles. Given the low performance I could make my own Windows 8 look-alike rendering library. It's just a bunch of rectangles in the end, and I wouldn't be surprised if someone makes this eventually.



    That's obviously due to some sort of internet problem or whatever, not any XAML or other GPU-related activity. My Metro app had several complex vertex and pixel shaders and it ran just fine on a Samsung Slate 7, which has a lower perf GPU than new Core CPUs.

    There are several valid complaints about WinRT you can make ... but rendering performance isn't one of them.

    Tuesday, December 04, 2012 4:43 AM
  • Hello,

    I would like to change this thread type as discussion, because I think there may be no exact answer for this question.

    Thanks for your understanding,

    Best regards,
    Jesse


    Jesse Jiang
    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.

    Monday, December 10, 2012 3:35 AM