Module: wine Branch: master Commit: 80ce3b319a0b62016e91abc438d577b866154f83 URL: http://source.winehq.org/git/wine.git/?a=commit;h=80ce3b319a0b62016e91abc438...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Jan 27 10:07:55 2014 +0100
d3d10core/tests: Use D3D10CreateDevice() to create a device.
---
dlls/d3d10core/tests/Makefile.in | 2 +- dlls/d3d10core/tests/device.c | 55 ++++++-------------------------------- 2 files changed, 9 insertions(+), 48 deletions(-)
diff --git a/dlls/d3d10core/tests/Makefile.in b/dlls/d3d10core/tests/Makefile.in index 0dfec79..ca96a25 100644 --- a/dlls/d3d10core/tests/Makefile.in +++ b/dlls/d3d10core/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = d3d10core.dll -IMPORTS = d3d10core dxgi +IMPORTS = d3d10
C_SRCS = \ device.c diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 63b65bc..8278afc 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -21,57 +21,18 @@ #include "d3d10.h" #include "wine/test.h"
-HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter, - UINT flags, void *unknown0, ID3D10Device **device); - static ID3D10Device *create_device(void) { - IDXGIFactory *factory = NULL; - IDXGIAdapter *adapter = NULL; - ID3D10Device *device = NULL; - HRESULT hr; - - hr = CreateDXGIFactory(&IID_IDXGIFactory, (void *)&factory); - if (FAILED(hr)) goto cleanup; - - hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter); - 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; - } + ID3D10Device *device;
-cleanup: - if (adapter) IDXGIAdapter_Release(adapter); - if (factory) IDXGIFactory_Release(factory); + if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device))) + 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;
- return device; + return NULL; }
static void test_device_interfaces(void)