许多时候,需要处理设备丢失问题,而通常情况下,RESET会因为一些小问题而导致失败,下面我就把gamedev上的一贴子翻译一下,只翻译中间那小段
摘自:
http://www.gamedev.net/community/forums/topic.asp?topic_id=146731
1) One of the parameters you pass is probably not possible on the hardware, e.g. a depth buffer format which won't work with the back buffer format.
你传入的D3DPRESENT_PARAMETERS和你的硬件不符,可能是深度格式与你的后台缓冲格式不匹配。通常情况下我们是将先前的D3DPRESENT_PARAMETERS保存,RESET的时候传入,若是这种情况,则不必担心这个问题
2) The debug D3D runtime will tell you exactly "why":
把DirectX Control Pannel中的Direct3D开为调试模式,运行过后,编译器的信息提示框里会输出原因,多半是因为位于D3DPOOL_DEFAULT中的内容未释放完而导致的
a. When you install the DirectX SDK you get the option to install the debug or retail runtime, if you're developing software, always choose debug.
安装SDK的时候,你可以选则是调式还是运行模式,如果你是软件开发,通常选择为调式
b. Go to the control panel and open the DirectX applet.
到SDK中把DirectX Control Pannel小程序打开
c. Go to the Direct3D tab and put the "debug output level" slider to maximum.
把DirectX Control Pannel中的Direct3D开为调试模式
d. Run your application in the debugger (if using MSVC, press F5) and repeat whatever process causes it to fail.
在调试状态下运行你的程序,重复处理导致你出错的地方
e. Once it fails, close the app if necessary and return to MSVC, now look in the "output" pane (usually at the bottom). D3D will tell you about everything noteworthy, from information about its DLL being attached to your application, to warnings about things which may harm performance to the full reason why it gave an error.
如果发现失败了,就关掉调试,在输出信息面板中D3D将会告诉你是什么原因导致你失败的。
f. If your application creates its D3D device in PURE mode, creating it in non-PURE mode should enable more checking and reporting.
如果你的程序创建的时候的D3D设备是PURE模式,那在创建的时候改为非PURE模式,这样你在上面的控制面板中得到的信息会更多。