Huw Davies : d3dx10/tests: Dynamically load d3d10 and skip if it' s not present.

Alexandre Julliard julliard at winehq.org
Mon Aug 22 10:24:12 CDT 2016


Module: wine
Branch: master
Commit: 91d72e08413242781b81d1b203daec0acb3a072e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=91d72e08413242781b81d1b203daec0acb3a072e

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Aug 19 18:40:33 2016 +0100

d3dx10/tests: Dynamically load d3d10 and skip if it's not present.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx10_43/tests/Makefile.in |  2 +-
 dlls/d3dx10_43/tests/d3dx10.c    | 15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/d3dx10_43/tests/Makefile.in b/dlls/d3dx10_43/tests/Makefile.in
index d135a7a..f9f988f 100644
--- a/dlls/d3dx10_43/tests/Makefile.in
+++ b/dlls/d3dx10_43/tests/Makefile.in
@@ -1,5 +1,5 @@
 TESTDLL = d3dx10_43.dll
-IMPORTS = d3dx10 d3d10
+IMPORTS = d3dx10
 
 C_SRCS = \
 	d3dx10.c
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 423ab4d..d91dbdc 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -41,12 +41,21 @@ static BOOL compare_float(float f, float g, unsigned int ulps)
 static ID3D10Device *create_device(void)
 {
     ID3D10Device *device;
+    HMODULE d3d10_mod = LoadLibraryA("d3d10.dll");
+    HRESULT (WINAPI *pD3D10CreateDevice)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **);
 
-    if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
+    if (!d3d10_mod)
+    {
+        win_skip("d3d10.dll not present\n");
+        return NULL;
+    }
+
+    pD3D10CreateDevice = (void *)GetProcAddress(d3d10_mod, "D3D10CreateDevice");
+    if (SUCCEEDED(pD3D10CreateDevice(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)))
+    if (SUCCEEDED(pD3D10CreateDevice(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)))
+    if (SUCCEEDED(pD3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
         return device;
 
     return NULL;




More information about the wine-cvs mailing list