wined3d: Disallow creating devices without adapters in wined3d_device_create().

These days, we have an adapter even with WINED3D_NO3D.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-09-20 02:30:47 +04:30 committed by Alexandre Julliard
parent 8f9a2165e9
commit 859c1d26ce
1 changed files with 3 additions and 4 deletions

View File

@ -2438,12 +2438,11 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, e
struct wined3d_device *object;
HRESULT hr;
TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, surface_alignment %u, device_parent %p, device %p.\n",
TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, "
"flags %#x, surface_alignment %u, device_parent %p, device %p.\n",
wined3d, adapter_idx, device_type, focus_window, flags, surface_alignment, device_parent, device);
/* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
* number and create a device without a 3D adapter for 2D only operation. */
if (wined3d->adapter_count && adapter_idx >= wined3d->adapter_count)
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))