-->

Launching SharpDX/DirectX app with DeviceCreationF

2019-03-03 02:26发布

问题:

I am trying to launch my directX/SharpDX app with DeviceCreationFlags.Debug but i am getting the following crash upon startup:

SharpDX.SharpDXException: HRESULT: [0x80004005], Module: [General], ApiCode: [E_FAIL/Unspecified error], Message: Unspecified error

at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateDevice(Adapter adapter, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Direct3D11.Device..ctor(Adapter adapter, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Toolkit.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, DeviceCreationFlags flags, FeatureLevel[] featureLevels)
at SharpDX.Toolkit.GamePlatform.CreateDevice(GraphicsDeviceInformation deviceInformation)
at SharpDX.Toolkit.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
at SharpDX.Toolkit.GraphicsDeviceManager.ChangeOrCreateDevice(Boolean forceCreate)
at SharpDX.Toolkit.GraphicsDeviceManager.SharpDX.Toolkit.IGraphicsDeviceManager.CreateDevice()
at SharpDX.Toolkit.Game.InitializeBeforeRun()
at SharpDX.Toolkit.GameWindowDesktop.Run()
at SharpDX.Toolkit.GamePlatform.Run(GameContext gameContext)
at SharpDX.Toolkit.Game.Run(GameContext gameContext)
at wrapper.Program.Main(String[] args)

This is on Win7 32bit and i do have the June2010 DirextX SDK and Runtime installed as well as the Windows SDK for Windows 7.

btw, this question originated from this one: SharpDX crash when rendering h264 video using MediaFoundation

回答1:

From the MSDN (page on D3D11_CREATE_DEVICE_FLAG):

D3D11_CREATE_DEVICE_DEBUG

Creates a device that supports the debug layer.

To use this flag, you must have D3D11*SDKLayers.dll installed; otherwise, device creation fails. To get D3D11_1SDKLayers.dll, install the SDK for Windows 8.

These files are not part of the June2010 SDK. You have to find them somewhere else (i.e. in the Windows 8 SDK, as suggested).



回答2:

Alternative to installing the SDK is installing Visual Studio 2012 or newer. Its installation will install these debug libraries.
Similar problem was mentioned here: link => explanation 3