[PATCH 4/5] dxgi/tests: Use D3D10CreateDevice() to create a device.

Henri Verbeet hverbeet at codeweavers.com
Mon Jan 27 03:07:54 CST 2014


At some point DXGID3D10CreateDevice() started always returning E_NOTIMPL. My
guess would be that that was with the introduction of d3d11.
---
 dlls/dxgi/tests/Makefile.in |    2 +-
 dlls/dxgi/tests/device.c    |   57 +++++++++----------------------------------
 2 files changed, 13 insertions(+), 46 deletions(-)

diff --git a/dlls/dxgi/tests/Makefile.in b/dlls/dxgi/tests/Makefile.in
index c624fec..d706f16 100644
--- a/dlls/dxgi/tests/Makefile.in
+++ b/dlls/dxgi/tests/Makefile.in
@@ -1,5 +1,5 @@
 TESTDLL   = dxgi.dll
-IMPORTS   = dxgi user32
+IMPORTS   = d3d10 dxgi user32
 
 C_SRCS = \
 	device.c
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 9be59db..5c048e7 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -21,58 +21,25 @@
 #include "d3d10.h"
 #include "wine/test.h"
 
-HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory,
-        IDXGIAdapter *adapter, UINT flags, void *unknown0, void **device);
-
 static IDXGIDevice *create_device(HMODULE d3d10core)
 {
-    IDXGIDevice *dxgi_device = NULL;
-    IDXGIFactory *factory = NULL;
-    IDXGIAdapter *adapter = NULL;
-    IUnknown *device = NULL;
+    IDXGIDevice *dxgi_device;
+    ID3D10Device *device;
     HRESULT hr;
 
-    hr = CreateDXGIFactory(&IID_IDXGIFactory, (void *)&factory);
-    if (FAILED(hr)) goto cleanup;
+    if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
+        goto success;
+    if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_WARP, NULL, 0, D3D10_SDK_VERSION, &device)))
+        goto success;
+    if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
+        goto success;
 
-    hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter);
-    if (SUCCEEDED(hr))
-    {
-        hr = DXGID3D10CreateDevice(d3d10core, factory, adapter, 0, NULL, (void **)&device);
-    }
+    return NULL;
 
-    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 = DXGID3D10CreateDevice(d3d10core, factory, adapter, 0, NULL, (void **)&device);
-        ok(SUCCEEDED(hr), "Failed to create a REF device, hr %#x\n", hr);
-        if (FAILED(hr)) goto cleanup;
-    }
-
-    hr = IUnknown_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
+success:
+    hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
     ok(SUCCEEDED(hr), "Created device does not implement IDXGIDevice\n");
-    IUnknown_Release(device);
-
-cleanup:
-    if (adapter) IDXGIAdapter_Release(adapter);
-    if (factory) IDXGIFactory_Release(factory);
+    ID3D10Device_Release(device);
 
     return dxgi_device;
 }
-- 
1.7.10.4




More information about the wine-patches mailing list