PRB: Exception 10H Occurs in Direct3DID: Q182020
|
When 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.
The 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.
To work around the problem, the application must restore the floating-point control word before calling back into Direct3D.
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base, as it becomes available.
To 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:
//----------------------------------------------------------
// 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.
Additional query words: Retained Immediate Mode d3d Direct3D Update Render print printer driver PrintDlg MFC
Keywords : KbDirectX500bug kbSDKWin16
Version : WINDOWS:5.0,5.0a,5.2
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 17, 1999