Commit a990dbfa authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw/tests: Use a TnLHal device only if supported in ddraw7 tests.

Intel GPUs don't support d3d7 hardware vertexprocessing on Windows. In d3d8 and d3d9 it is available starting with i965 chips, but for some reason the driver does not expose this for d3d7.
parent 0e7f3943
......@@ -202,6 +202,17 @@ static IDirectDraw7 *create_ddraw(void)
return ddraw;
}
static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 *desc, void *ctx)
{
BOOL *hal_ok = ctx;
if (IsEqualGUID(&desc->deviceGUID, &IID_IDirect3DTnLHalDevice))
{
*hal_ok = TRUE;
return DDENUMRET_CANCEL;
}
return DDENUMRET_OK;
}
static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
{
IDirectDrawSurface7 *surface, *ds;
......@@ -211,6 +222,8 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
IDirectDraw7 *ddraw;
IDirect3D7 *d3d7;
HRESULT hr;
BOOL hal_ok = FALSE;
const GUID *devtype = &IID_IDirect3DHALDevice;
if (!(ddraw = create_ddraw()))
return NULL;
......@@ -249,8 +262,12 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
return NULL;
}
hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &hal_ok);
ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
if (hal_ok) devtype = &IID_IDirect3DTnLHalDevice;
memset(&z_fmt, 0, sizeof(z_fmt));
hr = IDirect3D7_EnumZBufferFormats(d3d7, &IID_IDirect3DTnLHalDevice, enum_z_fmt, &z_fmt);
hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt);
if (FAILED(hr) || !z_fmt.dwSize)
{
IDirect3D7_Release(d3d7);
......@@ -284,7 +301,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
return NULL;
}
hr = IDirect3D7_CreateDevice(d3d7, &IID_IDirect3DTnLHalDevice, surface, &device);
hr = IDirect3D7_CreateDevice(d3d7, devtype, surface, &device);
IDirect3D7_Release(d3d7);
IDirectDrawSurface7_Release(surface);
if (FAILED(hr))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment