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 @@
*/
typedef struct IDirect3DImpl IDirect3DImpl;
typedef struct IDirect3D2Impl IDirect3D2Impl;
typedef struct IDirect3D3Impl IDirect3D3Impl;
typedef struct IDirect3DLightImpl IDirect3DLightImpl;
typedef struct IDirect3DMaterial2Impl IDirect3DMaterial2Impl;
typedef struct IDirect3DTexture2Impl IDirect3DTexture2Impl;
......@@ -28,6 +30,7 @@ typedef struct IDirect3DDevice2Impl IDirect3DDevice2Impl;
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
/*****************************************************************************
* IDirect3D implementation structure
......@@ -55,6 +58,18 @@ struct IDirect3D2Impl
LPVOID private;
};
struct IDirect3D3Impl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3D3);
DWORD ref;
/* IDirect3D2 fields */
IDirectDrawImpl* ddraw;
LPVOID private;
/* IDirect3D3 fields */
};
extern HRESULT WINAPI IDirect3DImpl_QueryInterface(
LPDIRECT3D iface,REFIID refiid,LPVOID *obj
);
......
......@@ -13,10 +13,11 @@ import x11drv.dll
@ stub DSoundHelp
@ stdcall DirectDrawCreate(ptr ptr ptr) DirectDrawCreate
@ stdcall DirectDrawCreateClipper(long ptr ptr) DirectDrawCreateClipper
@ stdcall DirectDrawCreateEx(ptr ptr ptr ptr) DirectDrawCreateEx
@ stdcall DirectDrawEnumerateA(ptr ptr) DirectDrawEnumerateA
@ stdcall DirectDrawEnumerateW(ptr ptr) DirectDrawEnumerateW
@ stdcall DirectDrawEnumerateExA(ptr ptr long) DirectDrawEnumerateExA
@ stdcall DirectDrawEnumerateExW(ptr ptr long) DirectDrawEnumerateExW
@ stdcall DirectDrawEnumerateW(ptr ptr) DirectDrawEnumerateW
@ stdcall DllCanUnloadNow() DDRAW_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) DDRAW_DllGetClassObject
@ stub GetNextMipMap
......
......@@ -655,6 +655,8 @@ static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
return create_direct3d(obj,This);
if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
return create_direct3d2(obj,This);
if ( IsEqualGUID( &IID_IDirect3D3, refiid ) )
return create_direct3d3(obj,This);
#endif
FIXME("(%p):interface for IID %s _NOT_ found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE;
......
......@@ -81,9 +81,9 @@ static HRESULT WINAPI MESA_IDirect3DImpl_EnumDevices(
/* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL_dx3(cb, context))
return DD_OK;
return D3D_OK;
return DD_OK;
return D3D_OK;
}
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 */
*lplight = d3dlight_create_dx3(This);
return DD_OK;
return D3D_OK;
}
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);
/* Call the creation function that is located in d3dviewport.c */
*lpmaterial = d3dmaterial_create(This);
return DD_OK;
return D3D_OK;
}
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 */
*lpviewport = d3dviewport_create(This);
return DD_OK;
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
......@@ -127,7 +127,7 @@ static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK;
return D3D_OK;
}
ICOM_VTABLE(IDirect3D) mesa_d3dvt =
......@@ -209,8 +209,8 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_EnumDevices(
/* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL(cb, context))
return DD_OK;
return DD_OK;
return D3D_OK;
return D3D_OK;
}
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 */
*lplight = d3dlight_create(This);
return DD_OK;
return D3D_OK;
}
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 */
*lpmaterial = d3dmaterial2_create(This);
return DD_OK;
return D3D_OK;
}
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 */
*lpviewport = d3dviewport2_create(This);
return DD_OK;
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice(
......@@ -255,7 +255,7 @@ static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice(
{
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK;
return D3D_OK;
}
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)) {
IDirect3D2_AddRef(iface);
return DD_OK;
return D3D_OK;
}
return DDERR_INVALIDPARAMS;
......@@ -288,6 +288,53 @@ ICOM_VTABLE(IDirect3D2) mesa_d3d2vt =
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) {
IDirect3DImpl* d3d;
......@@ -315,3 +362,21 @@ HRESULT create_direct3d2(LPVOID *obj,IDirectDraw2Impl* ddraw) {
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
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(
DPRINTF("\n");
}
if (dwFlags & DDENUM_NONDISPLAYDEVICES) {
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;
}
/* Invoke callback for what flags we do support */
for (i=0;i<MAX_DDRAW_DRIVERS;i++) {
if (!ddraw_drivers[i])
continue;
......@@ -105,6 +91,20 @@ HRESULT WINAPI DirectDrawEnumerateExA(
if (!lpCallback(NULL,"WINE (default)", "display", lpContext, 0))
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;
}
......@@ -269,7 +269,8 @@ HRESULT WINAPI DirectDrawCreate(
( IsEqualGUID( &zeroGUID, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw2, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, lpGUID ) )
( IsEqualGUID( &IID_IDirectDraw4, lpGUID ) ) ||
( IsEqualGUID( &IID_IDirectDraw7, lpGUID ) )
) {
/* choose an interface out of the list */
for (i=0;i<nrof_ddraw_drivers;i++) {
......@@ -323,6 +324,15 @@ HRESULT WINAPI DirectDrawCreate(
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
*
......
......@@ -148,4 +148,6 @@ static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = {
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
#endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */
......@@ -1825,6 +1825,7 @@ ICOM_DEFINE(IDirectDrawColorControl,IUnknown)
HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN);
HRESULT WINAPI DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID);
HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID);
#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