Commit b0350a3f authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Have only one GUID for Wine's OpenGL D3D device.

parent 11666bb5
......@@ -45,27 +45,6 @@ const GUID IID_D3DDEVICE_OpenGL = {
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
};
const GUID IID_D3DDEVICE2_OpenGL = {
0x31416d44,
0x86ae,
0x11d2,
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfb }
};
const GUID IID_D3DDEVICE3_OpenGL = {
0x31416d44,
0x86ae,
0x11d2,
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfc }
};
const GUID IID_D3DDEVICE7_OpenGL = {
0x31416d44,
0x86ae,
0x11d2,
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfd }
};
/* Define this variable if you have an unpatched Mesa 3.0 (patches are available
on Mesa's home page) or version 3.1b.
......@@ -275,26 +254,15 @@ static void fill_device_capabilities(IDirectDrawImpl* ddraw)
HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version)
HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context)
{
D3DDEVICEDESC d1, d2;
char buf[256];
const void *iid = NULL;
switch (interface_version) {
case 1: iid = &IID_D3DDEVICE_OpenGL; break;
case 2: iid = &IID_D3DDEVICE2_OpenGL; break;
case 3: iid = &IID_D3DDEVICE3_OpenGL; break;
case 7: iid = &IID_D3DDEVICE7_OpenGL; break;
}
strcpy(buf, "WINE Direct3DX using OpenGL");
buf[13] = '0' + interface_version;
fill_opengl_caps(&d1);
d2 = d1;
TRACE(" enumerating OpenGL D3DDevice%ld interface (IID %s).\n", interface_version, debugstr_guid(iid));
return cb((LPGUID) iid, buf, "direct3d", &d1, &d2, context);
TRACE(" enumerating OpenGL D3DDevice interface (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL));
return cb((LPIID) &IID_D3DDEVICE_OpenGL, "WINE Direct3DX using OpenGL", "direct3d", &d1, &d2, context);
}
HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context)
......@@ -462,8 +430,7 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
HRESULT
d3ddevice_find(IDirect3DImpl *d3d,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice,
DWORD interface_version)
LPD3DFINDDEVICERESULT lplpD3DDevice)
{
DWORD dwSize;
D3DDEVICEDESC desc;
......@@ -476,23 +443,14 @@ d3ddevice_find(IDirect3DImpl *d3d,
if (lpD3DDFS->dwFlags & D3DFDS_GUID) {
TRACE(" trying to match guid %s.\n", debugstr_guid(&(lpD3DDFS->guid)));
if ((IsEqualGUID( &IID_D3DDEVICE_OpenGL, &(lpD3DDFS->guid)) == 0) &&
(IsEqualGUID( &IID_D3DDEVICE2_OpenGL, &(lpD3DDFS->guid)) == 0) &&
(IsEqualGUID( &IID_D3DDEVICE3_OpenGL, &(lpD3DDFS->guid)) == 0) &&
(IsEqualGUID( &IID_D3DDEVICE7_OpenGL, &(lpD3DDFS->guid)) == 0) &&
(IsEqualGUID(&IID_IDirect3DHALDevice, &(lpD3DDFS->guid)) == 0)) {
TRACE(" no match for this GUID.\n");
return DDERR_INVALIDPARAMS;
}
}
/* Now return our own GUIDs according to Direct3D version */
if (interface_version == 1) {
lplpD3DDevice->guid = IID_D3DDEVICE_OpenGL;
} else if (interface_version == 2) {
lplpD3DDevice->guid = IID_D3DDEVICE2_OpenGL;
} else if (interface_version == 3) {
lplpD3DDevice->guid = IID_D3DDEVICE3_OpenGL;
}
/* Now return our own GUID */
lplpD3DDevice->guid = IID_D3DDEVICE_OpenGL;
fill_opengl_caps(&desc);
dwSize = lplpD3DDevice->ddHwDesc.dwSize;
memset(&(lplpD3DDevice->ddHwDesc), 0, dwSize);
......
......@@ -170,29 +170,9 @@ Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
}
HRESULT WINAPI
Main_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lplpD3DDevice);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lpD3DFDR);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_3_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
Main_IDirect3DImpl_3_2T_1T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lpD3DFDR);
......@@ -497,3 +477,25 @@ Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
return ret;
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lplpD3DDevice);
return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
lpD3DDFS,
lplpD3DDevice);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lpD3DFDR);
return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
lpD3DDFS,
lpD3DFDR);
}
......@@ -78,14 +78,9 @@ Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
HRESULT WINAPI
Main_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
Main_IDirect3DImpl_3_2T_1T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
HRESULT WINAPI
Main_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
......@@ -197,3 +192,13 @@ HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateLight(LPDIRECT3D iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
......@@ -43,45 +43,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define MAX_LIGHTS 8
HRESULT WINAPI
GL_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (d3ddevice_enumerate(lpEnumDevicesCallback, lpUserArg, 1) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI
GL_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (d3ddevice_enumerate(lpEnumDevicesCallback, lpUserArg, 2) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI
GL_IDirect3DImpl_3_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
GL_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (d3ddevice_enumerate(lpEnumDevicesCallback, lpUserArg, 3) != D3DENUMRET_OK)
if (d3ddevice_enumerate(lpEnumDevicesCallback, lpUserArg) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
......@@ -160,48 +130,29 @@ create_device_helper(IDirect3DImpl *This,
ret_value = d3ddevice_create(&lpd3ddev, This, lpDDS);
if (FAILED(ret_value)) return ret_value;
if (IsEqualGUID( &IID_D3DDEVICE_OpenGL, iid )) {
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice);
TRACE(" returning OpenGL D3DDevice %p\n", *obj);
return D3D_OK;
}
if (IsEqualGUID( &IID_D3DDEVICE2_OpenGL, iid )) {
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice2);
TRACE(" returning OpenGL D3DDevice2 %p\n", *obj);
return D3D_OK;
}
if (IsEqualGUID( &IID_D3DDEVICE3_OpenGL, iid )) {
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice3);
TRACE(" returning OpenGL D3DDevice3 %p\n", *obj);
return D3D_OK;
}
if (IsEqualGUID( &IID_D3DDEVICE7_OpenGL, iid )) {
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice7);
TRACE(" returning OpenGL D3DDevice7 %p\n", *obj);
return D3D_OK;
}
if ((iid == NULL) ||
(IsEqualGUID(&IID_D3DDEVICE_OpenGL, iid)) ||
(IsEqualGUID(&IID_IDirect3DHALDevice, iid)) ||
(IsEqualGUID(&IID_IDirect3DTnLHalDevice, iid))) {
switch (interface) {
case 1:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice);
TRACE(" returning OpenGL D3DDevice %p via default / HAL interface\n", *obj);
TRACE(" returning OpenGL D3DDevice %p.\n", *obj);
return D3D_OK;
case 2:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice2);
TRACE(" returning OpenGL D3DDevice2 %p via default / HAL interface\n", *obj);
TRACE(" returning OpenGL D3DDevice2 %p.\n", *obj);
return D3D_OK;
case 3:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice3);
TRACE(" returning OpenGL D3DDevice3 %p via default / HAL interface\n", *obj);
TRACE(" returning OpenGL D3DDevice3 %p.\n", *obj);
return D3D_OK;
case 7:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice7);
TRACE(" returning OpenGL D3DDevice7 %p via default / HAL interface\n", *obj);
TRACE(" returning OpenGL D3DDevice7 %p.\n", *obj);
return D3D_OK;
}
}
......@@ -239,33 +190,13 @@ GL_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
}
HRESULT WINAPI
GL_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpD3DDFS, lplpD3DDevice);
return d3ddevice_find(This, lpD3DDFS, lplpD3DDevice, 1);
}
HRESULT WINAPI
GL_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpD3DDFS, lpD3DFDR);
return d3ddevice_find(This, lpD3DDFS, lpD3DFDR, 2);
}
HRESULT WINAPI
GL_IDirect3DImpl_3_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
GL_IDirect3DImpl_3_2T_1T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpD3DDFS, lpD3DFDR);
return d3ddevice_find(This, lpD3DDFS, lpD3DFDR, 3);
return d3ddevice_find(This, lpD3DDFS, lpD3DFDR);
}
HRESULT WINAPI
......@@ -381,11 +312,11 @@ ICOM_VTABLE(IDirect3D3) VTABLE_IDirect3D3 =
XCAST(QueryInterface) Thunk_IDirect3DImpl_3_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DImpl_3_AddRef,
XCAST(Release) Thunk_IDirect3DImpl_3_Release,
XCAST(EnumDevices) GL_IDirect3DImpl_3_EnumDevices,
XCAST(EnumDevices) GL_IDirect3DImpl_3_2T_1T_EnumDevices,
XCAST(CreateLight) GL_IDirect3DImpl_3_2T_1T_CreateLight,
XCAST(CreateMaterial) GL_IDirect3DImpl_3_2T_1T_CreateMaterial,
XCAST(CreateViewport) GL_IDirect3DImpl_3_2T_1T_CreateViewport,
XCAST(FindDevice) GL_IDirect3DImpl_3_FindDevice,
XCAST(FindDevice) GL_IDirect3DImpl_3_2T_1T_FindDevice,
XCAST(CreateDevice) GL_IDirect3DImpl_3_CreateDevice,
XCAST(CreateVertexBuffer) Thunk_IDirect3DImpl_3_CreateVertexBuffer,
XCAST(EnumZBufferFormats) Thunk_IDirect3DImpl_3_EnumZBufferFormats,
......@@ -409,11 +340,11 @@ ICOM_VTABLE(IDirect3D2) VTABLE_IDirect3D2 =
XCAST(QueryInterface) Thunk_IDirect3DImpl_2_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DImpl_2_AddRef,
XCAST(Release) Thunk_IDirect3DImpl_2_Release,
XCAST(EnumDevices) GL_IDirect3DImpl_2_EnumDevices,
XCAST(EnumDevices) Thunk_IDirect3DImpl_2_EnumDevices,
XCAST(CreateLight) Thunk_IDirect3DImpl_2_CreateLight,
XCAST(CreateMaterial) Thunk_IDirect3DImpl_2_CreateMaterial,
XCAST(CreateViewport) Thunk_IDirect3DImpl_2_CreateViewport,
XCAST(FindDevice) GL_IDirect3DImpl_2_FindDevice,
XCAST(FindDevice) Thunk_IDirect3DImpl_2_FindDevice,
XCAST(CreateDevice) GL_IDirect3DImpl_2_CreateDevice,
};
......@@ -435,11 +366,11 @@ ICOM_VTABLE(IDirect3D) VTABLE_IDirect3D =
XCAST(AddRef) Thunk_IDirect3DImpl_1_AddRef,
XCAST(Release) Thunk_IDirect3DImpl_1_Release,
XCAST(Initialize) Main_IDirect3DImpl_1_Initialize,
XCAST(EnumDevices) GL_IDirect3DImpl_1_EnumDevices,
XCAST(EnumDevices) Thunk_IDirect3DImpl_1_EnumDevices,
XCAST(CreateLight) Thunk_IDirect3DImpl_1_CreateLight,
XCAST(CreateMaterial) Thunk_IDirect3DImpl_1_CreateMaterial,
XCAST(CreateViewport) Thunk_IDirect3DImpl_1_CreateViewport,
XCAST(FindDevice) GL_IDirect3DImpl_1_FindDevice,
XCAST(FindDevice) Thunk_IDirect3DImpl_1_FindDevice,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
......
......@@ -57,9 +57,6 @@ extern void (*wine_tsx11_unlock_ptr)(void);
#define LEAVE_GL() wine_tsx11_unlock_ptr()
extern const GUID IID_D3DDEVICE_OpenGL;
extern const GUID IID_D3DDEVICE2_OpenGL;
extern const GUID IID_D3DDEVICE3_OpenGL;
extern const GUID IID_D3DDEVICE7_OpenGL;
typedef struct render_state {
/* This is used for the device mode */
......@@ -123,9 +120,9 @@ extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3D
extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface);
/* Used for Direct3D to request the device to enumerate itself */
extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version) ;
extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice, DWORD interface_version);
extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice);
/* Some helper functions.. Would need to put them in a better place */
extern void dump_flexible_vertex(DWORD d3dvtVertexType);
......
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