Bug 1380142: Add a pref to enable the D3D11 debug layer and to break on errors. r=milan

MozReview-Commit-ID: 2FrQGXdgJrD

--HG--
extra : rebase_source : 74b42a35dbf8ab3851a3e441c655862f152ce482
This commit is contained in:
Bas Schouten 2017-07-11 22:53:04 +02:00
parent 29be674102
commit 52157b54ec
3 changed files with 23 additions and 20 deletions

View File

@ -390,8 +390,6 @@ DeviceManagerDx::CreateCompositorDevice(FeatureState& d3d11)
mCompositorDevice->SetExceptionMode(0);
}
//#define BREAK_ON_D3D_ERROR
bool
DeviceManagerDx::CreateDevice(IDXGIAdapter* aAdapter,
D3D_DRIVER_TYPE aDriverType,
@ -399,9 +397,9 @@ DeviceManagerDx::CreateDevice(IDXGIAdapter* aAdapter,
HRESULT& aResOut,
RefPtr<ID3D11Device>& aOutDevice)
{
#ifdef BREAK_ON_D3D_ERROR
aFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
if (gfxPrefs::Direct3D11EnableDebugLayer() || gfxPrefs::Direct3D11BreakOnError()) {
aFlags |= D3D11_CREATE_DEVICE_DEBUG;
}
MOZ_SEH_TRY {
aResOut = sD3D11CreateDeviceFn(
@ -413,24 +411,24 @@ DeviceManagerDx::CreateDevice(IDXGIAdapter* aAdapter,
return false;
}
#ifdef BREAK_ON_D3D_ERROR
do {
if (!aOutDevice)
break;
if (gfxPrefs::Direct3D11BreakOnError()) {
do {
if (!aOutDevice)
break;
RefPtr<ID3D11Debug> debug;
if(!SUCCEEDED( aOutDevice->QueryInterface(__uuidof(ID3D11Debug), getter_AddRefs(debug)) ))
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;
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
infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);
infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, true);
} while (false);
}
return true;
}

View File

@ -437,6 +437,8 @@ private:
DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device", Direct3D11ReuseDecoderDevice, int32_t, -1);
DECL_GFX_PREF(Live, "gfx.direct3d11.allow-intel-mutex", Direct3D11AllowIntelMutex, bool, true);
DECL_GFX_PREF(Live, "gfx.direct3d11.use-double-buffering", Direct3D11UseDoubleBuffering, bool, false);
DECL_GFX_PREF(Once, "gfx.direct3d11.enable-debug-layer", Direct3D11EnableDebugLayer, bool, false);
DECL_GFX_PREF(Once, "gfx.direct3d11.break-on-error", Direct3D11BreakOnError, bool, false);
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_variation_tables", KeepVariationTables, bool, false);
DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);

View File

@ -4842,6 +4842,9 @@ pref("gfx.direct2d.disabled", false);
// blacklisting
pref("gfx.direct2d.force-enabled", false);
pref("gfx.direct3d11.enable-debug-layer", false);
pref("gfx.direct3d11.break-on-error", false);
pref("layers.prefer-opengl", false);
#endif