From 1da24bcdbf3d466d82f1779e9e5112a5e8b0071d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B3zef=20Kucia?= Date: Wed, 8 Aug 2018 16:11:42 +0200 Subject: [PATCH] dxgi/tests: Add option to enable Direct3D 12 validation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/dxgi/tests/device.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 6e14010f5c3..81b231a4d36 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -37,6 +37,7 @@ static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory); static HRESULT (WINAPI *pCreateDXGIFactory2)(UINT flags, REFIID iid, void **factory); static PFN_D3D12_CREATE_DEVICE pD3D12CreateDevice; +static PFN_D3D12_GET_DEBUG_INTERFACE pD3D12GetDebugInterface; static ULONG get_refcount(IUnknown *iface) { @@ -4042,7 +4043,9 @@ static void run_on_d3d12(void (*test_func)(IUnknown *device, BOOL is_d3d12)) START_TEST(device) { HMODULE dxgi_module, d3d12_module; + BOOL enable_debug_layer = FALSE; unsigned int argc, i; + ID3D12Debug *debug; char **argv; dxgi_module = GetModuleHandleA("dxgi.dll"); @@ -4055,7 +4058,9 @@ START_TEST(device) argc = winetest_get_mainargs(&argv); for (i = 2; i < argc; ++i) { - if (!strcmp(argv[i], "--warp")) + if (!strcmp(argv[i], "--validate")) + enable_debug_layer = TRUE; + else if (!strcmp(argv[i], "--warp")) use_warp_adapter = TRUE; else if (!strcmp(argv[i], "--adapter") && i + 1 < argc) use_adapter_idx = atoi(argv[++i]); @@ -4091,6 +4096,13 @@ START_TEST(device) } pD3D12CreateDevice = (void *)GetProcAddress(d3d12_module, "D3D12CreateDevice"); + pD3D12GetDebugInterface = (void *)GetProcAddress(d3d12_module, "D3D12GetDebugInterface"); + + if (enable_debug_layer && SUCCEEDED(pD3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug))) + { + ID3D12Debug_EnableDebugLayer(debug); + ID3D12Debug_Release(debug); + } run_on_d3d12(test_swapchain_backbuffer_index); -- 2.11.4.GIT