Jump to content

  • Log In with Google      Sign In   
  • Create Account





Beware of D3D feature level 11 in the Windows Phone emulator

  Posted by Shawn Hargreaves, 06 November 2012 · 436 views

Windows Phone 8 devices support Direct3D 11.1 feature level 9.3, but our emulator uses the WARP rasterizer, which can handle all the way up to feature level 11. This means that, if you aren't careful, it is possible to accidentally use more advanced D3D features while developing in the emulator, only to get an unpleasant surprise when these things don't work on an actual device.
Q: how to avoid unpleasant surprises?
A: make sure you explicitly select feature level 9.3, even when running in the emulator.
Starting with the Windows Phone Direct3D App project template, open up Direct3DBase.cpp, find this code in the CreateDeviceResources method: D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3
};
and change it to: D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_9_3
};
Tada! Now you will be using 9.3 in the emulator, the same as on actual device hardware.
Right above this code, notice how the template turns on D3D11_CREATE_DEVICE_DEBUG only if the _DEBUG define is set? This enables extra validation to give more useful error messages if you make a mistake in your D3D API usage. But that validation is not free, so we only enable it in debug builds.http://blogs.msdn.com/aggbug.aspx?PostID=10366223

Source




October 2014 »

S M T W T F S
   1234
567891011
12131415161718
1920212223 24 25
262728293031 
PARTNERS