本文介绍了[UWP] [DirectX11] [Visual Studio 2015] [Win10]调试3D游戏时出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    嗨专家。


    在调试我真棒3D游戏时,我在即时窗口中记录了以下异常:



在FairFighter.exe中的0x743ADAE8抛出异常: Microsoft C ++异常:内存位置为0x0361ECB4的_com_error。
$
在FairFighter.exe中的0x743ADAE8(KernelBase.dll)抛出异常:0x40080201:WinRT发起错误(参数:0x8000000B,0x00000040,0x011BF5A0)。

D3D11CreateDevice:指定标志(0x2)需要适用于Windows 10的D3D11 SDK图层,但它们不在系统中。

必须删除这些标记,或者Windows 10必须安装SDK。

标志包括:D3D11_CREATE_DEVICE_DEBUG

FairFighter.exe中的0x743ADAE8抛出异常:Microsoft C ++异常:内存位置为0x0391EDAC的_com_error。:



    我在Windows 10上使用Visual Studio 2015.该系统是最新的。之前没有发生此错误。


    现在,这是最令人费解的细节:一切正常。我可以玩我的游戏而且表现很棒。


    以下是有问题的代码:

 void DX :: DeviceResources :: CreateDeviceResources()
{
//此标志添加对曲面的支持订购
//的不同颜色通道比API默认值。它与Direct2D兼容是必需的。
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;

#if defined(_DEBUG)
if(DX :: SdkLayersAvailable())
{
//如果项目在调试版本中,请启用调试通过带有此标志的SDK图层。
creationFlags | = D3D11_CREATE_DEVICE_DEBUG;
}
#endif

//此数组定义此应用程序将支持的一组DirectX硬件功能级别。
//注意应保留顺序。
//不要忘记在
//描述中声明应用程序的最低要求功能级别。除非另有说明,否则假定所有申请均支持9.1。
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,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};

//创建Direct3D 11 API设备对象和相应的上下文。
ComPtr< ID3D11Device>设备;
ComPtr< ID3D11DeviceContext>上下文;

HRESULT hr = D3D11CreateDevice(
nullptr,//指定nullptr以使用默认适配器。
D3D_DRIVER_TYPE_HARDWARE,//使用硬件图形驱动程序创建设备。
0,//除非驱动程序是D3D_DRIVER_TYPE_SOFTWARE,否则应为0.
creationFlags,//设置调试和Direct2D兼容性标志。
featureLevels,//此应用程序可支持的功能级别列表。
ARRAYSIZE (featureLevels),//上面列表的大小。
D3D11_SDK_VERSION,//总是将此设置为D3D11_SDK_VERSION for Windows Store apps。
& device,//返回创建的Direct3D设备。
& m_d3dFeatureLevel,//返回设备创建的功能级别。
& context //返回设备的直接上下文。
);

  &NBSP;&NBSP;您知道,D3D11CreateDevice成功创建了设备管理器(我的意思是,它不会创建"warp"东西 - 否则性能将是baaaaaaaaad)


   ;&NBSP;&NBSP;没有真正的需要回答任何事情(我假设调试线程是死的,并且在最后一次呼吸时他会抛出异常,试图记录他在行动中被杀死)。


&NBSP;&NBSP;&NBSP;&NBSP;最诚挚的问候,


     Manuel


(又名Tarh Ik)






Tarh ik

解决方案

     Hi Experts.

     I'm getting the following exception logged in the immediate window when debugging my awesome 3D game:

Exception thrown at 0x743ADAE8 in FairFighter.exe: Microsoft C++ exception: _com_error at memory location 0x0361ECB4.
Exception thrown at 0x743ADAE8 (KernelBase.dll) in FairFighter.exe: 0x40080201: WinRT originate error (parameters: 0x8000000B, 0x00000040, 0x011BF5A0).
D3D11CreateDevice: Flags (0x2) were specified which require the D3D11 SDK Layers for Windows 10, but they are not present on the system.
These flags must be removed, or the Windows 10 SDK must be installed.
Flags include: D3D11_CREATE_DEVICE_DEBUG
Exception thrown at 0x743ADAE8 in FairFighter.exe: Microsoft C++ exception: _com_error at memory location 0x0391EDAC.:

     I'm using Visual Studio 2015 on Windows 10. The system is up-to-date. This error did not happen before.

     Now, here is the most puzzling detail: Everything works. I can play my game and the performance is great.

     Here is the offending code:

void DX::DeviceResources::CreateDeviceResources()
{
	// This flag adds support for surfaces with a different color channel ordering
	// than the API default. It is required for compatibility with Direct2D.
	UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;

#if defined(_DEBUG)
	if (DX::SdkLayersAvailable())
	{
		// If the project is in a debug build, enable debugging via SDK Layers with this flag.
		creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
	}
#endif

	// This array defines the set of DirectX hardware feature levels this app will support.
	// Note the ordering should be preserved.
	// Don't forget to declare your application's minimum required feature level in its
	// description.  All applications are assumed to support 9.1 unless otherwise stated.
	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,
		D3D_FEATURE_LEVEL_9_2,
		D3D_FEATURE_LEVEL_9_1
	};

	// Create the Direct3D 11 API device object and a corresponding context.
	ComPtr<ID3D11Device> device;
	ComPtr<ID3D11DeviceContext> context;

	HRESULT hr = D3D11CreateDevice(
		nullptr,					// Specify nullptr to use the default adapter.
		D3D_DRIVER_TYPE_HARDWARE,	// Create a device using the hardware graphics driver.
		0,							// Should be 0 unless the driver is D3D_DRIVER_TYPE_SOFTWARE.
		creationFlags,				// Set debug and Direct2D compatibility flags.
		featureLevels,				// List of feature levels this app can support.
		ARRAYSIZE(featureLevels),	// Size of the list above.
		D3D11_SDK_VERSION,			// Always set this to D3D11_SDK_VERSION for Windows Store apps.
		&device,					// Returns the Direct3D device created.
		&m_d3dFeatureLevel,			// Returns feature level of device created.
		&context					// Returns the device immediate context.
		);

    Just so you know, D3D11CreateDevice is successful at creating the Device Manager (I mean, it doesn't create the "warp" thingy - otherwise the performance would be baaaaaaaaad)

     No real need to answer anything (I'm assuming the debugging thread is the one that dies, and with his final breath he throws the exception in an attempt to register that he got killed in action).

     Best Regards,

     Manuel

(aka Tarh Ik)


Tarh ik

解决方案


这篇关于[UWP] [DirectX11] [Visual Studio 2015] [Win10]调试3D游戏时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:34