d3d10core/tests: Use D3D10CreateDevice() to create a device.

This commit is contained in:
Henri Verbeet 2014-01-27 10:07:55 +01:00 committed by Alexandre Julliard
parent 2d06703dc7
commit 80ce3b319a
2 changed files with 9 additions and 48 deletions

View File

@ -1,5 +1,5 @@
TESTDLL = d3d10core.dll TESTDLL = d3d10core.dll
IMPORTS = d3d10core dxgi IMPORTS = d3d10
C_SRCS = \ C_SRCS = \
device.c device.c

View File

@ -21,57 +21,18 @@
#include "d3d10.h" #include "d3d10.h"
#include "wine/test.h" #include "wine/test.h"
HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
UINT flags, void *unknown0, ID3D10Device **device);
static ID3D10Device *create_device(void) static ID3D10Device *create_device(void)
{ {
IDXGIFactory *factory = NULL; ID3D10Device *device;
IDXGIAdapter *adapter = NULL;
ID3D10Device *device = NULL;
HRESULT hr;
hr = CreateDXGIFactory(&IID_IDXGIFactory, (void *)&factory); if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
if (FAILED(hr)) goto cleanup; return device;
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_WARP, NULL, 0, D3D10_SDK_VERSION, &device)))
return device;
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
return device;
hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter); return NULL;
ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_FOUND, /* Some VMware and VirtualBox */
"EnumAdapters failed, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
hr = D3D10CoreCreateDevice(factory, adapter, 0, NULL, &device);
}
if (FAILED(hr))
{
HMODULE d3d10ref;
trace("Failed to create a HW device, trying REF\n");
if (adapter) IDXGIAdapter_Release(adapter);
adapter = NULL;
d3d10ref = LoadLibraryA("d3d10ref.dll");
if (!d3d10ref)
{
trace("d3d10ref.dll not available, unable to create a REF device\n");
goto cleanup;
}
hr = IDXGIFactory_CreateSoftwareAdapter(factory, d3d10ref, &adapter);
FreeLibrary(d3d10ref);
ok(SUCCEEDED(hr), "CreateSoftwareAdapter failed, hr %#x\n", hr);
if (FAILED(hr)) goto cleanup;
hr = D3D10CoreCreateDevice(factory, adapter, 0, NULL, &device);
ok(SUCCEEDED(hr), "Failed to create a REF device, hr %#x\n", hr);
if (FAILED(hr)) goto cleanup;
}
cleanup:
if (adapter) IDXGIAdapter_Release(adapter);
if (factory) IDXGIFactory_Release(factory);
return device;
} }
static void test_device_interfaces(void) static void test_device_interfaces(void)