mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
ddraw: Enumerate additional devices in IDirect3D7_EnumDevices.
This commit is contained in:
parent
8d32a490a1
commit
019cc506a8
@ -230,7 +230,7 @@ IDirect3DImpl_1_Initialize(IDirect3D *iface,
|
||||
* IDirect3D7::EnumDevices
|
||||
*
|
||||
* The EnumDevices method for IDirect3D7. It enumerates all supported
|
||||
* D3D7 devices. Currently there's only one.
|
||||
* D3D7 devices. Currently the T&L, HAL and RGB devices are enumerated.
|
||||
*
|
||||
* Params:
|
||||
* Callback: Function to call for each enumerated device
|
||||
@ -246,8 +246,12 @@ IDirect3DImpl_7_EnumDevices(IDirect3D7 *iface,
|
||||
void *Context)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
|
||||
char interface_name[] = "WINE Direct3D7 using WineD3D";
|
||||
char device_name[] = "Wine D3D7 device";
|
||||
char interface_name_tnl[] = "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D";
|
||||
char device_name_tnl[] = "Wine D3D7 T&L HAL";
|
||||
char interface_name_hal[] = "WINE Direct3D7 Hardware acceleration using WineD3D";
|
||||
char device_name_hal[] = "Wine D3D7 HAL";
|
||||
char interface_name_rgb[] = "WINE Direct3D7 RGB Software Emulation using WineD3D";
|
||||
char device_name_rgb[] = "Wine D3D7 RGB";
|
||||
D3DDEVICEDESC7 ddesc;
|
||||
D3DDEVICEDESC oldDesc;
|
||||
HRESULT hr;
|
||||
@ -262,7 +266,13 @@ IDirect3DImpl_7_EnumDevices(IDirect3D7 *iface,
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr;
|
||||
}
|
||||
Callback(interface_name, device_name, &ddesc, Context);
|
||||
Callback(interface_name_tnl, device_name_tnl, &ddesc, Context);
|
||||
|
||||
ddesc.deviceGUID = IID_IDirect3DHALDevice;
|
||||
Callback(interface_name_hal, device_name_hal, &ddesc, Context);
|
||||
|
||||
ddesc.deviceGUID = IID_IDirect3DRGBDevice;
|
||||
Callback(interface_name_rgb, device_name_rgb, &ddesc, Context);
|
||||
|
||||
TRACE("(%p) End of enumeration\n", This);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
|
@ -33,6 +33,14 @@ static LPDIRECT3DVERTEXBUFFER7 lpVBufSrc = NULL;
|
||||
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest1 = NULL;
|
||||
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest2 = NULL;
|
||||
|
||||
typedef struct {
|
||||
int total;
|
||||
int rgb;
|
||||
int hal;
|
||||
int tnlhal;
|
||||
int unk;
|
||||
} D3D7ETest;
|
||||
|
||||
/* To compare bad floating point numbers. Not the ideal way to do it,
|
||||
* but it should be enough for here */
|
||||
#define comparefloat(a, b) ( (((a) - (b)) < 0.0001) && (((a) - (b)) > -0.0001) )
|
||||
@ -789,6 +797,51 @@ static HRESULT WINAPI enumDevicesCallback(GUID *Guid,LPSTR DeviceDescription,LPS
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI enumDevicesCallbackTest7(LPSTR DeviceDescription, LPSTR DeviceName, LPD3DDEVICEDESC7 lpdd7, LPVOID Context)
|
||||
{
|
||||
D3D7ETest *d3d7et = (D3D7ETest*)Context;
|
||||
if(IsEqualGUID(&lpdd7->deviceGUID, &IID_IDirect3DRGBDevice))
|
||||
d3d7et->rgb++;
|
||||
else if(IsEqualGUID(&lpdd7->deviceGUID, &IID_IDirect3DHALDevice))
|
||||
d3d7et->hal++;
|
||||
else if(IsEqualGUID(&lpdd7->deviceGUID, &IID_IDirect3DTnLHalDevice))
|
||||
d3d7et->tnlhal++;
|
||||
else
|
||||
d3d7et->unk++;
|
||||
|
||||
d3d7et->total++;
|
||||
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
|
||||
/* Check the deviceGUID of devices enumerated by
|
||||
IDirect3D7_EnumDevices. */
|
||||
static void D3D7EnumTest(void)
|
||||
{
|
||||
D3D7ETest d3d7et;
|
||||
|
||||
if (!lpD3D) {
|
||||
skip("No Direct3D7 interface.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&d3d7et, 0, sizeof(d3d7et));
|
||||
IDirect3D7_EnumDevices(lpD3D, enumDevicesCallbackTest7, (LPVOID) &d3d7et);
|
||||
|
||||
|
||||
/* A couple of games (Delta Force LW and TFD) rely on this behaviour */
|
||||
ok(d3d7et.tnlhal < d3d7et.total, "TnLHal device enumerated as only device.\n");
|
||||
|
||||
/* We make two additional assumptions. */
|
||||
ok(d3d7et.rgb, "No RGB Device enumerated.\n");
|
||||
|
||||
if(d3d7et.tnlhal)
|
||||
ok(d3d7et.hal, "TnLHal device enumerated, but no Hal device found.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void CapsTest(void)
|
||||
{
|
||||
IDirect3D3 *d3d3;
|
||||
@ -1221,6 +1274,7 @@ START_TEST(d3d)
|
||||
StateTest();
|
||||
SceneTest();
|
||||
LimitTest();
|
||||
D3D7EnumTest();
|
||||
CapsTest();
|
||||
ReleaseDirect3D();
|
||||
Direct3D1Test();
|
||||
|
Loading…
Reference in New Issue
Block a user