=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi/tests: Add basic test for sync intervals.
Alexandre Julliard
julliard at winehq.org
Thu Mar 22 17:08:15 CDT 2018
Module: wine
Branch: master
Commit: 3c53b193f7f36cb7ebd6cab42524de87f1ffb0df
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3c53b193f7f36cb7ebd6cab42524de87f1ffb0df
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Mar 22 08:48:33 2018 +0100
dxgi/tests: Add basic test for sync intervals.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dxgi/tests/device.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 8351a32..8172269 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -3353,6 +3353,63 @@ static void test_swapchain_parameters(void)
DestroyWindow(window);
}
+static void test_swapchain_present(void)
+{
+ DXGI_SWAP_CHAIN_DESC swapchain_desc;
+ IDXGISwapChain *swapchain;
+ IDXGIAdapter *adapter;
+ IDXGIFactory *factory;
+ IDXGIDevice *device;
+ unsigned int i;
+ ULONG refcount;
+ HRESULT hr;
+
+ if (!(device = create_device(0)))
+ {
+ skip("Failed to create device.\n");
+ return;
+ }
+
+ hr = IDXGIDevice_GetAdapter(device, &adapter);
+ ok(SUCCEEDED(hr), "Failed to get adapter, hr %#x.\n", hr);
+ hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
+ ok(SUCCEEDED(hr), "Failed to get parent, hr %#x.\n", hr);
+ IDXGIAdapter_Release(adapter);
+
+ swapchain_desc.BufferDesc.Width = 800;
+ swapchain_desc.BufferDesc.Height = 600;
+ swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
+ swapchain_desc.BufferDesc.RefreshRate.Denominator = 60;
+ swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ swapchain_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+ swapchain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
+ swapchain_desc.SampleDesc.Count = 1;
+ swapchain_desc.SampleDesc.Quality = 0;
+ swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+ swapchain_desc.BufferCount = 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.Flags = 0;
+
+ hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
+ ok(SUCCEEDED(hr), "Failed to create swapchain, hr %#x.\n", hr);
+
+ for (i = 0; i < 10; ++i)
+ {
+ hr = IDXGISwapChain_Present(swapchain, i, 0);
+ ok(hr == (i <= 4 ? S_OK : DXGI_ERROR_INVALID_CALL),
+ "Got unexpected hr %#x for sync interval %u.\n", hr, i);
+ }
+ hr = IDXGISwapChain_Present(swapchain, 0, 0);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+
+ IDXGISwapChain_Release(swapchain);
+ refcount = IDXGIDevice_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(swapchain_desc.OutputWindow);
+}
+
static void test_maximum_frame_latency(void)
{
IDXGIDevice1 *device1;
@@ -3654,6 +3711,7 @@ START_TEST(device)
test_private_data();
test_swapchain_resize();
test_swapchain_parameters();
+ test_swapchain_present();
test_maximum_frame_latency();
test_output_desc();
test_object_wrapping();
More information about the wine-cvs
mailing list