2 * Copyright 2008 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/test.h"
24 HRESULT WINAPI
D3D10CoreCreateDevice(IDXGIFactory
*factory
, IDXGIAdapter
*adapter
,
25 UINT flags
, DWORD unknown0
, ID3D10Device
**device
);
27 static ID3D10Device
*create_device(void)
29 IDXGIFactory
*factory
= NULL
;
30 IDXGIAdapter
*adapter
= NULL
;
31 ID3D10Device
*device
= NULL
;
34 hr
= CreateDXGIFactory(&IID_IDXGIFactory
, (void *)&factory
);
35 if (FAILED(hr
)) goto cleanup
;
37 hr
= IDXGIFactory_EnumAdapters(factory
, 0, &adapter
);
38 ok(SUCCEEDED(hr
), "EnumAdapters failed, hr %#x\n", hr
);
39 if (FAILED(hr
)) goto cleanup
;
41 hr
= D3D10CoreCreateDevice(factory
, adapter
, 0, 0, &device
);
46 trace("Failed to create a HW device, trying REF\n");
47 IDXGIAdapter_Release(adapter
);
50 d3d10ref
= LoadLibraryA("d3d10ref.dll");
53 trace("d3d10ref.dll not available, unable to create a REF device\n");
57 hr
= IDXGIFactory_CreateSoftwareAdapter(factory
, d3d10ref
, &adapter
);
58 FreeLibrary(d3d10ref
);
59 ok(SUCCEEDED(hr
), "CreateSoftwareAdapter failed, hr %#x\n", hr
);
60 if (FAILED(hr
)) goto cleanup
;
62 hr
= D3D10CoreCreateDevice(factory
, adapter
, 0, 0, &device
);
63 ok(SUCCEEDED(hr
), "Failed to create a REF device, hr %#x\n", hr
);
64 if (FAILED(hr
)) goto cleanup
;
68 if (adapter
) IDXGIAdapter_Release(adapter
);
69 if (factory
) IDXGIFactory_Release(factory
);
74 static void test_device_interfaces(ID3D10Device
*device
)
79 if (SUCCEEDED(hr
= ID3D10Device_QueryInterface(device
, &IID_IUnknown
, (void **)&obj
)))
80 IUnknown_Release(obj
);
81 ok(SUCCEEDED(hr
), "ID3D10Device does not implement IUnknown\n");
83 if (SUCCEEDED(hr
= ID3D10Device_QueryInterface(device
, &IID_IDXGIObject
, (void **)&obj
)))
84 IUnknown_Release(obj
);
85 ok(SUCCEEDED(hr
), "ID3D10Device does not implement IDXGIObject\n");
87 if (SUCCEEDED(hr
= ID3D10Device_QueryInterface(device
, &IID_IDXGIDevice
, (void **)&obj
)))
88 IUnknown_Release(obj
);
89 ok(SUCCEEDED(hr
), "ID3D10Device does not implement IDXGIDevice\n");
91 if (SUCCEEDED(hr
= ID3D10Device_QueryInterface(device
, &IID_ID3D10Device
, (void **)&obj
)))
92 IUnknown_Release(obj
);
93 ok(SUCCEEDED(hr
), "ID3D10Device does not implement ID3D10Device\n");
101 device
= create_device();
104 skip("Failed to create device, skipping tests\n");
108 test_device_interfaces(device
);
110 refcount
= ID3D10Device_Release(device
);
111 ok(!refcount
, "Device has %u references left\n", refcount
);