PRB: Exception 10H Occurs in Direct3DLast reviewed: March 11, 1998Article ID: Q182020 |
The information in this article applies to:
SYMPTOMSWhen an application uses Direct3D calls a method of a Direct3D interface, the program faults with Exception 10H. The Exception appears to occur in a Direct3D DLL.
CAUSEThe fault occurs because Direct3D in DirectX versions 5.0, 5.0a, and 5.2 do not reset the floating-point control word when it is re-entered from an application. If the application's code, or other code in the process, modifies the floating-point control word without restoring it, Direct3D will fault. The fault occurs because Direct3D assumes that the floating-point control word has remained unchanged since it returned control to the application.
RESOLUTIONTo work around the problem, the application must restore the floating-point control word before calling back into Direct3D.
STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base, as it becomes available.
MORE INFORMATIONTo implement the workaround, the application must save off the floating- point control word after Direct3D returns and before executing any code that could change the floating-point control word. Then, prior to reentering Direct3D, the application should restore the floating-point control word previously set by Direct3D. The following sample code implements two functions for saving and restoring the floating-point control word:
Sample Code
//---------------------------------------------------------- // get_fpcw - Get the floating-point control word. //---------------------------------------------------------- DWORD get_fpcw() { DWORD _fpcw=0; _asm fstcw word ptr _fpcw return _fpcw; } //---------------------------------------------------------- // set_fpcw - Set the floating-point control word. //---------------------------------------------------------- void set_fpcw(DWORD _fpcw) { _asm fldcw word ptr _fpcw }One known issue associated with this problem occurs because some printer drivers alter the floating-point control word and do not restore it before returning to the application. As a result, calling the printer functions such as PrintDlg(), CreateDC(), StartDoc(), DeleteDC(), and so on, causes a Direct3D application to fault in Direct3D. One way to work around this problem using these functions is to bracket the printing code with a save and restore of the floating-point control word. NOTE: If the application's printing code uses Direct3D then Direct3D's floating-point control value must be restored prior to calling back into Direct3D within the printing code.
|
Additional query words: Retained Immediate Mode d3d Direct3D Update Render
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |