Walkthrough: Port a simple Direct3D 9 app to DirectX 11 and Universal Windows Platform (UWP)
This porting exercise shows how to bring a simple rendering framework from Direct3D 9 to Direct3D 11 and Universal Windows Platform (UWP).
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 UWP DirectX game development. You don't need a template yet, but you'll need Microsoft Visual Studio 2015 to load the code samples for this walkthrough.
Visit Porting concepts and considerations to gain a better understanding of the DirectX 11 and UWP programming concepts shown in this walkthrough.