Plan your DirectX port
Plan your game porting project from DirectX 9 to DirectX 11 and the Windows Store: upgrade your graphics code, and put your game in the Windows Runtime environment.
Windows Store and Windows Phone apps always use the Direct3D 11 API. To get your game on these platforms, you'll need to upgrade your graphics code from DirectX 9 to DirectX 11. Your Direct3D 9 game can display the same graphics by targeting Direct3D feature level 9.
Before you begin porting your game to the Windows Store or Windows Phone, it's important to ensure that your game does not have any holdovers from Direct3D 8. Ensure that your game doesn't have any remnants of the fixed function pipeline. For a complete list of deprecated features, including fixed pipeline functionality, see Deprecated Features.
Upgrading from Direct3D 9 to Direct3D 11 is more than a search-and-replace change. You need to know the difference between the Direct3D device, device context, and graphics infrastructure, and learn about other important changes since Direct3D 9. You can start this process by reading the other topics in this section.
You must replace the D3DX and DXUT helper libraries with your own helper libraries, or with community tools. See the Feature mapping section for more info.
Shaders written in assembly language should be upgraded to HLSL using shader model 4 level 9_1 or 9_3 functionality, and shaders written for the Effects library will need to be updated to a more recent version of HLSL syntax. See the Feature mapping section for more info.
Get familiar with the different Direct3D feature levels. Feature levels classify a wide range of video hardware by defining sets of known functionality. Each set roughly corresponds to versions of Direct3D, from 9.1 through 11.2. All feature levels use the DirectX 11 API.
Maintain support for Direct3D feature level 9.1 even if you add support for higher feature levels. Windows Store DirectX apps on Windows RT devices are required to support for feature level 9.1. Windows Phone apps must support feature level 9.3.
Windows Store apps run in a window created for an app container, called a CoreWindow. Your game controls the window by inheriting from IFrameworkView, which requires less implementation details than a desktop window. Your game's main loop will be in the IFrameworkView::Run method. Native-only Windows Phone apps use the same CoreWindow and IFrameworkView pattern.
The lifecycle of a Windows Store or Windows Phone app is very different from a desktop app. You'll need to save the game often, because when a suspend event happens your app only has a limited amount of time to stop running code, and you want to make sure the player can get back to where they were right away when your app resumes. Games should save just often enough to maintain a continuous gameplay experience from resume, but not so often that the game saves impact framerate or cause the game to stutter. Your game will potentially need to load game state when the game resumes from a terminated state. See Launching and resuming apps (DirectX and C++).
DirectXMath can be used as a replacement for D3DXMath and XNAMath, and it can come in handy if you need a math library. DirectXMath has fast, portable data types, and types that are aligned and packed for use with shaders.
Native libraries such as the Interlocked API have been expanded to support ARM intrinsics. If your game uses interlocked APIs, you can keep using them in DirectX 11 and the Windows Store. These APIs are not supported on Windows Phone.
Our templates and code samples use new C++ features that you might not be familiar with yet. For example, asynchronous methods are used with lambda expressions to load Direct3D resources without blocking the UI thread. You don't have to adopt all of the new practices as long as your game still conforms to Windows Store policy for Direct3D apps or the Technical certification requirements for Windows Phone.
There are two concepts you'll use often:
- Managed references (^) and managed classes (ref classes) are a fundamental part of the Windows Runtime. You will need to use managed ref classes to interface with Windows Runtime components, for example IFrameworkView (more on that in the walkthrough).
- When working with Direct3D 11 COM interfaces, use the Microsoft::WRL::ComPtr template type to make COM pointers easier to use.
Build date: 11/19/2013