Partager via


Supporting Windows RT and ARM processors (DirectX and C++)

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

This topic helps you get your DirectX Windows Store app (or game) up and running on Windows RT devices. Publishing your DirectX Windows Store app for Windows RT means supporting Direct3D feature level 9_1 and compiling an ARM package.

ARM considerations for DirectX Windows Store apps

Support for Direct3D feature level 9_1 is required for DirectX Windows Store apps that publish an ARM package. Some Windows RT devices support feature level 9_3. Make sure that your app has full functionality (or that your game plays well) using Direct3D feature levels 9_1 and 9_3. Note that you can use the dxcpl.exe tool included in Microsoft Visual Studio to emulate Direct3D feature levels lower than what a system supports.

For specific guidance:

Use DirectXMath instead of creating your own math library. DirectXMath has portable types (such as XMVECTOR and XMMATRIX) that use ARM-NEON on ARM processors and SSE2 on x86 and x64 processors.

  • Use XMVectorSet to initialize XMVECTOR objects instead of using initializer lists. That is, use XMVector v = XMVectorSet(1.0f, 2.0f, 3.0f, 4.0f) instead of XMVECTOR v = { 1.0f, 2.0f, 3.0f, 4.0f }. Initializer lists are not portable from x86 and x64 to ARM.
  • Note that all DirectXMath functions are available to all Windows apps, including Windows Store app on ARM, x86, and x64.

Windows RT devices support mice and keyboards, and the ARM version of your DirectX app must include the same support for mouse and keyboard controls as x86 and x64. Windows RT includes XInput controller drivers, so if your game supports XInput you should keep that support when compiling for ARM.

Compiling for ARM

Before compiling for ARM, make sure your code compiles cleanly for x86 and x64:

  • Use C++ casting operators (see Casting Operators) to reduce ambiguity and help ensure safer casts. C++ casting operators suppress fewer compiler warnings, exposing additional problems that may affect portability.

  • Enable all warnings by using the /Wall compiler switch. Then disable warnings you can safely ignore with #pragma warning or /wd.

  • With all warnings enabled check for portability warnings C4302 (pointer truncation) and C4826 (sign extension). Fix any issues.

  • Use code analysis (/analyze) for x86 and x64 native builds and fix any issues found.

  • Make sure to follow the same process for native DLLs and libraries included with your app.

Finally, try compiling an app package for the ARM platform and resolve any remaining errors and warnings.

Testing on Windows RT

Once you have built an ARM package for your DirectX app, you can test it on a Windows RT device. The Visual Studio device simulator is not an emulator so you need a real Windows RT device to test the ARM package.

Use remote debugging to track down and resolve specific issues.

Use sideloading to run the Windows App Certification Kit and to playtest games.

  1. Follow the instructions in Get a developer license to install a developer license on the Windows RT device using the command prompt.
  2. Create an app package in release configuration as described in Creating an app package.
  3. Install the app package on the Windows RT device as described in Sharing an app package locally.

See Testing your app with the Windows App Certification Kit for detailed instructions.

Writing code for Windows Store apps (DirectX and C++)

Developing apps (C++ and DirectX)

Developing games (Windows)