dxgi/tests: Run test_get_containing_output() on d3d12 as well.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-10-05 17:23:23 +08:00 committed by Alexandre Julliard
parent dcf3874e00
commit 6061c59322
1 changed files with 20 additions and 26 deletions

View File

@ -2123,7 +2123,7 @@ static HMONITOR get_primary_if_right_side_secondary(const DXGI_OUTPUT_DESC *outp
return NULL; return NULL;
} }
static void test_get_containing_output(void) static void test_get_containing_output(IUnknown *device, BOOL is_d3d12)
{ {
unsigned int adapter_idx, output_idx, output_count; unsigned int adapter_idx, output_idx, output_count;
DXGI_OUTPUT_DESC output_desc, output_desc2; DXGI_OUTPUT_DESC output_desc, output_desc2;
@ -2134,7 +2134,6 @@ static void test_get_containing_output(void)
IDXGIFactory *factory; IDXGIFactory *factory;
IDXGIAdapter *adapter; IDXGIAdapter *adapter;
POINT points[4 * 16]; POINT points[4 * 16];
IDXGIDevice *device;
unsigned int i, j; unsigned int i, j;
HMONITOR monitor; HMONITOR monitor;
HMONITOR primary; HMONITOR primary;
@ -2143,17 +2142,21 @@ static void test_get_containing_output(void)
HRESULT hr; HRESULT hr;
BOOL ret; BOOL ret;
if (!(device = create_device(0))) adapter = get_adapter(device, is_d3d12);
if (!adapter)
{ {
skip("Failed to create device.\n"); skip("Failed to get adapter on Direct3D %d.\n", is_d3d12 ? 12 : 10);
return; return;
} }
hr = IDXGIDevice_GetAdapter(device, &adapter); output_count = 0;
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr); while ((hr = IDXGIAdapter_EnumOutputs(adapter, output_count, &output)) != DXGI_ERROR_NOT_FOUND)
{
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory); ok(SUCCEEDED(hr), "Failed to enumerate output %u, hr %#x.\n", output_count, hr);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); IDXGIOutput_Release(output);
++output_count;
}
IDXGIAdapter_Release(adapter);
swapchain_desc.BufferDesc.Width = 100; swapchain_desc.BufferDesc.Width = 100;
swapchain_desc.BufferDesc.Height = 100; swapchain_desc.BufferDesc.Height = 100;
@ -2165,23 +2168,15 @@ static void test_get_containing_output(void)
swapchain_desc.SampleDesc.Count = 1; swapchain_desc.SampleDesc.Count = 1;
swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 1; swapchain_desc.BufferCount = is_d3d12 ? 2 : 1;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, 0); WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, 0);
swapchain_desc.Windowed = TRUE; swapchain_desc.Windowed = TRUE;
swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.SwapEffect = is_d3d12 ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;
output_count = 0; get_factory(device, is_d3d12, &factory);
while (IDXGIAdapter_EnumOutputs(adapter, output_count, &output) != DXGI_ERROR_NOT_FOUND) hr = IDXGIFactory_CreateSwapChain(factory, device, &swapchain_desc, &swapchain);
{
ok(SUCCEEDED(hr), "Failed to enumerate output %u, hr %#x.\n", output_count, hr);
IDXGIOutput_Release(output);
++output_count;
}
IDXGIAdapter_Release(adapter);
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
monitor = MonitorFromWindow(swapchain_desc.OutputWindow, 0); monitor = MonitorFromWindow(swapchain_desc.OutputWindow, 0);
@ -2436,7 +2431,7 @@ static void test_get_containing_output(void)
flush_events(); flush_events();
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL); hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "GetFullscreenState failed, hr %#x.\n", hr); ok(hr == S_OK, "GetFullscreenState failed, hr %#x.\n", hr);
ok(!fullscreen, "Expect swapchain not full screen.\n"); todo_wine_if(is_d3d12) ok(!fullscreen, "Expect swapchain not full screen.\n");
/* Move the swapchain output window to the second output */ /* Move the swapchain output window to the second output */
hr = IDXGIOutput_GetDesc(output2, &output_desc2); hr = IDXGIOutput_GetDesc(output2, &output_desc2);
@ -2490,10 +2485,8 @@ static void test_get_containing_output(void)
done: done:
refcount = IDXGISwapChain_Release(swapchain); refcount = IDXGISwapChain_Release(swapchain);
ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount); ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
refcount = IDXGIDevice_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
refcount = IDXGIFactory_Release(factory); refcount = IDXGIFactory_Release(factory);
ok(!refcount, "Factory has %u references left.\n", refcount); ok(refcount == !is_d3d12, "IDXGIFactory has %u references left.\n", refcount);
DestroyWindow(swapchain_desc.OutputWindow); DestroyWindow(swapchain_desc.OutputWindow);
} }
@ -7011,7 +7004,6 @@ START_TEST(dxgi)
test_default_fullscreen_target_output(); test_default_fullscreen_target_output();
test_inexact_modes(); test_inexact_modes();
test_gamma_control(); test_gamma_control();
test_get_containing_output();
test_multi_adapter(); test_multi_adapter();
test_swapchain_parameters(); test_swapchain_parameters();
test_swapchain_window_messages(); test_swapchain_window_messages();
@ -7025,6 +7017,7 @@ START_TEST(dxgi)
run_on_d3d10(test_swapchain_formats); run_on_d3d10(test_swapchain_formats);
run_on_d3d10(test_output_ownership); run_on_d3d10(test_output_ownership);
run_on_d3d10(test_cursor_clipping); run_on_d3d10(test_cursor_clipping);
run_on_d3d10(test_get_containing_output);
if (!(d3d12_module = LoadLibraryA("d3d12.dll"))) if (!(d3d12_module = LoadLibraryA("d3d12.dll")))
{ {
@ -7051,6 +7044,7 @@ START_TEST(dxgi)
run_on_d3d12(test_cursor_clipping); run_on_d3d12(test_cursor_clipping);
run_on_d3d12(test_frame_latency_event); run_on_d3d12(test_frame_latency_event);
run_on_d3d12(test_colour_space_support); run_on_d3d12(test_colour_space_support);
run_on_d3d12(test_get_containing_output);
FreeLibrary(d3d12_module); FreeLibrary(d3d12_module);
} }