Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- dlls/dxgi/tests/dxgi.c | 45 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 27 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index 615892f..8e719c4 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -387,17 +387,13 @@ static void check_swapchain_fullscreen_state_(unsigned int line, IDXGISwapChain if (!swapchain_desc.Windowed && expected_state->fullscreen) { IDXGIAdapter *adapter; - IDXGIDevice *device; - - hr = IDXGISwapChain_GetDevice(swapchain, &IID_IDXGIDevice, (void **)&device); - ok_(__FILE__, line)(SUCCEEDED(hr), "GetDevice failed, hr %#x.\n", hr); - hr = IDXGIDevice_GetAdapter(device, &adapter); - ok_(__FILE__, line)(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr); - IDXGIDevice_Release(device);
hr = IDXGISwapChain_GetContainingOutput(swapchain, &containing_output); ok_(__FILE__, line)(SUCCEEDED(hr), "GetContainingOutput failed, hr %#x.\n", hr);
+ hr = IDXGIOutput_GetParent(containing_output, &IID_IDXGIAdapter, (void **)&adapter); + ok_(__FILE__, line)(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); + check_output_equal_(line, target, expected_state->target); ok_(__FILE__, line)(target == containing_output, "Got target %p, expected %p.\n", target, containing_output); @@ -2023,7 +2019,7 @@ static void test_get_containing_output(void) hr = IDXGISwapChain_GetContainingOutput(swapchain, &output); ok(hr == S_OK || broken(hr == DXGI_ERROR_UNSUPPORTED), "Failed to get containing output, hr %#x.\n", hr); - if (hr == DXGI_ERROR_UNSUPPORTED) + if (hr != S_OK) continue; ok(!!output, "Got unexpected containing output %p.\n", output); hr = IDXGIOutput_GetDesc(output, &output_desc); @@ -2213,28 +2209,18 @@ static void test_swapchain_fullscreen_state(IDXGISwapChain *swapchain, heap_free(output_monitor_info); }
-static void test_set_fullscreen(void) +static void test_set_fullscreen(IUnknown *device, BOOL is_d3d12) { struct swapchain_fullscreen_state initial_state; DXGI_SWAP_CHAIN_DESC swapchain_desc; IDXGISwapChain *swapchain; IDXGIFactory *factory; IDXGIAdapter *adapter; - IDXGIDevice *device; + IDXGIOutput *output; ULONG refcount; HRESULT hr;
- if (!(device = create_device(0))) - { - skip("Failed to create device.\n"); - return; - } - - hr = IDXGIDevice_GetAdapter(device, &adapter); - ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr); - - hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory); - ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); + get_factory(device, is_d3d12, &factory);
swapchain_desc.BufferDesc.Width = 800; swapchain_desc.BufferDesc.Height = 600; @@ -2246,16 +2232,22 @@ static void test_set_fullscreen(void) swapchain_desc.SampleDesc.Count = 1; swapchain_desc.SampleDesc.Quality = 0; 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", 0, 0, 0, 400, 200, 0, 0, 0, 0); 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;
memset(&initial_state, 0, sizeof(initial_state)); capture_fullscreen_state(&initial_state.fullscreen_state, swapchain_desc.OutputWindow); hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); + hr = IDXGISwapChain_GetContainingOutput(swapchain, &output); + ok(SUCCEEDED(hr), "GetContainingOutput failed, hr %#x.\n", hr); + hr = IDXGIOutput_GetParent(output, &IID_IDXGIAdapter, (void **)&adapter); + ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); + IDXGIOutput_Release(output); + check_swapchain_fullscreen_state(swapchain, &initial_state); hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL); ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE @@ -2331,10 +2323,8 @@ done: DestroyWindow(swapchain_desc.OutputWindow);
IDXGIAdapter_Release(adapter); - refcount = IDXGIDevice_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); refcount = IDXGIFactory_Release(factory); - ok(!refcount, "Factory has %u references left.\n", refcount); + ok(refcount == !is_d3d12, "Got unexpected refcount %u.\n", refcount); }
static void test_default_fullscreen_target_output(void) @@ -5271,7 +5261,6 @@ START_TEST(dxgi)
/* These tests use full-screen swapchains, so shouldn't run in parallel. */ test_create_swapchain(); - test_set_fullscreen(); test_default_fullscreen_target_output(); test_inexact_modes(); test_gamma_control(); @@ -5279,6 +5268,7 @@ START_TEST(dxgi) test_swapchain_window_messages(); test_swapchain_window_styles(); test_window_association(); + run_on_d3d10(test_set_fullscreen); run_on_d3d10(test_resize_target); run_on_d3d10(test_swapchain_resize); run_on_d3d10(test_swapchain_present); @@ -5300,6 +5290,7 @@ START_TEST(dxgi) ID3D12Debug_Release(debug); }
+ run_on_d3d12(test_set_fullscreen); run_on_d3d12(test_resize_target); run_on_d3d12(test_swapchain_resize); run_on_d3d12(test_swapchain_present);