Bug 768395 - Crash in CDevice::DriverInternalErrorCB because the d3d device is set to crash on error instead of merely returning error codes. Explicitly set the exception mode on device creation, and assert it every time we get it again. r=jrmuizel, a=sledru
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 17 Jun 2014 13:00:13 -0400
changeset 207381 dd22a3c18f5cf9ae0a42e1e2dc86ee12f94ed44c
parent 207380 fba1326dd727bd7ebece5cafd0e6b30b4b7872ac
child 207382 8494ff92590ed8d0bd57a06ee56d1b3b53d16e00
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, sledru
bugs768395
milestone32.0a2
Bug 768395 - Crash in CDevice::DriverInternalErrorCB because the d3d device is set to crash on error instead of merely returning error codes. Explicitly set the exception mode on device creation, and assert it every time we get it again. r=jrmuizel, a=sledru
gfx/2d/Factory.cpp
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -515,22 +515,30 @@ Factory::CreateDualDrawTargetForD3D10Tex
   }
 
   return retVal;
 }
 
 void
 Factory::SetDirect3D10Device(ID3D10Device1 *aDevice)
 {
+  // do not throw on failure; return error codes and disconnect the device
+  // On Windows 8 error codes are the default, but on Windows 7 the
+  // default is to throw (or perhaps only with some drivers?)
+  aDevice->SetExceptionMode(0);
   mD3D10Device = aDevice;
 }
 
 ID3D10Device1*
 Factory::GetDirect3D10Device()
 {
+#ifdef DEBUG
+  UINT mode = mD3D10Device->GetExceptionMode();
+  MOZ_ASSERT(0 == mode);
+#endif
   return mD3D10Device;
 }
 
 #ifdef USE_D2D1_1
 void
 Factory::SetDirect3D11Device(ID3D11Device *aDevice)
 {
   mD3D11Device = aDevice;