locked
Working with DirectX9 and WinRT

    General discussion

  • This could be useful for somebody that needs to work on the migration of their game code while they are migrating their renderer to d3d11...

    We have manage to run on metro by linking and referencing directly the June 2010 SDK, for the create device call, use the foreground window as HWND.

    Monday, January 02, 2012 10:24 PM

All replies

  • That will indeed be very helpful if it works for us.  Trying to port a very large DirectX 9-based engine to Metro was looking rather gargantuan.  If we can get the DirectX 9 renderer in a Metro app, it will make the porting process a lot easier as other devs can then work on the Metro side of things while the poor soul doing the DirectX 11 port hacks away on his part rather than the DirectX 11 port being the roadblock to getting the game on Metro.
    Wednesday, January 04, 2012 2:29 AM
  • Direct3D9 and Direct3D9Ex are not supported for Metro style applications. Use of the DirectX SDK with Metro style applications is not recommended or supported. See http://msdn.microsoft.com/en-us/library/ee663275.aspx.

    There are a number of resources available to help you in porting a Direct3D 9 codebase to Direct3D 11. The majority of the material for porting from Direct3D 9 to Direct3D 10.x applies fully here since Direct3D 11's API is very similiar to Direct3D 10.

    See http://blogs.msdn.com/b/chuckw/archive/2011/07/11/getting-started-with-direct3d-11.aspx. Be sure to review the Windows to Reality: Getting the Most out of Direct3D 10 Graphics in Your Games presentation as it covers numerous pitfalls and performance issues developers have hit in the past, and DirectX 11 Technology Update for a summary of the differences between Direct3D 10.x and Direct3D 11.

    MSDN has a porting guide as well http://msdn.microsoft.com/en-us/library/ff476190.aspx which points you to http://msdn.microsoft.com/en-us/library/bb205073.aspx for going directly from Direct3D 9 to Direct3D 11.

    Wednesday, January 04, 2012 7:57 PM
  • Thanks Chuck, but note that this is not intended for developing game with d3d9, but avoid to have roadblockers while you migrate your existing engine to metro, this way for example as one team is migrating to d3d11, other team can be ripping out the win32 apis and c runtime and still be able to test the game.

     

    Note If I recall well, on the metro style game example documentation on the web it is mention that it can be also done with d3d9... clearly a documentation error

    Thursday, January 05, 2012 12:48 PM
  • Benjamin, you are spot-on with your reasons for this.  Having to port the entire codebase to DirectX 11.1 first is a major roadblock to the rest of the team.

    Are you able to share any more details on how you achieved this?  Did you start with the DirectX Application template and replace the contents of the D3DRenderer.cpp source file?

    Wednesday, January 11, 2012 5:35 AM
  • We started with our original d3d9 code, which correctly detect devices. The biggest difference to work that I remember are:

    - Get the HWND with getforegroundwindow of the win32 api (clearly this wouldn't be allowed on a metro app)

    - Include and link DIRECTLY to june2010 DirectX SDK, if you link with the one of VS2011 it will not start

     

     

    Thursday, January 12, 2012 10:21 PM
  • Note If I recall well, on the metro style game example documentation on the web it is mention that it can be also done with d3d9... clearly a documentation error

    Must be the "Feature Level 9" of DX11.

    Porting an cross-platform(opengl/d3d9) engine  to D3d11 is not very difficult. You only need to implement a renderer of d3d11 under the old framework.  Also need some shader code to replace fixed-func pipeline.


    C++ DX11

    Tuesday, April 03, 2012 7:00 AM
  • Porting the existing engine from DirectX9 to DirectX11.1 was one of the factors that killed our project.  It was very difficult with the way the engine had been written, and combined with several other limitations/restrictions that arose from trying to port a game from Xbox 360 to Windows 8 Metro, the project was cancelled.
    Tuesday, April 03, 2012 7:07 AM
  • Does this still hold true?
    Cannot we write Metro/DirectX apps in C# using the SlimDX wrapper and Direct3D9 ?
    What is the "unsupported" part? Does the certification not allow calls to the d3d9 assembly?

    thank you

    SB


    .: Stefano Baraldi, Ph.D. sb@tabulatouch.eu TabulaTouch.eu onTheTableTop.eu


    Monday, June 11, 2012 7:04 PM
  • The Direct3D 9 interface is not supported as "Safe for Metro" API. See API Reference for Metro style apps. In particular, see the Graphics / Win32 and COM section and you'll see that Direct2D, DirectWrite, DirectXMath, HLSL, and Windows Imaging Component are listed but Direct3D 9 is not.

    In general this means that the interface in question is not in the "APP" API family parition so the Metro headers do not define it, that attempts to create the interface while running in a Metro app will fail, that various parts of the interface may fail when run in a Metro app due to security boundaries, and/or the certification process will flag the app as using a unsupported, not safe-for-Metro API.

    Monday, June 11, 2012 9:36 PM
  • Then why are there DirectX 9 metro apps available in the Windows 8 Store, like Fruit Ninja? (see the system requirements!)
    Sunday, June 24, 2012 3:26 PM
  • must be DX9 FeatureLevel of DX11.1

    C++ DX11

    Monday, June 25, 2012 4:20 AM
  • OK, but how do you create a Direct3D9 Device with FeatureLevel DX11.1 ?

    .: Stefano Baraldi, Ph.D. Director @ www.tabulatouch.eu Featuring TouchTop, accelerated multi-touch document and media management for Windows 7 and 8. www.tabulatouchtop.com

    Tuesday, June 26, 2012 4:01 PM
  • You do not create a Direct3D 9 device in a Metro style app at all. You create a Direct3D 11 device which will succeed on a range of Direct3D 9 hardware if one of the Feature Level 9.1 - 9.3 values is available.

    So that means you need to write Direct3D 11 rendering code and cannot use your existing Direct3D 9 rendering code, but that you can limit your usage such that you can still support later-generation Direct3D 9 cards.

    Porting from Direct3D 9 to Direct3D 11 is essentially changing from Direct3D 9 to Direct3D 10, but using Direct3D 11 equivalents.

    http://msdn.microsoft.com/en-us/library/bb205073.aspx

    http://msdn.microsoft.com/en-us/library/ff476190.aspx

    Tuesday, June 26, 2012 5:45 PM