Walkthrough: Port a simple Direct3D 9 app to DirectX 11 and the Windows Store
This porting exercise shows how to bring a simple rendering framework from Direct3D 9 to Direct3D 11 and the Windows Store.
Shows how to convert Direct3D 9 initialization code to Direct3D 11, including how to get handles to the Direct3D device and the device context and how to use DXGI to set up a swap chain.
Shows how to convert a simple rendering framework from Direct3D 9 to Direct3D 11, including how to port geometry buffers, how to compile and load HLSL shader programs, and how to implement the rendering chain in Direct3D 11.
This topic walks through two code paths that perform the same basic graphics task: display a rotating vertex-shaded cube. In both cases, the code covers the following process:
- Creating a Direct3D device and a swap chain.
- Creating a vertex buffer, and an index buffer, to represent a colorful cube mesh.
- Creating a vertex shader that transforms vertices to screen space, a pixel shader that blends color values, compiling the shaders, and loading the shaders as Direct3D resources.
- Implementing the rendering chain and presenting the drawn cube to the screen.
- Creating a window, starting a main loop, and taking care of window message processing.
Upon completing this walkthrough, you should be familiar with the following basic differences between Direct3D 9 and Direct3D 11:
- The separation of device, device context, and graphics infrastructure.
- The process of compiling shaders, and loading shader bytecode at runtime.
- How to configure per-vertex data for the Input Assembler (IA) stage.
- How to use an IFrameworkView to create a CoreWindow view.
Note that this walkthrough uses CoreWindow for simplicity, and does not cover XAML interop.
You should Prepare your dev environment for Windows Store DirectX game development. You don't need a template yet, but you'll need Microsoft Visual Studio 2013 to load the code samples for this walkthrough.
Download the Simple Direct3D 9 to DirectX 11 Windows Store porting sample. This sample includes the Direct3D 9 and Windows Store code paths shown in this walkthrough. Even though this sample uses a Windows Store app, the porting concepts discussed are applicable to Windows Phone apps as well.
Visit Porting concepts and considerations to gain a better understanding of the DirectX 11 and Windows Store programming concepts shown in this walkthrough.
- Developing for different Direct3D feature levels
- Writing HLSL Shaders in Direct3D 9
- Create a new DirectX 11 project for Windows Store
- Windows Store
- Handle to Object Operator (^)