d3d9/tests: Allow a width and height to be passed to create_device().

This commit is contained in:
Henri Verbeet 2014-10-09 11:50:48 +02:00 committed by Alexandre Julliard
parent 1800712298
commit 2291c72caf
1 changed files with 143 additions and 98 deletions

View File

@ -31,6 +31,14 @@ struct vec3
float x, y, z;
};
struct device_desc
{
HWND device_window;
unsigned int width;
unsigned int height;
BOOL windowed;
};
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
@ -117,20 +125,28 @@ static void flush_events(void)
}
}
static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND device_window, HWND focus_window, BOOL windowed)
static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
IDirect3DDevice9 *device;
present_parameters.Windowed = windowed;
present_parameters.hDeviceWindow = device_window;
present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
present_parameters.BackBufferWidth = screen_width;
present_parameters.BackBufferHeight = screen_height;
present_parameters.BackBufferWidth = 640;
present_parameters.BackBufferHeight = 480;
present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
present_parameters.hDeviceWindow = focus_window;
present_parameters.Windowed = TRUE;
present_parameters.EnableAutoDepthStencil = TRUE;
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
if (desc)
{
present_parameters.BackBufferWidth = desc->width;
present_parameters.BackBufferHeight = desc->height;
present_parameters.hDeviceWindow = desc->device_window;
present_parameters.Windowed = desc->windowed;
}
if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device))) return device;
@ -226,7 +242,7 @@ static void test_get_set_vertex_declaration(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -281,7 +297,7 @@ static void test_get_declaration(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -600,7 +616,7 @@ static void test_fvf_decl_conversion(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -702,7 +718,7 @@ static void test_fvf_decl_management(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -820,7 +836,7 @@ static void test_vertex_declaration_alignment(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -894,7 +910,7 @@ static void test_unused_declaration_type(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -940,7 +956,7 @@ static void test_mipmap_levels(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -972,7 +988,7 @@ static void test_checkdevicemultisampletype(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -1024,7 +1040,7 @@ static void test_swapchain(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -1183,7 +1199,7 @@ static void test_refcount(void)
CHECK_REFCOUNT(d3d, 1);
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -1504,7 +1520,7 @@ static void test_cursor(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2155,7 +2171,7 @@ static void test_scene(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2279,7 +2295,7 @@ static void test_limits(void)
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2496,7 +2512,7 @@ static void test_get_rt(void)
0, 0, 128, 128, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
device = create_device(d3d9, window, window, TRUE);
device = create_device(d3d9, window, NULL);
if (!device)
{
skip("Failed to create a D3D device, skipping tests.\n");
@ -2562,7 +2578,7 @@ static void test_draw_indexed(void)
ok(!!window, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2662,7 +2678,7 @@ static void test_null_stream(void)
ok(!!window, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2735,7 +2751,7 @@ static void test_lights(void)
ok(!!window, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -2788,7 +2804,7 @@ static void test_set_stream_source(void)
ok(!!window, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
goto cleanup;
@ -3021,7 +3037,7 @@ static void test_multi_device(void)
ok(!!window1, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device1 = create_device(d3d9, window1, window1, TRUE)))
if (!(device1 = create_device(d3d9, window1, NULL)))
{
skip("Failed to create a 3D device, skipping test.\n");
IDirect3D9_Release(d3d9);
@ -3035,7 +3051,7 @@ static void test_multi_device(void)
ok(!!window2, "Failed to create a window.\n");
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
device2 = create_device(d3d9, window2, window2, TRUE);
device2 = create_device(d3d9, window2, NULL);
IDirect3D9_Release(d3d9);
refcount = IDirect3DDevice9_Release(device2);
@ -3139,6 +3155,7 @@ static DWORD WINAPI wndproc_thread(void *param)
static void test_wndproc(void)
{
struct wndproc_thread_param thread_params;
struct device_desc device_desc;
IDirect3DDevice9 *device;
WNDCLASSA wc = {0};
IDirect3D9 *d3d9;
@ -3203,8 +3220,11 @@ static void test_wndproc(void)
expect_messages = messages;
device = create_device(d3d9, device_window, focus_window, FALSE);
if (!device)
device_desc.device_window = device_window;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3241,8 +3261,8 @@ static void test_wndproc(void)
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
(LONG_PTR)test_proc, proc);
device = create_device(d3d9, focus_window, focus_window, FALSE);
if (!device)
device_desc.device_window = focus_window;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3251,8 +3271,8 @@ static void test_wndproc(void)
ref = IDirect3DDevice9_Release(device);
ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
device = create_device(d3d9, device_window, focus_window, FALSE);
if (!device)
device_desc.device_window = device_window;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3287,6 +3307,7 @@ done:
static void test_wndproc_windowed(void)
{
struct wndproc_thread_param thread_params;
struct device_desc device_desc;
IDirect3DDevice9 *device;
WNDCLASSA wc = {0};
IDirect3D9 *d3d9;
@ -3342,8 +3363,11 @@ static void test_wndproc_windowed(void)
filter_messages = focus_window;
device = create_device(d3d9, device_window, focus_window, TRUE);
if (!device)
device_desc.device_window = device_window;
device_desc.width = 640;
device_desc.height = 480;
device_desc.windowed = TRUE;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3394,8 +3418,8 @@ static void test_wndproc_windowed(void)
filter_messages = device_window;
device = create_device(d3d9, focus_window, focus_window, TRUE);
if (!device)
device_desc.device_window = focus_window;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3430,8 +3454,8 @@ static void test_wndproc_windowed(void)
ref = IDirect3DDevice9_Release(device);
ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
device = create_device(d3d9, device_window, focus_window, TRUE);
if (!device)
device_desc.device_window = device_window;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3514,8 +3538,7 @@ static void test_reset_fullscreen(void)
* could show the window (such as ShowWindow or SetWindowPos) yet,
* WM_ACTIVATEAPP will not have been sent.
*/
device = create_device(d3d, device_window, focus_window, TRUE);
if (!device)
if (!(device = create_device(d3d, device_window, NULL)))
{
skip("Unable to create device. Skipping test.\n");
goto cleanup;
@ -3632,6 +3655,7 @@ static void test_window_style(void)
RECT focus_rect, fullscreen_rect, r;
LONG device_style, device_exstyle;
LONG focus_style, focus_exstyle;
struct device_desc device_desc;
LONG style, expected_style;
IDirect3DDevice9 *device;
IDirect3D9 *d3d9;
@ -3653,8 +3677,11 @@ static void test_window_style(void)
SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height);
GetWindowRect(focus_window, &focus_rect);
device = create_device(d3d9, device_window, focus_window, FALSE);
if (!device)
device_desc.device_window = device_window;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3771,7 +3798,7 @@ static void test_cursor_pos(void)
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
device = create_device(d3d9, window, window, TRUE);
device = create_device(d3d9, window, NULL);
if (!device)
{
skip("Failed to create a D3D device, skipping tests.\n");
@ -3836,6 +3863,7 @@ done:
static void test_mode_change(void)
{
RECT fullscreen_rect, focus_rect, r;
struct device_desc device_desc;
IDirect3DSurface9 *backbuffer;
IDirect3DDevice9 *device;
D3DSURFACE_DESC desc;
@ -3855,8 +3883,11 @@ static void test_mode_change(void)
SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height);
GetWindowRect(focus_window, &focus_rect);
device = create_device(d3d9, device_window, focus_window, FALSE);
if (!device)
device_desc.device_window = device_window;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -3921,6 +3952,7 @@ done:
static void test_device_window_reset(void)
{
RECT fullscreen_rect, device_rect, r;
struct device_desc device_desc;
IDirect3DDevice9 *device;
WNDCLASSA wc = {0};
IDirect3D9 *d3d9;
@ -3949,8 +3981,11 @@ static void test_device_window_reset(void)
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
(LONG_PTR)test_proc, proc);
device = create_device(d3d9, NULL, focus_window, FALSE);
if (!device)
device_desc.device_window = NULL;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d9, focus_window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -4018,7 +4053,7 @@ static void test_reset_resources(void)
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -4088,7 +4123,7 @@ static void test_set_rt_vp_scissor(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@ -4103,14 +4138,14 @@ static void test_set_rt_vp_scissor(void)
ok(SUCCEEDED(hr), "Failed to get viewport, hr %#x.\n", hr);
ok(!vp.X, "Got unexpected vp.X %u.\n", vp.X);
ok(!vp.Y, "Got unexpected vp.Y %u.\n", vp.Y);
ok(vp.Width == screen_width, "Got unexpected vp.Width %u.\n", vp.Width);
ok(vp.Height == screen_height, "Got unexpected vp.Height %u.\n", vp.Height);
ok(vp.Width == 640, "Got unexpected vp.Width %u.\n", vp.Width);
ok(vp.Height == 480, "Got unexpected vp.Height %u.\n", vp.Height);
ok(vp.MinZ == 0.0f, "Got unexpected vp.MinZ %.8e.\n", vp.MinZ);
ok(vp.MaxZ == 1.0f, "Got unexpected vp.MaxZ %.8e.\n", vp.MaxZ);
hr = IDirect3DDevice9_GetScissorRect(device, &rect);
ok(SUCCEEDED(hr), "Failed to get scissor rect, hr %#x.\n", hr);
ok(rect.left == 0 && rect.top == 0 && rect.right == screen_width && rect.bottom == screen_height,
ok(rect.left == 0 && rect.top == 0 && rect.right == 640 && rect.bottom == 480,
"Got unexpected scissor rect {%d, %d, %d, %d}.\n",
rect.left, rect.top, rect.right, rect.bottom);
@ -4196,7 +4231,7 @@ static void test_volume_get_container(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4278,7 +4313,7 @@ static void test_volume_resource(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4346,7 +4381,7 @@ static void test_vb_lock_flags(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4416,7 +4451,7 @@ static void test_vertex_buffer_alignment(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4486,7 +4521,7 @@ static void test_query_support(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4529,6 +4564,7 @@ static void test_occlusion_query_states(void)
1.0f, 1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
};
struct device_desc device_desc;
IDirect3DQuery9 *query = NULL;
unsigned int data_size, i;
IDirect3DDevice9 *device;
@ -4548,7 +4584,11 @@ static void test_occlusion_query_states(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, FALSE)))
device_desc.device_window = window;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d9, window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4700,7 +4740,7 @@ static void test_timestamp_query(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -4863,7 +4903,7 @@ static void test_get_set_vertex_shader(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -4925,7 +4965,7 @@ static void test_vertex_shader_constant(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -4985,7 +5025,7 @@ static void test_get_set_pixel_shader(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5047,7 +5087,7 @@ static void test_pixel_shader_constant(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5142,7 +5182,7 @@ float4 main(const float4 color : COLOR) : SV_TARGET
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5190,7 +5230,7 @@ static void test_texture_stage_states(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5352,7 +5392,7 @@ static void test_cube_textures(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5425,7 +5465,7 @@ static void test_mipmap_gen(void)
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5555,7 +5595,7 @@ static void test_filter(void)
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5626,7 +5666,7 @@ static void test_get_texture(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5661,7 +5701,7 @@ static void test_lod(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5707,7 +5747,7 @@ static void test_surface_get_container(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5777,7 +5817,7 @@ static void test_surface_alignment(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5878,7 +5918,7 @@ static void test_lockrect_offset(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -5970,7 +6010,7 @@ static void test_lockrect_invalid(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6077,7 +6117,7 @@ static void test_private_data(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6267,7 +6307,7 @@ static void test_getdc(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6334,7 +6374,7 @@ static void test_surface_dimensions(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6383,7 +6423,7 @@ static void test_surface_format_null(void)
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6477,7 +6517,7 @@ static void test_surface_double_unlock(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6593,7 +6633,7 @@ static void test_surface_blocks(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -6905,7 +6945,7 @@ static void test_set_palette(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
DestroyWindow(window);
@ -7070,7 +7110,7 @@ static void test_npot_textures(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -7173,7 +7213,7 @@ static void test_vidmem_accounting(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -7244,7 +7284,7 @@ static void test_volume_locking(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -7351,7 +7391,7 @@ static void test_update_volumetexture(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -7457,7 +7497,7 @@ static void test_create_rt_ds_fail(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -7567,7 +7607,7 @@ static void test_volume_blocks(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d9, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d9, window, window, TRUE)))
if (!(device = create_device(d3d9, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d9);
@ -7884,7 +7924,7 @@ static void test_lockbox_invalid(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -7982,7 +8022,7 @@ static void test_shared_handle(void)
0, 0, 640, 480, 0, 0, 0, 0);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8135,7 +8175,7 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (!(device = create_device(d3d9, hwnd, hwnd, TRUE)))
if (!(device = create_device(d3d9, hwnd, NULL)))
{
skip("Failed to create device\n");
goto cleanup;
@ -8213,7 +8253,7 @@ static void test_begin_end_state_block(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8271,7 +8311,7 @@ static void test_shader_constant_apply(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8439,7 +8479,7 @@ static void test_vdecl_apply(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8617,7 +8657,7 @@ static void test_resource_type(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8772,7 +8812,7 @@ static void test_mipmap_lock(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8854,7 +8894,7 @@ static void test_writeonly_resource(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);
@ -8905,6 +8945,7 @@ static void test_writeonly_resource(void)
static void test_lost_device(void)
{
struct device_desc device_desc;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
ULONG refcount;
@ -8916,7 +8957,11 @@ static void test_lost_device(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, FALSE)))
device_desc.device_window = window;
device_desc.width = screen_width;
device_desc.height = screen_height;
device_desc.windowed = FALSE;
if (!(device = create_device(d3d, window, &device_desc)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
@ -9017,7 +9062,7 @@ static void test_resource_priority(void)
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, window, TRUE)))
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device, skipping tests.\n");
IDirect3D9_Release(d3d);