Bug 1345648 - Add BREAK_ON_D3D_ERROR to DeviceManagerDx - r=kvark
MozReview-Commit-ID: DgHPXgjOi3f
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -362,32 +362,58 @@ DeviceManagerDx::CreateCompositorDevice(
false,
textureSharingWorks,
featureLevel,
DxgiAdapterDesc::From(desc)));
}
mCompositorDevice->SetExceptionMode(0);
}
+//#define BREAK_ON_D3D_ERROR
+
bool
DeviceManagerDx::CreateDevice(IDXGIAdapter* aAdapter,
D3D_DRIVER_TYPE aDriverType,
UINT aFlags,
HRESULT& aResOut,
RefPtr<ID3D11Device>& aOutDevice)
{
+#ifdef BREAK_ON_D3D_ERROR
+ aFlags |= D3D11_CREATE_DEVICE_DEBUG;
+#endif
+
MOZ_SEH_TRY {
aResOut = sD3D11CreateDeviceFn(
aAdapter, aDriverType, nullptr,
aFlags,
mFeatureLevels.Elements(), mFeatureLevels.Length(),
D3D11_SDK_VERSION, getter_AddRefs(aOutDevice), nullptr, nullptr);
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
return false;
}
+
+#ifdef BREAK_ON_D3D_ERROR
+ do {
+ if (!aOutDevice)
+ break;
+
+ RefPtr<ID3D11Debug> debug;
+ if(!SUCCEEDED( aOutDevice->QueryInterface(__uuidof(ID3D11Debug), getter_AddRefs(debug)) ))
+ break;
+
+ RefPtr<ID3D11InfoQueue> infoQueue;
+ if(!SUCCEEDED( debug->QueryInterface(__uuidof(ID3D11InfoQueue), getter_AddRefs(infoQueue)) ))
+ break;
+
+ infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
+ infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);
+ infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, true);
+ } while (false);
+#endif
+
return true;
}
void
DeviceManagerDx::CreateWARPCompositorDevice()
{
ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
FeatureState& d3d11 = gfxConfig::GetFeature(Feature::D3D11_COMPOSITING);