From 56d1225ec208c46d4899e3f7f0f02f6b24fca230 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 29 Jan 2014 19:28:38 +0100 Subject: [PATCH] d3d8/tests: Direct3DCreate8() is always available if we have d3d8. --- dlls/d3d8/tests/Makefile.in | 2 +- dlls/d3d8/tests/device.c | 224 +++++++++++++++++------------------ dlls/d3d8/tests/stateblock.c | 47 +++----- dlls/d3d8/tests/visual.c | 33 ++---- 4 files changed, 135 insertions(+), 171 deletions(-) diff --git a/dlls/d3d8/tests/Makefile.in b/dlls/d3d8/tests/Makefile.in index 6a45dd7171f..552f0e7b064 100644 --- a/dlls/d3d8/tests/Makefile.in +++ b/dlls/d3d8/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = d3d8.dll -IMPORTS = user32 +IMPORTS = d3d8 user32 C_SRCS = \ device.c \ diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 6bcd05eb506..b93acf47a9e 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -34,7 +34,6 @@ static INT screen_height; static HRESULT (WINAPI *ValidateVertexShader)(DWORD *, DWORD *, DWORD *, int, DWORD *); static HRESULT (WINAPI *ValidatePixelShader)(DWORD *, DWORD *, int, DWORD *); -static IDirect3D8 *(WINAPI *pDirect3DCreate8)(UINT); static BOOL (WINAPI *pGetCursorInfo)(PCURSORINFO); @@ -190,7 +189,7 @@ static void test_mipmap_levels(void) D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -239,7 +238,7 @@ static void test_swapchain(void) D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -387,7 +386,7 @@ static void test_refcount(void) D3DVSD_END() }; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -723,7 +722,7 @@ static void test_cursor(void) ok(pGetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -841,7 +840,7 @@ static void test_cursor_pos(void) {0, 0}, }; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping cursor tests.\n"); return; @@ -925,7 +924,7 @@ static void test_states(void) D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -969,7 +968,7 @@ static void test_shader_versions(void) IDirect3D8 *pD3d = NULL; D3DCAPS8 d3dcaps; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); if (pD3d != NULL) { hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps); @@ -1013,7 +1012,7 @@ static void test_display_formats(void) {"D3DFMT_UNKNOWN", D3DFMT_UNKNOWN, 0, FALSE, FALSE}, }; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create an IDirect3D8 object, skipping test.\n"); return; @@ -1072,7 +1071,7 @@ static void test_display_modes(void) HRESULT res; IDirect3D8 *pD3d; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); if(!pD3d) return; @@ -1131,7 +1130,7 @@ static void test_reset(void) UINT h; } *modes = NULL; - d3d8 = pDirect3DCreate8(D3D_SDK_VERSION); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create IDirect3D8 object.\n"); window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -1599,7 +1598,7 @@ static void test_scene(void) D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -1710,7 +1709,7 @@ static void test_shader(void) const DWORD simple_vs_size = sizeof(simple_vs); const DWORD simple_ps_size = sizeof(simple_ps); - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -1924,7 +1923,7 @@ static void test_limits(void) IDirect3DTexture8 *pTexture = NULL; int i; - pD3d = pDirect3DCreate8( D3D_SDK_VERSION ); + pD3d = Direct3DCreate8(D3D_SDK_VERSION); ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -1992,7 +1991,7 @@ static void test_lights(void) D3DCAPS8 caps; D3DDISPLAYMODE d3ddm; - d3d8 = pDirect3DCreate8( D3D_SDK_VERSION ); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -2078,7 +2077,7 @@ static void test_render_zero_triangles(void) { 1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, 0xff0000ff}, }; - d3d8 = pDirect3DCreate8( D3D_SDK_VERSION ); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -2143,7 +2142,7 @@ static void test_depth_stencil_reset(void) HRESULT hr; HWND hwnd; - d3d8 = pDirect3DCreate8(D3D_SDK_VERSION); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -2368,7 +2367,7 @@ static void test_wndproc(void) {0, 0}, }; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -2512,7 +2511,7 @@ static void test_wndproc_windowed(void) DWORD res, tid; HWND tmp; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -2736,7 +2735,7 @@ static void test_fpu_setup(void) HRESULT hr; WORD cw; - d3d8 = pDirect3DCreate8(D3D_SDK_VERSION); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a d3d8 object.\n"); if (!d3d8) return; @@ -2803,7 +2802,7 @@ static void test_ApplyStateBlock(void) D3DDISPLAYMODE d3ddm; DWORD received, token; - d3d8 = pDirect3DCreate8( D3D_SDK_VERSION ); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -2868,7 +2867,7 @@ static void test_depth_stencil_size(void) HRESULT hr; HWND hwnd; - d3d8 = pDirect3DCreate8( D3D_SDK_VERSION ); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -2936,7 +2935,7 @@ static void test_window_style(void) ULONG ref; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -3054,7 +3053,7 @@ static void test_wrong_shader(void) D3DVSD_END() }; - d3d = pDirect3DCreate8(D3D_SDK_VERSION); + d3d = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -3114,7 +3113,7 @@ static void test_mode_change(void) HRESULT hr; DWORD ret; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping mode change tests.\n"); return; @@ -3202,7 +3201,7 @@ static void test_device_window_reset(void) HRESULT hr; ULONG ref; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -3289,7 +3288,7 @@ static void depth_blit_test(void) const POINT dst_point = {0, 0}; HRESULT hr; - d3d8 = pDirect3DCreate8(D3D_SDK_VERSION); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(d3d8 != NULL, "Direct3DCreate8 failed.\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); @@ -3365,7 +3364,7 @@ static void test_reset_resources(void) window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); DestroyWindow(window); @@ -3424,7 +3423,7 @@ static void test_set_rt_vp_scissor(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -3603,7 +3602,7 @@ static void test_volume_get_container(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -3705,7 +3704,7 @@ static void test_vb_lock_flags(void) HRESULT hr; BYTE *data; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -3756,7 +3755,7 @@ static void test_texture_stage_states(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -3849,7 +3848,7 @@ static void test_cube_textures(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -3925,7 +3924,7 @@ static void test_image_surface_pool(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -3965,7 +3964,7 @@ static void test_surface_get_container(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4061,7 +4060,7 @@ static void test_lockrect_invalid(void) BYTE *base; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4157,7 +4156,7 @@ static void test_private_data(void) HRESULT hr; DWORD size; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4241,7 +4240,7 @@ static void test_surface_dimensions(void) HWND window; HRESULT hr; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4282,7 +4281,7 @@ static void test_surface_format_null(void) HWND window; HRESULT hr; - if (!(d3d = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create D3D object, skipping tests.\n"); return; @@ -4379,7 +4378,7 @@ static void test_surface_double_unlock(void) HWND window; HRESULT hr; - if (!(d3d = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create D3D object, skipping tests.\n"); return; @@ -4522,7 +4521,7 @@ static void test_surface_blocks(void) BOOL tex_pow2, cube_pow2; D3DCAPS8 caps; - if (!(d3d = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create D3D object, skipping tests.\n"); return; @@ -4799,7 +4798,7 @@ static void test_set_palette(void) unsigned int i; D3DCAPS8 caps; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4868,7 +4867,7 @@ static void test_swvp_buffer(void) float x, y, z; } *ptr, *ptr2; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create d3d8 object, skipping tests.\n"); return; @@ -4973,7 +4972,7 @@ static void test_npot_textures(void) unsigned int i, levels; BOOL tex_pow2, cube_pow2, vol_pow2; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -5098,7 +5097,7 @@ static void test_volume_locking(void) { D3DPOOL_SCRATCH, D3DUSAGE_DYNAMIC, D3DERR_INVALIDCALL, D3D_OK }, }; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -5209,7 +5208,7 @@ static void test_update_volumetexture(void) { 8, 8, 4, 4, D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8 }, /* Different format */ }; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -5319,7 +5318,7 @@ static void test_create_rt_ds_fail(void) IDirect3D8 *d3d8; IDirect3DSurface8 *surface; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -5433,7 +5432,7 @@ static void test_volume_blocks(void) BOOL pow2; unsigned int offset, expected_offset; - if (!(d3d8 = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create IDirect3D8 object, skipping tests.\n"); return; @@ -5754,7 +5753,7 @@ static void test_lockbox_invalid(void) BYTE *base; HRESULT hr; - if (!(d3d = pDirect3DCreate8(D3D_SDK_VERSION))) + if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create D3D object, skipping tests.\n"); return; @@ -5843,6 +5842,8 @@ START_TEST(device) { HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" ); WNDCLASSA wc = {0}; + IDirect3D8 *d3d8; + if (!d3d8_handle) { skip("Could not load d3d8.dll\n"); @@ -5855,72 +5856,67 @@ START_TEST(device) ValidateVertexShader = (void *)GetProcAddress(d3d8_handle, "ValidateVertexShader"); ValidatePixelShader = (void *)GetProcAddress(d3d8_handle, "ValidatePixelShader"); - pDirect3DCreate8 = (void *)GetProcAddress( d3d8_handle, "Direct3DCreate8" ); - ok(pDirect3DCreate8 != NULL, "Failed to get address of Direct3DCreate8\n"); - if (pDirect3DCreate8) + + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { - IDirect3D8 *d3d8; - d3d8 = pDirect3DCreate8( D3D_SDK_VERSION ); - if(!d3d8) - { - skip("could not create D3D8\n"); - return; - } - IDirect3D8_Release(d3d8); - - screen_width = GetSystemMetrics(SM_CXSCREEN); - screen_height = GetSystemMetrics(SM_CYSCREEN); - - test_fpu_setup(); - test_display_formats(); - test_display_modes(); - test_shader_versions(); - test_swapchain(); - test_refcount(); - test_mipmap_levels(); - test_cursor(); - test_cursor_pos(); - test_states(); - test_reset(); - test_scene(); - test_shader(); - test_limits(); - test_lights(); - test_ApplyStateBlock(); - test_render_zero_triangles(); - test_depth_stencil_reset(); - test_wndproc(); - test_wndproc_windowed(); - test_depth_stencil_size(); - test_window_style(); - test_wrong_shader(); - test_mode_change(); - test_device_window_reset(); - test_reset_resources(); - depth_blit_test(); - test_set_rt_vp_scissor(); - test_validate_vs(); - test_validate_ps(); - test_volume_get_container(); - test_vb_lock_flags(); - test_texture_stage_states(); - test_cube_textures(); - test_image_surface_pool(); - test_surface_get_container(); - test_lockrect_invalid(); - test_private_data(); - test_surface_dimensions(); - test_surface_format_null(); - test_surface_double_unlock(); - test_surface_blocks(); - test_set_palette(); - test_swvp_buffer(); - test_npot_textures(); - test_volume_locking(); - test_update_volumetexture(); - test_create_rt_ds_fail(); - test_volume_blocks(); - test_lockbox_invalid(); + skip("could not create D3D8\n"); + return; } + IDirect3D8_Release(d3d8); + + screen_width = GetSystemMetrics(SM_CXSCREEN); + screen_height = GetSystemMetrics(SM_CYSCREEN); + + test_fpu_setup(); + test_display_formats(); + test_display_modes(); + test_shader_versions(); + test_swapchain(); + test_refcount(); + test_mipmap_levels(); + test_cursor(); + test_cursor_pos(); + test_states(); + test_reset(); + test_scene(); + test_shader(); + test_limits(); + test_lights(); + test_ApplyStateBlock(); + test_render_zero_triangles(); + test_depth_stencil_reset(); + test_wndproc(); + test_wndproc_windowed(); + test_depth_stencil_size(); + test_window_style(); + test_wrong_shader(); + test_mode_change(); + test_device_window_reset(); + test_reset_resources(); + depth_blit_test(); + test_set_rt_vp_scissor(); + test_validate_vs(); + test_validate_ps(); + test_volume_get_container(); + test_vb_lock_flags(); + test_texture_stage_states(); + test_cube_textures(); + test_image_surface_pool(); + test_surface_get_container(); + test_lockrect_invalid(); + test_private_data(); + test_surface_dimensions(); + test_surface_format_null(); + test_surface_double_unlock(); + test_surface_blocks(); + test_set_palette(); + test_swvp_buffer(); + test_npot_textures(); + test_volume_locking(); + test_update_volumetexture(); + test_create_rt_ds_fail(); + test_volume_blocks(); + test_lockbox_invalid(); + UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); } diff --git a/dlls/d3d8/tests/stateblock.c b/dlls/d3d8/tests/stateblock.c index b7065b40ced..acb4e086a47 100644 --- a/dlls/d3d8/tests/stateblock.c +++ b/dlls/d3d8/tests/stateblock.c @@ -33,38 +33,36 @@ static HWND create_window(void) return CreateWindowA("d3d8_test_wc", "d3d8_test", 0, 0, 0, 0, 0, 0, 0, 0, 0); } -static HRESULT init_d3d8(HMODULE d3d8_module, IDirect3DDevice8 **device, D3DPRESENT_PARAMETERS *device_pparams) +static IDirect3DDevice8 *init_d3d8(D3DPRESENT_PARAMETERS *present_parameters) { - IDirect3D8 * (WINAPI *d3d8_create)(UINT SDKVersion) = 0; + IDirect3DDevice8 *device; D3DDISPLAYMODE d3ddm; - IDirect3D8 *d3d8 = 0; + IDirect3D8 *d3d8; HWND window; HRESULT hr; - d3d8_create = (void *)GetProcAddress(d3d8_module, "Direct3DCreate8"); - if (!d3d8_create) return E_FAIL; - - d3d8 = d3d8_create(D3D_SDK_VERSION); - if (!d3d8) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("Failed to create D3D8 object.\n"); - return E_FAIL; + return NULL; } window = create_window(); IDirect3D8_GetAdapterDisplayMode(d3d8, D3DADAPTER_DEFAULT, &d3ddm); - memset(device_pparams, 0, sizeof(*device_pparams)); - device_pparams->Windowed = TRUE; - device_pparams->SwapEffect = D3DSWAPEFFECT_DISCARD; - device_pparams->BackBufferFormat = d3ddm.Format; + memset(present_parameters, 0, sizeof(*present_parameters)); + present_parameters->Windowed = TRUE; + present_parameters->SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters->BackBufferFormat = d3ddm.Format; hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, device_pparams, device); + D3DCREATE_SOFTWARE_VERTEXPROCESSING, present_parameters, &device); ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE || broken(hr == D3DERR_INVALIDCALL), "IDirect3D8_CreateDevice failed, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + return device; - return hr; + return NULL; } static void test_begin_end_state_block(IDirect3DDevice8 *device) @@ -2048,25 +2046,12 @@ static void test_shader_constant_apply(IDirect3DDevice8 *device) START_TEST(stateblock) { - IDirect3DDevice8 *device = NULL; D3DPRESENT_PARAMETERS device_pparams; - HMODULE d3d8_module; + IDirect3DDevice8 *device; ULONG refcount; - HRESULT hr; - d3d8_module = LoadLibraryA("d3d8.dll"); - if (!d3d8_module) - { - skip("Could not load d3d8.dll\n"); + if (!(device = init_d3d8(&device_pparams))) return; - } - - hr = init_d3d8(d3d8_module, &device, &device_pparams); - if (FAILED(hr)) - { - FreeLibrary(d3d8_module); - return; - } test_begin_end_state_block(device); test_state_management(device, &device_pparams); @@ -2074,6 +2059,4 @@ START_TEST(stateblock) refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left\n", refcount); - - FreeLibrary(d3d8_module); } diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 7b6c178d3ca..7a7e11a0dfc 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -23,8 +23,6 @@ #include #include "wine/test.h" -static HMODULE d3d8_handle = 0; - struct vec2 { float x, y; @@ -130,18 +128,12 @@ out: static IDirect3DDevice8 *init_d3d8(void) { - IDirect3D8 * (__stdcall * d3d8_create)(UINT SDKVersion) = 0; - IDirect3D8 *d3d8_ptr = 0; - IDirect3DDevice8 *device_ptr = 0; D3DPRESENT_PARAMETERS present_parameters; + IDirect3DDevice8 *device = NULL; + IDirect3D8 *d3d8; HRESULT hr; - d3d8_create = (void *)GetProcAddress(d3d8_handle, "Direct3DCreate8"); - ok(d3d8_create != NULL, "Failed to get address of Direct3DCreate8\n"); - if (!d3d8_create) return NULL; - - d3d8_ptr = d3d8_create(D3D_SDK_VERSION); - if (!d3d8_ptr) + if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) { skip("could not create D3D8\n"); return NULL; @@ -157,11 +149,12 @@ static IDirect3DDevice8 *init_d3d8(void) present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; - hr = IDirect3D8_CreateDevice(d3d8_ptr, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device_ptr); - ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL || broken(hr == D3DERR_NOTAVAILABLE), "IDirect3D_CreateDevice returned: %#08x\n", hr); + hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device); + ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL || broken(hr == D3DERR_NOTAVAILABLE), + "IDirect3D_CreateDevice returned: %#08x\n", hr); - return device_ptr; + return device; } struct vertex @@ -4693,15 +4686,7 @@ START_TEST(visual) DWORD color; D3DCAPS8 caps; - d3d8_handle = LoadLibraryA("d3d8.dll"); - if (!d3d8_handle) - { - win_skip("Could not load d3d8.dll\n"); - return; - } - - device_ptr = init_d3d8(); - if (!device_ptr) + if (!(device_ptr = init_d3d8())) { win_skip("Could not initialize direct3d\n"); return;