Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- v2: Supersede 181336~181337. Create test device with software vertex processing if hardware vertex processing is unavailable.
dlls/d3d8/device.c | 1 + dlls/d3d8/tests/device.c | 64 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 400e1e292a..23e93df061 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -730,6 +730,7 @@ static HRESULT WINAPI d3d8_device_GetCreationParameters(IDirect3DDevice8 *iface, (struct wined3d_device_creation_parameters *)parameters); wined3d_mutex_unlock();
+ parameters->AdapterOrdinal = device->adapter_ordinal; return D3D_OK; }
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 2e182e6192..8042bfb1af 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9869,6 +9869,69 @@ static void test_multi_adapter(void) IDirect3D8_Release(d3d); }
+static void test_creation_parameters(void) +{ + D3DDEVICE_CREATION_PARAMETERS creation_params; + D3DPRESENT_PARAMETERS present_params = {0}; + unsigned int adapter_idx, adapter_count; + IDirect3DDevice8 *device; + DWORD behavior_flags; + IDirect3D8 *d3d; + HWND window; + HRESULT hr; + + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + present_params.BackBufferWidth = 640; + present_params.BackBufferHeight = 480; + present_params.BackBufferFormat = D3DFMT_A8R8G8B8; + present_params.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_params.hDeviceWindow = window; + present_params.Windowed = TRUE; + present_params.EnableAutoDepthStencil = TRUE; + present_params.AutoDepthStencilFormat = D3DFMT_D24S8; + + adapter_count = IDirect3D8_GetAdapterCount(d3d); + for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx) + { + behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING; + if (FAILED(IDirect3D8_CreateDevice(d3d, adapter_idx, D3DDEVTYPE_HAL, window, + behavior_flags, &present_params, &device))) + { + behavior_flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; + if (FAILED(hr = IDirect3D8_CreateDevice(d3d, adapter_idx, D3DDEVTYPE_HAL, window, + behavior_flags, &present_params, &device))) + { + skip("Adapter %u: Failed to create a D3D device, hr %#x.\n", adapter_idx, hr); + break; + } + } + + memset(&creation_params, 0, sizeof(creation_params)); + hr = IDirect3DDevice8_GetCreationParameters(device, &creation_params); + ok(hr == D3D_OK, "Adapter %u: GetCreationParameters failed, hr %#x.\n", adapter_idx, hr); + ok(creation_params.AdapterOrdinal == adapter_idx, + "Adapter %u: Got unexpected adapter ordinal %u.\n", adapter_idx, + creation_params.AdapterOrdinal); + ok(creation_params.DeviceType == D3DDEVTYPE_HAL, + "Adapter %u: Expect device type %#x, got %#x.\n", adapter_idx, D3DDEVTYPE_HAL, + creation_params.DeviceType); + ok(creation_params.hFocusWindow == window, "Adapter %u: Expect focus window %p, got %p.\n", + adapter_idx, window, creation_params.hFocusWindow); + ok(creation_params.BehaviorFlags == behavior_flags, + "Adapter %u: Expect behavior flags %#x, got %#x.\n", adapter_idx, behavior_flags, + creation_params.BehaviorFlags); + + IDirect3DDevice8_Release(device); + } + + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -9986,6 +10049,7 @@ START_TEST(device) test_draw_primitive(); test_get_display_mode(); test_multi_adapter(); + test_creation_parameters();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=67642
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
d3d8: device.c:1002: Test failed: The cursor handle is 00010003
On Fri, 20 Mar 2020 at 15:38, Zhiyi Zhang zzhang@codeweavers.com wrote:
behavior_flags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
if (FAILED(IDirect3D8_CreateDevice(d3d, adapter_idx, D3DDEVTYPE_HAL, window,
behavior_flags, &present_params, &device)))
{
behavior_flags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
if (FAILED(hr = IDirect3D8_CreateDevice(d3d, adapter_idx, D3DDEVTYPE_HAL, window,
behavior_flags, &present_params, &device)))
{
skip("Adapter %u: Failed to create a D3D device, hr %#x.\n", adapter_idx, hr);
break;
}
}
Do we really care that much about the behaviour flags here? It seems tempting to use create_device() and just drop the relevant ok() line instead. On the other hand, if we do really care, there's CREATE_DEVICE_SWVP_ONLY and CREATE_DEVICE_MIXED_ONLY, and we could conceivably introduce CREATE_DEVICE_HWVP_ONLY.