d3d9: Report d3d9 adapter ordinal in d3d9_device_GetCreationParameters().

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-03-22 20:18:25 +08:00 committed by Alexandre Julliard
parent c8889fb9fb
commit 669cac9852
2 changed files with 49 additions and 0 deletions

View File

@ -778,6 +778,7 @@ static HRESULT WINAPI d3d9_device_GetCreationParameters(IDirect3DDevice9Ex *ifac
(struct wined3d_device_creation_parameters *)parameters);
wined3d_mutex_unlock();
parameters->AdapterOrdinal = device->adapter_ordinal;
return D3D_OK;
}

View File

@ -13609,6 +13609,53 @@ static void test_shader_validator(void)
todo_wine ok(!refcount, "Validator has %u references left.\n", refcount);
}
static void test_creation_parameters(void)
{
unsigned int adapter_idx, adapter_count;
D3DDEVICE_CREATION_PARAMETERS params;
struct device_desc device_desc;
IDirect3DDevice9 *device;
IDirect3D9 *d3d;
HWND window;
HRESULT hr;
window = create_window();
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
device_desc.device_window = window;
device_desc.width = 640;
device_desc.height = 480;
device_desc.flags = 0;
adapter_count = IDirect3D9_GetAdapterCount(d3d);
for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx)
{
device_desc.adapter_ordinal = adapter_idx;
if (!(device = create_device(d3d, window, &device_desc)))
{
skip("Adapter %u: Failed to create a D3D device.\n", adapter_idx);
break;
}
memset(&params, 0, sizeof(params));
hr = IDirect3DDevice9_GetCreationParameters(device, &params);
ok(hr == D3D_OK, "Adapter %u: GetCreationParameters failed, hr %#x.\n", adapter_idx, hr);
ok(params.AdapterOrdinal == adapter_idx, "Adapter %u: Got unexpected adapter ordinal %u.\n",
adapter_idx, params.AdapterOrdinal);
ok(params.DeviceType == D3DDEVTYPE_HAL, "Adapter %u: Expect device type %#x, got %#x.\n",
adapter_idx, D3DDEVTYPE_HAL, params.DeviceType);
ok(params.hFocusWindow == window, "Adapter %u: Expect focus window %p, got %p.\n",
adapter_idx, window, params.hFocusWindow);
IDirect3DDevice9_Release(device);
}
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
START_TEST(device)
{
HMODULE d3d9_handle = GetModuleHandleA("d3d9.dll");
@ -13741,6 +13788,7 @@ START_TEST(device)
test_get_display_mode();
test_multi_adapter();
test_shader_validator();
test_creation_parameters();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL));
}