Commit 8c735b9b authored by Peter Hunnisett's avatar Peter Hunnisett Committed by Alexandre Julliard

- Added ability to create 3D3 interfaces for Xlib

- Changed DD_OK to D3D_OK in some places for consistency - Cleaned up some compiler warnings present without DGA2 - Changed order for DirectDrawEnumerateExA to enumerate at least what abilities are known rather than bailing on unsupported flags - Added DirectDrawCreateEx stub
parent f1d467a3
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
*/ */
typedef struct IDirect3DImpl IDirect3DImpl; typedef struct IDirect3DImpl IDirect3DImpl;
typedef struct IDirect3D2Impl IDirect3D2Impl; typedef struct IDirect3D2Impl IDirect3D2Impl;
typedef struct IDirect3D3Impl IDirect3D3Impl;
typedef struct IDirect3DLightImpl IDirect3DLightImpl; typedef struct IDirect3DLightImpl IDirect3DLightImpl;
typedef struct IDirect3DMaterial2Impl IDirect3DMaterial2Impl; typedef struct IDirect3DMaterial2Impl IDirect3DMaterial2Impl;
typedef struct IDirect3DTexture2Impl IDirect3DTexture2Impl; typedef struct IDirect3DTexture2Impl IDirect3DTexture2Impl;
...@@ -28,6 +30,7 @@ typedef struct IDirect3DDevice2Impl IDirect3DDevice2Impl; ...@@ -28,6 +30,7 @@ typedef struct IDirect3DDevice2Impl IDirect3DDevice2Impl;
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt; extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt; extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
/***************************************************************************** /*****************************************************************************
* IDirect3D implementation structure * IDirect3D implementation structure
...@@ -55,6 +58,18 @@ struct IDirect3D2Impl ...@@ -55,6 +58,18 @@ struct IDirect3D2Impl
LPVOID private; LPVOID private;
}; };
struct IDirect3D3Impl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3D3);
DWORD ref;
/* IDirect3D2 fields */
IDirectDrawImpl* ddraw;
LPVOID private;
/* IDirect3D3 fields */
};
extern HRESULT WINAPI IDirect3DImpl_QueryInterface( extern HRESULT WINAPI IDirect3DImpl_QueryInterface(
LPDIRECT3D iface,REFIID refiid,LPVOID *obj LPDIRECT3D iface,REFIID refiid,LPVOID *obj
); );
......
...@@ -13,10 +13,11 @@ import x11drv.dll ...@@ -13,10 +13,11 @@ import x11drv.dll
@ stub DSoundHelp @ stub DSoundHelp
@ stdcall DirectDrawCreate(ptr ptr ptr) DirectDrawCreate @ stdcall DirectDrawCreate(ptr ptr ptr) DirectDrawCreate
@ stdcall DirectDrawCreateClipper(long ptr ptr) DirectDrawCreateClipper @ stdcall DirectDrawCreateClipper(long ptr ptr) DirectDrawCreateClipper
@ stdcall DirectDrawCreateEx(ptr ptr ptr ptr) DirectDrawCreateEx
@ stdcall DirectDrawEnumerateA(ptr ptr) DirectDrawEnumerateA @ stdcall DirectDrawEnumerateA(ptr ptr) DirectDrawEnumerateA
@ stdcall DirectDrawEnumerateW(ptr ptr) DirectDrawEnumerateW
@ stdcall DirectDrawEnumerateExA(ptr ptr long) DirectDrawEnumerateExA @ stdcall DirectDrawEnumerateExA(ptr ptr long) DirectDrawEnumerateExA
@ stdcall DirectDrawEnumerateExW(ptr ptr long) DirectDrawEnumerateExW @ stdcall DirectDrawEnumerateExW(ptr ptr long) DirectDrawEnumerateExW
@ stdcall DirectDrawEnumerateW(ptr ptr) DirectDrawEnumerateW
@ stdcall DllCanUnloadNow() DDRAW_DllCanUnloadNow @ stdcall DllCanUnloadNow() DDRAW_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) DDRAW_DllGetClassObject @ stdcall DllGetClassObject(ptr ptr ptr) DDRAW_DllGetClassObject
@ stub GetNextMipMap @ stub GetNextMipMap
......
...@@ -655,6 +655,8 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface( ...@@ -655,6 +655,8 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
return create_direct3d(obj,This); return create_direct3d(obj,This);
if ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
return create_direct3d2(obj,This); return create_direct3d2(obj,This);
if ( IsEqualGUID( &IID_IDirect3D3, refiid ) )
return create_direct3d3(obj,This);
#endif #endif
FIXME("(%p):interface for IID %s _NOT_ found!\n",This,debugstr_guid(refiid)); FIXME("(%p):interface for IID %s _NOT_ found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
......
...@@ -81,9 +81,9 @@ static HRESULT WINAPI MESA_IDirect3DImpl_EnumDevices( ...@@ -81,9 +81,9 @@ static HRESULT WINAPI MESA_IDirect3DImpl_EnumDevices(
/* Call functions defined in d3ddevices.c */ /* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL_dx3(cb, context)) if (!d3d_OpenGL_dx3(cb, context))
return DD_OK; return D3D_OK;
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3DImpl_CreateLight( static HRESULT WINAPI MESA_IDirect3DImpl_CreateLight(
...@@ -95,7 +95,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateLight( ...@@ -95,7 +95,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateLight(
/* Call the creation function that is located in d3dlight.c */ /* Call the creation function that is located in d3dlight.c */
*lplight = d3dlight_create_dx3(This); *lplight = d3dlight_create_dx3(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3DImpl_CreateMaterial( static HRESULT WINAPI MESA_IDirect3DImpl_CreateMaterial(
...@@ -105,7 +105,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateMaterial( ...@@ -105,7 +105,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateMaterial(
TRACE("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk); TRACE("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
/* Call the creation function that is located in d3dviewport.c */ /* Call the creation function that is located in d3dviewport.c */
*lpmaterial = d3dmaterial_create(This); *lpmaterial = d3dmaterial_create(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3DImpl_CreateViewport( static HRESULT WINAPI MESA_IDirect3DImpl_CreateViewport(
...@@ -117,7 +117,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateViewport( ...@@ -117,7 +117,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_CreateViewport(
/* Call the creation function that is located in d3dviewport.c */ /* Call the creation function that is located in d3dviewport.c */
*lpviewport = d3dviewport_create(This); *lpviewport = d3dviewport_create(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice( static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
...@@ -127,7 +127,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice( ...@@ -127,7 +127,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
ICOM_THIS(IDirect3DImpl,iface); ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst); FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK; return D3D_OK;
} }
ICOM_VTABLE(IDirect3D) mesa_d3dvt = ICOM_VTABLE(IDirect3D) mesa_d3dvt =
...@@ -209,8 +209,8 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_EnumDevices( ...@@ -209,8 +209,8 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_EnumDevices(
/* Call functions defined in d3ddevices.c */ /* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL(cb, context)) if (!d3d_OpenGL(cb, context))
return DD_OK; return D3D_OK;
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateLight( static HRESULT WINAPI MESA_IDirect3D2Impl_CreateLight(
...@@ -222,7 +222,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateLight( ...@@ -222,7 +222,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateLight(
/* Call the creation function that is located in d3dlight.c */ /* Call the creation function that is located in d3dlight.c */
*lplight = d3dlight_create(This); *lplight = d3dlight_create(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateMaterial( static HRESULT WINAPI MESA_IDirect3D2Impl_CreateMaterial(
...@@ -234,7 +234,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateMaterial( ...@@ -234,7 +234,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateMaterial(
/* Call the creation function that is located in d3dviewport.c */ /* Call the creation function that is located in d3dviewport.c */
*lpmaterial = d3dmaterial2_create(This); *lpmaterial = d3dmaterial2_create(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateViewport( static HRESULT WINAPI MESA_IDirect3D2Impl_CreateViewport(
...@@ -246,7 +246,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateViewport( ...@@ -246,7 +246,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateViewport(
/* Call the creation function that is located in d3dviewport.c */ /* Call the creation function that is located in d3dviewport.c */
*lpviewport = d3dviewport2_create(This); *lpviewport = d3dviewport2_create(This);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice( static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice(
...@@ -255,7 +255,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice( ...@@ -255,7 +255,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice(
{ {
ICOM_THIS(IDirect3D2Impl,iface); ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst); FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK; return D3D_OK;
} }
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice( static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice(
...@@ -268,7 +268,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice( ...@@ -268,7 +268,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice(
if (is_OpenGL(rguid, (IDirectDrawSurfaceImpl*)surface, (IDirect3DDevice2Impl**)device, This)) { if (is_OpenGL(rguid, (IDirectDrawSurfaceImpl*)surface, (IDirect3DDevice2Impl**)device, This)) {
IDirect3D2_AddRef(iface); IDirect3D2_AddRef(iface);
return DD_OK; return D3D_OK;
} }
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
...@@ -288,6 +288,53 @@ ICOM_VTABLE(IDirect3D2) mesa_d3d2vt = ...@@ -288,6 +288,53 @@ ICOM_VTABLE(IDirect3D2) mesa_d3d2vt =
MESA_IDirect3D2Impl_CreateDevice MESA_IDirect3D2Impl_CreateDevice
}; };
static HRESULT WINAPI MESA_IDirect3D3Impl_CreateVertexBuffer(
LPDIRECT3D3 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER* lplpD3DVertBuf,
DWORD dwFlags,
LPUNKNOWN lpUnk)
{
FIXME(":stub\n");
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D3Impl_EnumZBufferFormats(
LPDIRECT3D3 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext)
{
FIXME(":stub\n");
return DDERR_NOZBUFFERHW; /* Pretend we don't have valid HW */
}
static HRESULT WINAPI MESA_IDirect3D3Impl_EvictManagedTextures(
LPDIRECT3D3 iface)
{
FIXME(":stub\n");
return D3D_OK;
}
ICOM_VTABLE(IDirect3D3) mesa_d3d3vt =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
MESA_IDirect3D2Impl_QueryInterface,
IDirect3D2Impl_AddRef,
MESA_IDirect3D2Impl_Release,
MESA_IDirect3D2Impl_EnumDevices,
MESA_IDirect3D2Impl_CreateLight,
MESA_IDirect3D2Impl_CreateMaterial,
MESA_IDirect3D2Impl_CreateViewport,
MESA_IDirect3D2Impl_FindDevice,
MESA_IDirect3D2Impl_CreateDevice,
MESA_IDirect3D3Impl_CreateVertexBuffer,
MESA_IDirect3D3Impl_EnumZBufferFormats,
MESA_IDirect3D3Impl_EvictManagedTextures
};
HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl* ddraw) { HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl* ddraw) {
IDirect3DImpl* d3d; IDirect3DImpl* d3d;
...@@ -315,3 +362,21 @@ HRESULT create_direct3d2(LPVOID *obj,IDirectDraw2Impl* ddraw) { ...@@ -315,3 +362,21 @@ HRESULT create_direct3d2(LPVOID *obj,IDirectDraw2Impl* ddraw) {
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj); TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
return S_OK; return S_OK;
} }
HRESULT create_direct3d3(LPVOID *obj,IDirectDraw2Impl* ddraw) {
IDirect3D3Impl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = ddraw;
d3d->private = NULL; /* unused for now */
IDirectDraw_AddRef((LPDIRECTDRAW)ddraw);
ICOM_VTBL(d3d) = &mesa_d3d3vt;
*obj = (LPUNKNOWN)d3d;
TRACE(" Creating IDirect3D3 interface (%p)\n", *obj);
return S_OK;
}
...@@ -70,21 +70,7 @@ HRESULT WINAPI DirectDrawEnumerateExA( ...@@ -70,21 +70,7 @@ HRESULT WINAPI DirectDrawEnumerateExA(
DPRINTF("\n"); DPRINTF("\n");
} }
if (dwFlags & DDENUM_NONDISPLAYDEVICES) { /* Invoke callback for what flags we do support */
FIXME("no non-display devices supported.\n");
return DD_OK;
}
/* Hmm. Leave this out.
if (dwFlags & DDENUM_ATTACHEDSECONDARYDEVICES) {
FIXME("no attached secondary devices supported.\n");
return DD_OK;
}
*/
if (dwFlags & DDENUM_DETACHEDSECONDARYDEVICES) {
FIXME("no detached secondary devices supported.\n");
return DD_OK;
}
for (i=0;i<MAX_DDRAW_DRIVERS;i++) { for (i=0;i<MAX_DDRAW_DRIVERS;i++) {
if (!ddraw_drivers[i]) if (!ddraw_drivers[i])
continue; continue;
...@@ -105,6 +91,20 @@ HRESULT WINAPI DirectDrawEnumerateExA( ...@@ -105,6 +91,20 @@ HRESULT WINAPI DirectDrawEnumerateExA(
if (!lpCallback(NULL,"WINE (default)", "display", lpContext, 0)) if (!lpCallback(NULL,"WINE (default)", "display", lpContext, 0))
return DD_OK; return DD_OK;
} }
/* Unsupported flags */
if (dwFlags & DDENUM_NONDISPLAYDEVICES) {
FIXME("no non-display devices supported.\n");
}
/* Hmm. Leave this out.
if (dwFlags & DDENUM_ATTACHEDSECONDARYDEVICES) {
FIXME("no attached secondary devices supported.\n");
}
*/
if (dwFlags & DDENUM_DETACHEDSECONDARYDEVICES) {
FIXME("no detached secondary devices supported.\n");
}
return DD_OK; return DD_OK;
} }
...@@ -269,7 +269,8 @@ HRESULT WINAPI DirectDrawCreate( ...@@ -269,7 +269,8 @@ HRESULT WINAPI DirectDrawCreate(
( IsEqualGUID( &zeroGUID, lpGUID ) ) || ( IsEqualGUID( &zeroGUID, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw, lpGUID ) ) || ( IsEqualGUID( &IID_IDirectDraw, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw2, lpGUID ) ) || ( IsEqualGUID( &IID_IDirectDraw2, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, lpGUID ) ) ( IsEqualGUID( &IID_IDirectDraw4, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw7, lpGUID ) )
) { ) {
/* choose an interface out of the list */ /* choose an interface out of the list */
for (i=0;i<nrof_ddraw_drivers;i++) { for (i=0;i<nrof_ddraw_drivers;i++) {
...@@ -323,6 +324,15 @@ HRESULT WINAPI DirectDrawCreate( ...@@ -323,6 +324,15 @@ HRESULT WINAPI DirectDrawCreate(
return ret; return ret;
} }
HRESULT WINAPI DirectDrawCreateEx(
LPGUID lpGUID, LPVOID* lplpDD, REFIID iid, LPUNKNOWN pUnkOuter
) {
FIXME(":semi stub\n");
/* I don't know about what functionality is unique to Ex */
return DirectDrawCreate(lpGUID,(LPDIRECTDRAW)lplpDD,pUnkOuter);
}
/******************************************************************************* /*******************************************************************************
* DirectDraw ClassFactory * DirectDraw ClassFactory
* *
......
...@@ -148,4 +148,6 @@ static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = { ...@@ -148,4 +148,6 @@ static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = {
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt; extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt; extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
#endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */ #endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */
...@@ -1825,6 +1825,7 @@ ICOM_DEFINE(IDirectDrawColorControl,IUnknown) ...@@ -1825,6 +1825,7 @@ ICOM_DEFINE(IDirectDrawColorControl,IUnknown)
HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN); HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN);
HRESULT WINAPI DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID); HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID);
HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID); HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID);
#define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) #define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate)
......
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