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

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-08-19 18:40:33 +01:00 committed by Alexandre Julliard
parent 67ee1d3fd8
commit 91d72e0841
2 changed files with 13 additions and 4 deletions

View file

@ -1,5 +1,5 @@
TESTDLL = d3dx10_43.dll
IMPORTS = d3dx10 d3d10
IMPORTS = d3dx10
C_SRCS = \
d3dx10.c

View file

@ -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;