- Clean up all the D3D COM handling (but the underlaying code is still

as ugly as before).
- Handle properly (ie as on real Windows) negative values in
  rectangles during blitting.
This commit is contained in:
Lionel Ulmer 2002-11-21 21:04:16 +00:00 committed by Alexandre Julliard
parent f2abe47d62
commit 43c3dc4d33
22 changed files with 7241 additions and 4840 deletions

View File

@ -18,6 +18,7 @@ OPENGLFILES = \
d3dlight.c \
d3dmaterial.c \
d3dtexture.c \
d3dvertexbuffer.c \
d3dviewport.c \
direct3d/main.c \
direct3d/mesa.c \

View File

@ -30,300 +30,121 @@
* Predeclare the interface implementation structures
*/
typedef struct IDirect3DImpl IDirect3DImpl;
typedef struct IDirect3D2Impl IDirect3D2Impl;
typedef struct IDirect3D3Impl IDirect3D3Impl;
typedef struct IDirect3DLightImpl IDirect3DLightImpl;
typedef struct IDirect3DMaterial2Impl IDirect3DMaterial2Impl;
typedef struct IDirect3DTexture2Impl IDirect3DTexture2Impl;
typedef struct IDirect3DViewport2Impl IDirect3DViewport2Impl;
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
typedef struct IDirect3DTextureImpl IDirect3DTextureImpl;
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
typedef struct IDirect3DDevice2Impl IDirect3DDevice2Impl;
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
#include "ddraw_private.h"
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
/*****************************************************************************
* IDirect3D implementation structure
* IDirect3D implementation structure.
* This is common for interfaces 1, 2, 3 and 7.
*/
struct IDirect3DImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3D);
ICOM_VFIELD_MULTI(IDirect3D7);
ICOM_VFIELD_MULTI(IDirect3D3);
ICOM_VFIELD_MULTI(IDirect3D2);
ICOM_VFIELD_MULTI(IDirect3D);
DWORD ref;
/* IDirect3D fields */
IDirectDrawImpl* ddraw;
LPVOID private;
};
/*****************************************************************************
* IDirect3D2 implementation structure
*/
struct IDirect3D2Impl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3D2);
DWORD ref;
/* IDirect3D2 fields */
IDirectDrawImpl* ddraw;
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
);
extern ULONG WINAPI IDirect3DImpl_AddRef(LPDIRECT3D iface);
extern ULONG WINAPI IDirect3DImpl_Release(LPDIRECT3D iface)
;
extern HRESULT WINAPI IDirect3DImpl_Initialize(LPDIRECT3D iface,REFIID refiid);
extern HRESULT WINAPI IDirect3DImpl_EnumDevices(
LPDIRECT3D iface, LPD3DENUMDEVICESCALLBACK cb, LPVOID context
);
extern HRESULT WINAPI IDirect3DImpl_CreateLight(
LPDIRECT3D iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3DImpl_CreateMaterial(
LPDIRECT3D iface, LPDIRECT3DMATERIAL *lpmaterial, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3DImpl_CreateViewport(
LPDIRECT3D iface, LPDIRECT3DVIEWPORT *lpviewport, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3DImpl_FindDevice(
LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst)
;
extern HRESULT WINAPI IDirect3D2Impl_QueryInterface(LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj);
extern ULONG WINAPI IDirect3D2Impl_AddRef(LPDIRECT3D2 iface);
extern ULONG WINAPI IDirect3D2Impl_Release(LPDIRECT3D2 iface);
extern HRESULT WINAPI IDirect3D2Impl_EnumDevices(
LPDIRECT3D2 iface,LPD3DENUMDEVICESCALLBACK cb, LPVOID context
);
extern HRESULT WINAPI IDirect3D2Impl_CreateLight(
LPDIRECT3D2 iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3D2Impl_CreateMaterial(
LPDIRECT3D2 iface, LPDIRECT3DMATERIAL2 *lpmaterial, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3D2Impl_CreateViewport(
LPDIRECT3D2 iface, LPDIRECT3DVIEWPORT2 *lpviewport, IUnknown *lpunk
);
extern HRESULT WINAPI IDirect3D2Impl_FindDevice(
LPDIRECT3D2 iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst);
extern HRESULT WINAPI IDirect3D2Impl_CreateDevice(
LPDIRECT3D2 iface, REFCLSID rguid, LPDIRECTDRAWSURFACE surface,
LPDIRECT3DDEVICE2 *device);
/*****************************************************************************
* IDirect3DLight implementation structure
*/
struct IDirect3DLightImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DLight);
DWORD ref;
ICOM_VFIELD_MULTI(IDirect3DLight);
DWORD ref;
/* IDirect3DLight fields */
union {
IDirect3DImpl* d3d1;
IDirect3D2Impl* d3d2;
} d3d;
int type;
IDirect3DImpl *d3d;
D3DLIGHT2 light;
D3DLIGHT2 light;
/* Chained list used for adding / removing from viewports */
IDirect3DLightImpl *next, *prev;
IDirect3DLightImpl *next;
/* Activation function */
void (*activate)(IDirect3DLightImpl*);
int is_active;
LPVOID private;
void (*desactivate)(IDirect3DLightImpl*);
void (*update)(IDirect3DLightImpl*);
};
/*****************************************************************************
* IDirect3DMaterial2 implementation structure
* IDirect3DMaterial implementation structure
*/
struct IDirect3DMaterial2Impl
struct IDirect3DMaterialImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DMaterial2);
DWORD ref;
ICOM_VFIELD_MULTI(IDirect3DMaterial3);
ICOM_VFIELD_MULTI(IDirect3DMaterial2);
ICOM_VFIELD_MULTI(IDirect3DMaterial);
DWORD ref;
/* IDirect3DMaterial2 fields */
union {
IDirect3DImpl* d3d1;
IDirect3D2Impl* d3d2;
} d3d;
union {
IDirect3DDeviceImpl* active_device1;
IDirect3DDevice2Impl* active_device2;
} device;
int use_d3d2;
IDirect3DImpl *d3d;
IDirect3DDeviceImpl *active_device;
D3DMATERIAL mat;
D3DMATERIAL mat;
void (*activate)(IDirect3DMaterial2Impl* this);
LPVOID private;
void (*activate)(IDirect3DMaterialImpl* this);
};
/*****************************************************************************
* IDirect3DTexture2 implementation structure
* IDirect3DTexture implementation structure
*/
struct IDirect3DTexture2Impl
struct IDirect3DTextureImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DTexture2);
DWORD ref;
/* IDirect3DTexture2 fields */
void* D3Ddevice; /* (void *) to use the same pointer
* for both Direct3D and Direct3D2 */
IDirectDrawSurfaceImpl* surface;
LPVOID private;
ICOM_VFIELD_MULTI(IDirect3DTexture2);
ICOM_VFIELD_MULTI(IDirect3DTexture);
DWORD ref;
/* IDirect3DTexture fields */
IDirect3DImpl *d3d;
IDirect3DDeviceImpl *d3ddevice;
IDirectDrawSurfaceImpl *surface;
};
extern HRESULT WINAPI IDirect3DTexture2Impl_QueryInterface(
LPDIRECT3DTEXTURE2 iface, REFIID riid, LPVOID* ppvObj
);
extern ULONG WINAPI IDirect3DTexture2Impl_AddRef(LPDIRECT3DTEXTURE2 iface);
extern ULONG WINAPI IDirect3DTexture2Impl_Release(LPDIRECT3DTEXTURE2 iface);
extern HRESULT WINAPI IDirect3DTextureImpl_GetHandle(LPDIRECT3DTEXTURE iface,
LPDIRECT3DDEVICE lpD3DDevice,
LPD3DTEXTUREHANDLE lpHandle)
;
extern HRESULT WINAPI IDirect3DTextureImpl_Initialize(LPDIRECT3DTEXTURE iface,
LPDIRECT3DDEVICE lpD3DDevice,
LPDIRECTDRAWSURFACE lpSurface)
;
extern HRESULT WINAPI IDirect3DTextureImpl_Unload(LPDIRECT3DTEXTURE iface);
extern HRESULT WINAPI IDirect3DTexture2Impl_GetHandle(
LPDIRECT3DTEXTURE2 iface, LPDIRECT3DDEVICE2 lpD3DDevice2,
LPD3DTEXTUREHANDLE lpHandle
);
extern HRESULT WINAPI IDirect3DTexture2Impl_PaletteChanged(
LPDIRECT3DTEXTURE2 iface, DWORD dwStart, DWORD dwCount
);
extern HRESULT WINAPI IDirect3DTexture2Impl_Load(
LPDIRECT3DTEXTURE2 iface, LPDIRECT3DTEXTURE2 lpD3DTexture2
);
/*****************************************************************************
* IDirect3DViewport2 implementation structure
* IDirect3DViewport implementation structure
*/
struct IDirect3DViewport2Impl
struct IDirect3DViewportImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DViewport2);
DWORD ref;
/* IDirect3DViewport2 fields */
union {
IDirect3DImpl* d3d1;
IDirect3D2Impl* d3d2;
} d3d;
ICOM_VFIELD_MULTI(IDirect3DViewport3);
DWORD ref;
/* IDirect3DViewport fields */
IDirect3DImpl *d3d;
/* If this viewport is active for one device, put the device here */
IDirect3DDeviceImpl *active_device;
int use_vp2;
union {
IDirect3DDeviceImpl* active_device1;
IDirect3DDevice2Impl* active_device2;
} device;
int use_d3d2;
D3DVIEWPORT vp1;
D3DVIEWPORT2 vp2;
} viewports;
union {
D3DVIEWPORT vp1;
D3DVIEWPORT2 vp2;
} viewport;
int use_vp2;
/* Activation function */
void (*activate)(IDirect3DViewportImpl*);
/* Activation function */
void (*activate)(IDirect3DViewport2Impl*);
/* Field used to chain viewports together */
IDirect3DViewportImpl *next;
/* Field used to chain viewports together */
IDirect3DViewport2Impl* next;
/* Lights list */
IDirect3DLightImpl* lights;
LPVOID private;
/* Lights list */
IDirect3DLightImpl *lights;
};
extern HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(
LPDIRECT3DVIEWPORT2 iface, REFIID riid, LPVOID* ppvObj
);
extern ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
;
extern ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
;
extern HRESULT WINAPI IDirect3DViewport2Impl_Initialize(
LPDIRECT3DVIEWPORT2 iface, LPDIRECT3D d3d
);
extern HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(
LPDIRECT3DVIEWPORT2 iface, LPD3DVIEWPORT lpvp
);
extern HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(
LPDIRECT3DVIEWPORT2 iface,LPD3DVIEWPORT lpvp
);
extern HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(
LPDIRECT3DVIEWPORT2 iface,DWORD dwVertexCount,LPD3DTRANSFORMDATA lpData,
DWORD dwFlags,LPDWORD lpOffScreen
);
extern HRESULT WINAPI IDirect3DViewport2Impl_LightElements(
LPDIRECT3DVIEWPORT2 iface,DWORD dwElementCount,LPD3DLIGHTDATA lpData
);
extern HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(
LPDIRECT3DVIEWPORT2 iface, D3DMATERIALHANDLE hMat
);
extern HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(
LPDIRECT3DVIEWPORT2 iface,LPD3DMATERIALHANDLE lphMat,LPBOOL lpValid
);
extern HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(
LPDIRECT3DVIEWPORT2 iface,LPDIRECTDRAWSURFACE lpDDSurface
);
extern HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(
LPDIRECT3DVIEWPORT2 iface,LPDIRECTDRAWSURFACE* lplpDDSurface,LPBOOL lpValid
);
extern HRESULT WINAPI IDirect3DViewport2Impl_Clear(
LPDIRECT3DVIEWPORT2 iface, DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DViewport2Impl_AddLight(
LPDIRECT3DVIEWPORT2 iface,LPDIRECT3DLIGHT lpLight
);
extern HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(
LPDIRECT3DVIEWPORT2 iface,LPDIRECT3DLIGHT lpLight
);
extern HRESULT WINAPI IDirect3DViewport2Impl_NextLight(
LPDIRECT3DVIEWPORT2 iface, LPDIRECT3DLIGHT lpLight,
LPDIRECT3DLIGHT* lplpLight, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(
LPDIRECT3DVIEWPORT2 iface, LPD3DVIEWPORT2 lpViewport2
);
extern HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(
LPDIRECT3DVIEWPORT2 iface, LPD3DVIEWPORT2 lpViewport2
);
/*****************************************************************************
* IDirect3DExecuteBuffer implementation structure
*/
struct IDirect3DExecuteBufferImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DExecuteBuffer);
DWORD ref;
ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
DWORD ref;
/* IDirect3DExecuteBuffer fields */
IDirect3DImpl *d3d;
IDirect3DDeviceImpl* d3ddev;
D3DEXECUTEBUFFERDESC desc;
@ -337,241 +158,44 @@ struct IDirect3DExecuteBufferImpl
data buffer */
BOOL need_free;
void (*execute)(IDirect3DExecuteBuffer* this,
IDirect3DDevice* dev,
IDirect3DViewport* vp);
LPVOID private;
void (*execute)(IDirect3DExecuteBufferImpl* this,
IDirect3DDeviceImpl* dev,
IDirect3DViewportImpl* vp);
};
extern LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
/*****************************************************************************
* IDirect3DDevice implementation structure
*/
struct IDirect3DDeviceImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DDevice);
DWORD ref;
ICOM_VFIELD_MULTI(IDirect3DDevice7);
ICOM_VFIELD_MULTI(IDirect3DDevice3);
ICOM_VFIELD_MULTI(IDirect3DDevice2);
ICOM_VFIELD_MULTI(IDirect3DDevice);
DWORD ref;
/* IDirect3DDevice fields */
IDirect3DImpl* d3d;
IDirectDrawSurfaceImpl* surface;
IDirect3DImpl *d3d;
IDirectDrawSurfaceImpl *surface;
IDirect3DViewport2Impl* viewport_list;
IDirect3DViewport2Impl* current_viewport;
IDirect3DTexture2Impl* current_texture;
IDirect3DViewportImpl *viewport_list;
IDirect3DViewportImpl *current_viewport;
IDirect3DTextureImpl *current_texture;
void (*set_context)(IDirect3DDeviceImpl*);
LPVOID private;
};
/*****************************************************************************
* IDirect3DDevice2 implementation structure
* IDirect3DVertexBuffer implementation structure
*/
struct IDirect3DDevice2Impl
struct IDirect3DVertexBufferImpl
{
/* IUnknown fields */
ICOM_VFIELD(IDirect3DDevice2);
DWORD ref;
/* IDirect3DDevice fields */
IDirect3D2Impl* d3d;
IDirectDrawSurfaceImpl* surface;
IDirect3DViewport2Impl* viewport_list;
IDirect3DViewport2Impl* current_viewport;
IDirect3DTexture2Impl* current_texture;
void (*set_context)(IDirect3DDevice2Impl*);
LPVOID private;
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
DWORD ref;
IDirect3DImpl *d3d;
};
extern HRESULT WINAPI IDirect3DDevice2Impl_QueryInterface(
LPDIRECT3DDEVICE2 iface, REFIID riid, LPVOID* ppvObj
);
extern ULONG WINAPI IDirect3DDevice2Impl_AddRef(LPDIRECT3DDEVICE2 iface);
extern ULONG WINAPI IDirect3DDevice2Impl_Release(LPDIRECT3DDEVICE2 iface)
;
extern HRESULT WINAPI IDirect3DDevice2Impl_GetCaps(
LPDIRECT3DDEVICE2 iface, LPD3DDEVICEDESC lpdescsoft,
LPD3DDEVICEDESC lpdeschard
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SwapTextureHandles(
LPDIRECT3DDEVICE2 iface,LPDIRECT3DTEXTURE2 lptex1,LPDIRECT3DTEXTURE2 lptex2
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetStats(
LPDIRECT3DDEVICE2 iface, LPD3DSTATS lpstats)
;
extern HRESULT WINAPI IDirect3DDevice2Impl_AddViewport(
LPDIRECT3DDEVICE2 iface, LPDIRECT3DVIEWPORT2 lpvp
);
extern HRESULT WINAPI IDirect3DDevice2Impl_DeleteViewport(
LPDIRECT3DDEVICE2 iface, LPDIRECT3DVIEWPORT2 lpvp)
;
extern HRESULT WINAPI IDirect3DDevice2Impl_NextViewport(
LPDIRECT3DDEVICE2 iface, LPDIRECT3DVIEWPORT2 lpvp,
LPDIRECT3DVIEWPORT2* lplpvp, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_EnumTextureFormats(
LPDIRECT3DDEVICE2 iface, LPD3DENUMTEXTUREFORMATSCALLBACK cb, LPVOID context
);
extern HRESULT WINAPI IDirect3DDevice2Impl_BeginScene(LPDIRECT3DDEVICE2 iface);
extern HRESULT WINAPI IDirect3DDevice2Impl_EndScene(LPDIRECT3DDEVICE2 iface);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetDirect3D(
LPDIRECT3DDEVICE2 iface, LPDIRECT3D2 *lpd3d2
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetCurrentViewport(
LPDIRECT3DDEVICE2 iface, LPDIRECT3DVIEWPORT2 lpvp
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetCurrentViewport(
LPDIRECT3DDEVICE2 iface, LPDIRECT3DVIEWPORT2 *lplpvp
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetRenderTarget(
LPDIRECT3DDEVICE2 iface, LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetRenderTarget(
LPDIRECT3DDEVICE2 iface, LPDIRECTDRAWSURFACE *lplpdds
);
extern HRESULT WINAPI IDirect3DDevice2Impl_Begin(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_BeginIndexed(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
LPVOID lpvert, DWORD numvert, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_Vertex(
LPDIRECT3DDEVICE2 iface,LPVOID lpvert
);
extern HRESULT WINAPI IDirect3DDevice2Impl_Index(LPDIRECT3DDEVICE2 iface, WORD index);
extern HRESULT WINAPI IDirect3DDevice2Impl_End(LPDIRECT3DDEVICE2 iface,DWORD dwFlags);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetRenderState(
LPDIRECT3DDEVICE2 iface, D3DRENDERSTATETYPE d3drs, LPDWORD lprstate
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetRenderState(
LPDIRECT3DDEVICE2 iface, D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetLightState(
LPDIRECT3DDEVICE2 iface, D3DLIGHTSTATETYPE d3dls, LPDWORD lplstate
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetLightState(
LPDIRECT3DDEVICE2 iface, D3DLIGHTSTATETYPE dwLightStateType,
DWORD dwLightState
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetTransform(
LPDIRECT3DDEVICE2 iface, D3DTRANSFORMSTATETYPE d3dts, LPD3DMATRIX lpmatrix
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetTransform(
LPDIRECT3DDEVICE2 iface, D3DTRANSFORMSTATETYPE d3dts, LPD3DMATRIX lpmatrix
);
extern HRESULT WINAPI IDirect3DDevice2Impl_MultiplyTransform(
LPDIRECT3DDEVICE2 iface, D3DTRANSFORMSTATETYPE d3dts, LPD3DMATRIX lpmatrix
);
extern HRESULT WINAPI IDirect3DDevice2Impl_DrawPrimitive(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
LPVOID lpvertex, DWORD vertcount, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_DrawIndexedPrimitive(
LPDIRECT3DDEVICE2 iface, D3DPRIMITIVETYPE d3dp, D3DVERTEXTYPE d3dv,
LPVOID lpvertex, DWORD vertcount, LPWORD lpindexes, DWORD indexcount,
DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDevice2Impl_SetClipStatus(
LPDIRECT3DDEVICE2 iface, LPD3DCLIPSTATUS lpcs
);
extern HRESULT WINAPI IDirect3DDevice2Impl_GetClipStatus(
LPDIRECT3DDEVICE2 iface, LPD3DCLIPSTATUS lpcs
);
extern HRESULT WINAPI IDirect3DDeviceImpl_QueryInterface(
LPDIRECT3DDEVICE iface, REFIID riid, LPVOID* ppvObj
);
extern ULONG WINAPI IDirect3DDeviceImpl_AddRef(LPDIRECT3DDEVICE iface);
extern ULONG WINAPI IDirect3DDeviceImpl_Release(LPDIRECT3DDEVICE iface);
extern HRESULT WINAPI IDirect3DDeviceImpl_Initialize(
LPDIRECT3DDEVICE iface, LPDIRECT3D lpd3d, LPGUID lpGUID,
LPD3DDEVICEDESC lpd3ddvdesc
);
extern HRESULT WINAPI IDirect3DDeviceImpl_GetCaps(
LPDIRECT3DDEVICE iface, LPD3DDEVICEDESC lpD3DHWDevDesc,
LPD3DDEVICEDESC lpD3DSWDevDesc
);
extern HRESULT WINAPI IDirect3DDeviceImpl_SwapTextureHandles(
LPDIRECT3DDEVICE iface, LPDIRECT3DTEXTURE lpD3DTex1,
LPDIRECT3DTEXTURE lpD3DTex2
);
extern HRESULT WINAPI IDirect3DDeviceImpl_CreateExecuteBuffer(
LPDIRECT3DDEVICE iface, LPD3DEXECUTEBUFFERDESC lpDesc,
LPDIRECT3DEXECUTEBUFFER *lplpDirect3DExecuteBuffer, IUnknown *pUnkOuter
);
extern HRESULT WINAPI IDirect3DDeviceImpl_GetStats(
LPDIRECT3DDEVICE iface, LPD3DSTATS lpD3DStats
);
extern HRESULT WINAPI IDirect3DDeviceImpl_Execute(
LPDIRECT3DDEVICE iface, LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDeviceImpl_AddViewport(
LPDIRECT3DDEVICE iface, LPDIRECT3DVIEWPORT lpvp
);
extern HRESULT WINAPI IDirect3DDeviceImpl_DeleteViewport(
LPDIRECT3DDEVICE iface, LPDIRECT3DVIEWPORT lpvp
);
extern HRESULT WINAPI IDirect3DDeviceImpl_NextViewport(
LPDIRECT3DDEVICE iface, LPDIRECT3DVIEWPORT lpvp,
LPDIRECT3DVIEWPORT* lplpvp, DWORD dwFlags
);
extern HRESULT WINAPI IDirect3DDeviceImpl_Pick(
LPDIRECT3DDEVICE iface, LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
LPDIRECT3DVIEWPORT lpDirect3DViewport, DWORD dwFlags, LPD3DRECT lpRect
);
extern HRESULT WINAPI IDirect3DDeviceImpl_GetPickRecords(
LPDIRECT3DDEVICE iface, LPDWORD lpCount, LPD3DPICKRECORD lpD3DPickRec
);
extern HRESULT WINAPI IDirect3DDeviceImpl_EnumTextureFormats(
LPDIRECT3DDEVICE iface,LPD3DENUMTEXTUREFORMATSCALLBACK lpd3dEnumTextureProc,
LPVOID lpArg
);
extern HRESULT WINAPI IDirect3DDeviceImpl_CreateMatrix(
LPDIRECT3DDEVICE iface, LPD3DMATRIXHANDLE lpD3DMatHandle
)
;
extern HRESULT WINAPI IDirect3DDeviceImpl_SetMatrix(
LPDIRECT3DDEVICE iface, D3DMATRIXHANDLE d3dMatHandle,
const LPD3DMATRIX lpD3DMatrix)
;
extern HRESULT WINAPI IDirect3DDeviceImpl_GetMatrix(
LPDIRECT3DDEVICE iface,D3DMATRIXHANDLE D3DMatHandle,LPD3DMATRIX lpD3DMatrix
);
extern HRESULT WINAPI IDirect3DDeviceImpl_DeleteMatrix(
LPDIRECT3DDEVICE iface, D3DMATRIXHANDLE d3dMatHandle
);
extern HRESULT WINAPI IDirect3DDeviceImpl_BeginScene(LPDIRECT3DDEVICE iface)
;
extern HRESULT WINAPI IDirect3DDeviceImpl_EndScene(LPDIRECT3DDEVICE iface)
;
extern HRESULT WINAPI IDirect3DDeviceImpl_GetDirect3D(
LPDIRECT3DDEVICE iface, LPDIRECT3D *lpDirect3D
);
/* All non-static functions 'exported' by various sub-objects */
extern LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1);
extern LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2);
extern int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDeviceImpl** device);
extern int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int d3d_OpenGL(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int is_OpenGL(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevice2Impl** device, IDirect3D2Impl* d3d);
/* Various dump functions */
extern const char *_get_renderstate(D3DRENDERSTATETYPE type);
#define dump_mat(mat) \

File diff suppressed because it is too large Load Diff

759
dlls/ddraw/d3ddevice/main.h Normal file
View File

@ -0,0 +1,759 @@
/*
* Copyright 2002 Lionel Ulmer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
/* This is defined here so as to be able to put them in 'drivers' */
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3DDEVICE7 iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef(LPDIRECT3DDEVICE7 iface);
ULONG WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetCaps(LPDIRECT3DDEVICE7 iface,
LPD3DDEVICEDESC7 lpD3DHELDevDesc);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_EnumTextureFormats(LPDIRECT3DDEVICE7 iface,
LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
LPVOID lpArg);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_BeginScene(LPDIRECT3DDEVICE7 iface);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_EndScene(LPDIRECT3DDEVICE7 iface);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_GetDirect3D(LPDIRECT3DDEVICE7 iface,
LPDIRECT3D7* lplpDirect3D3);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderTarget(LPDIRECT3DDEVICE7 iface,
LPDIRECTDRAWSURFACE7 lpNewRenderTarget,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderTarget(LPDIRECT3DDEVICE7 iface,
LPDIRECTDRAWSURFACE7* lplpRenderTarget);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_Clear(LPDIRECT3DDEVICE7 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags,
D3DCOLOR dwColor,
D3DVALUE dvZ,
DWORD dwStencil);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_GetTransform(LPDIRECT3DDEVICE7 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_SetViewport(LPDIRECT3DDEVICE7 iface,
LPD3DVIEWPORT7 lpData);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_MultiplyTransform(LPDIRECT3DDEVICE7 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetViewport(LPDIRECT3DDEVICE7 iface,
LPD3DVIEWPORT7 lpData);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_SetMaterial(LPDIRECT3DDEVICE7 iface,
LPD3DMATERIAL7 lpMat);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetMaterial(LPDIRECT3DDEVICE7 iface,
LPD3DMATERIAL7 lpMat);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_SetLight(LPDIRECT3DDEVICE7 iface,
DWORD dwLightIndex,
LPD3DLIGHT7 lpLight);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetLight(LPDIRECT3DDEVICE7 iface,
DWORD dwLightIndex,
LPD3DLIGHT7 lpLight);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_SetRenderState(LPDIRECT3DDEVICE7 iface,
D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_GetRenderState(LPDIRECT3DDEVICE7 iface,
D3DRENDERSTATETYPE dwRenderStateType,
LPDWORD lpdwRenderState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_BeginStateBlock(LPDIRECT3DDEVICE7 iface);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_EndStateBlock(LPDIRECT3DDEVICE7 iface,
LPDWORD lpdwBlockHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_PreLoad(LPDIRECT3DDEVICE7 iface,
LPDIRECTDRAWSURFACE7 lpddsTexture);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_DrawPrimitive(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitive(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
LPWORD dwIndices,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_SetClipStatus(LPDIRECT3DDEVICE7 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_GetClipStatus(LPDIRECT3DDEVICE7 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_DrawPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD dwVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
DWORD dwVertexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD dwVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
DWORD dwVertexCount,
LPWORD lpIndex,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_DrawPrimitiveVB(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
DWORD dwStartVertex,
DWORD dwNumVertices,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE7 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
LPDIRECT3DVERTEXBUFFER7 lpD3DVertexBuf,
DWORD dwStartVertex,
DWORD dwNumVertices,
LPWORD lpwIndices,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface,
LPD3DVECTOR lpCenters,
LPD3DVALUE lpRadii,
DWORD dwNumSpheres,
DWORD dwFlags,
LPDWORD lpdwReturnValues);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetTexture(LPDIRECT3DDEVICE7 iface,
DWORD dwStage,
LPDIRECTDRAWSURFACE7* lpTexture);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_SetTexture(LPDIRECT3DDEVICE7 iface,
DWORD dwStage,
LPDIRECTDRAWSURFACE7 lpTexture);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_GetTextureStageState(LPDIRECT3DDEVICE7 iface,
DWORD dwStage,
D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
LPDWORD lpdwState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_SetTextureStageState(LPDIRECT3DDEVICE7 iface,
DWORD dwStage,
D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
DWORD dwState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_ValidateDevice(LPDIRECT3DDEVICE7 iface,
LPDWORD lpdwPasses);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_ApplyStateBlock(LPDIRECT3DDEVICE7 iface,
DWORD dwBlockHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_CaptureStateBlock(LPDIRECT3DDEVICE7 iface,
DWORD dwBlockHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_DeleteStateBlock(LPDIRECT3DDEVICE7 iface,
DWORD dwBlockHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_CreateStateBlock(LPDIRECT3DDEVICE7 iface,
D3DSTATEBLOCKTYPE d3dsbType,
LPDWORD lpdwBlockHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_Load(LPDIRECT3DDEVICE7 iface,
LPDIRECTDRAWSURFACE7 lpDestTex,
LPPOINT lpDestPoint,
LPDIRECTDRAWSURFACE7 lpSrcTex,
LPRECT lprcSrcRect,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_LightEnable(LPDIRECT3DDEVICE7 iface,
DWORD dwLightIndex,
BOOL bEnable);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetLightEnable(LPDIRECT3DDEVICE7 iface,
DWORD dwLightIndex,
BOOL* pbEnable);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_SetClipPlane(LPDIRECT3DDEVICE7 iface,
DWORD dwIndex,
D3DVALUE* pPlaneEquation);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetClipPlane(LPDIRECT3DDEVICE7 iface,
DWORD dwIndex,
D3DVALUE* pPlaneEquation);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_GetInfo(LPDIRECT3DDEVICE7 iface,
DWORD dwDevInfoID,
LPVOID pDevInfoStruct,
DWORD dwSize);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_1T_GetCaps(LPDIRECT3DDEVICE3 iface,
LPD3DDEVICEDESC lpD3DHWDevDesc,
LPD3DDEVICEDESC lpD3DHELDevDesc);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_1T_GetStats(LPDIRECT3DDEVICE3 iface,
LPD3DSTATS lpD3DStats);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_1T_AddViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT3 lpDirect3DViewport3);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_1T_DeleteViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT3 lpDirect3DViewport3);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_1T_NextViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT3 lpDirect3DViewport3,
LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_SetCurrentViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT3 lpDirect3DViewport3);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_GetCurrentViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT3* lplpDirect3DViewport3);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_Begin(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD dwVertexTypeDesc,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_BeginIndexed(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwNumVertices,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_Vertex(LPDIRECT3DDEVICE3 iface,
LPVOID lpVertexType);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_Index(LPDIRECT3DDEVICE3 iface,
WORD wVertexIndex);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_End(LPDIRECT3DDEVICE3 iface,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_GetLightState(LPDIRECT3DDEVICE3 iface,
D3DLIGHTSTATETYPE dwLightStateType,
LPDWORD lpdwLightState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
D3DLIGHTSTATETYPE dwLightStateType,
DWORD dwLightState);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_DrawPrimitiveVB(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
DWORD dwStartVertex,
DWORD dwNumVertices,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
LPDIRECT3DVERTEXBUFFER lpD3DVertexBuf,
LPWORD lpwIndices,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_GetTexture(LPDIRECT3DDEVICE3 iface,
DWORD dwStage,
LPDIRECT3DTEXTURE2* lplpTexture2);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_3_SetTexture(LPDIRECT3DDEVICE3 iface,
DWORD dwStage,
LPDIRECT3DTEXTURE2 lpTexture2);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_SwapTextureHandles(LPDIRECT3DDEVICE2 iface,
LPDIRECT3DTEXTURE2 lpD3DTex1,
LPDIRECT3DTEXTURE2 lpD3DTex2);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_1T_EnumTextureFormats(LPDIRECT3DDEVICE2 iface,
LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
LPVOID lpArg);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_Begin(LPDIRECT3DDEVICE2 iface,
D3DPRIMITIVETYPE d3dpt,
D3DVERTEXTYPE dwVertexTypeDesc,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_BeginIndexed(LPDIRECT3DDEVICE2 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
D3DVERTEXTYPE d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwNumVertices,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_DrawPrimitive(LPDIRECT3DDEVICE2 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
D3DVERTEXTYPE d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(LPDIRECT3DDEVICE2 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
D3DVERTEXTYPE d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
LPWORD dwIndices,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_Initialize(LPDIRECT3DDEVICE iface,
LPDIRECT3D lpDirect3D,
LPGUID lpGUID,
LPD3DDEVICEDESC lpD3DDVDesc);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_SwapTextureHandles(LPDIRECT3DDEVICE iface,
LPDIRECT3DTEXTURE lpD3Dtex1,
LPDIRECT3DTEXTURE lpD3DTex2);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_CreateExecuteBuffer(LPDIRECT3DDEVICE iface,
LPD3DEXECUTEBUFFERDESC lpDesc,
LPDIRECT3DEXECUTEBUFFER* lplpDirect3DExecuteBuffer,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_Execute(LPDIRECT3DDEVICE iface,
LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
LPDIRECT3DVIEWPORT lpDirect3DViewport,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_Pick(LPDIRECT3DDEVICE iface,
LPDIRECT3DEXECUTEBUFFER lpDirect3DExecuteBuffer,
LPDIRECT3DVIEWPORT lpDirect3DViewport,
DWORD dwFlags,
LPD3DRECT lpRect);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_GetPickRecords(LPDIRECT3DDEVICE iface,
LPDWORD lpCount,
LPD3DPICKRECORD lpD3DPickRec);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_CreateMatrix(LPDIRECT3DDEVICE iface,
LPD3DMATRIXHANDLE lpD3DMatHandle);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_SetMatrix(LPDIRECT3DDEVICE iface,
D3DMATRIXHANDLE D3DMatHandle,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_GetMatrix(LPDIRECT3DDEVICE iface,
D3DMATRIXHANDLE D3DMatHandle,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Main_IDirect3DDeviceImpl_1_DeleteMatrix(LPDIRECT3DDEVICE iface,
D3DMATRIXHANDLE D3DMatHandle);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_QueryInterface(LPDIRECT3DDEVICE3 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_QueryInterface(LPDIRECT3DDEVICE2 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_QueryInterface(LPDIRECT3DDEVICE iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_3_AddRef(LPDIRECT3DDEVICE3 iface);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_2_AddRef(LPDIRECT3DDEVICE2 iface);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_1_AddRef(LPDIRECT3DDEVICE iface);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_3_Release(LPDIRECT3DDEVICE3 iface);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_2_Release(LPDIRECT3DDEVICE2 iface);
ULONG WINAPI
Thunk_IDirect3DDeviceImpl_1_Release(LPDIRECT3DDEVICE iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_AddViewport(LPDIRECT3DDEVICE2 iface,
LPDIRECT3DVIEWPORT2 lpDirect3DViewport2);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_AddViewport(LPDIRECT3DDEVICE iface,
LPDIRECT3DVIEWPORT lpDirect3DViewport);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_DeleteViewport(LPDIRECT3DDEVICE2 iface,
LPDIRECT3DVIEWPORT2 lpDirect3DViewport2);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_DeleteViewport(LPDIRECT3DDEVICE iface,
LPDIRECT3DVIEWPORT lpDirect3DViewport);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_NextViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT2 lpDirect3DViewport2,
LPDIRECT3DVIEWPORT2* lplpDirect3DViewport2,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_NextViewport(LPDIRECT3DDEVICE3 iface,
LPDIRECT3DVIEWPORT lpDirect3DViewport,
LPDIRECT3DVIEWPORT* lplpDirect3DViewport,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetDirect3D(LPDIRECT3DDEVICE3 iface,
LPDIRECT3D3* lplpDirect3D3);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetDirect3D(LPDIRECT3DDEVICE2 iface,
LPDIRECT3D2* lplpDirect3D2);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_GetDirect3D(LPDIRECT3DDEVICE iface,
LPDIRECT3D* lplpDirect3D);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport(LPDIRECT3DDEVICE2 iface,
LPDIRECT3DVIEWPORT2 lpDirect3DViewport2);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport(LPDIRECT3DDEVICE2 iface,
LPDIRECT3DVIEWPORT2* lpDirect3DViewport2);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats(LPDIRECT3DDEVICE3 iface,
LPD3DENUMPIXELFORMATSCALLBACK lpD3DEnumPixelProc,
LPVOID lpArg);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_BeginScene(LPDIRECT3DDEVICE3 iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_BeginScene(LPDIRECT3DDEVICE2 iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_BeginScene(LPDIRECT3DDEVICE iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_EndScene(LPDIRECT3DDEVICE3 iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_EndScene(LPDIRECT3DDEVICE2 iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_EndScene(LPDIRECT3DDEVICE iface);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_SetTransform(LPDIRECT3DDEVICE3 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetTransform(LPDIRECT3DDEVICE2 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetTransform(LPDIRECT3DDEVICE3 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetTransform(LPDIRECT3DDEVICE2 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(LPDIRECT3DDEVICE3 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_MultiplyTransform(LPDIRECT3DDEVICE2 iface,
D3DTRANSFORMSTATETYPE dtstTransformStateType,
LPD3DMATRIX lpD3DMatrix);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_SetRenderState(LPDIRECT3DDEVICE3 iface,
D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetRenderState(LPDIRECT3DDEVICE2 iface,
D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetRenderState(LPDIRECT3DDEVICE3 iface,
D3DRENDERSTATETYPE dwRenderStateType,
LPDWORD lpdwRenderState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetRenderState(LPDIRECT3DDEVICE2 iface,
D3DRENDERSTATETYPE dwRenderStateType,
LPDWORD lpdwRenderState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD d3dvtVertexType,
LPVOID lpvVertices,
DWORD dwVertexCount,
LPWORD dwIndices,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_SetClipStatus(LPDIRECT3DDEVICE3 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetClipStatus(LPDIRECT3DDEVICE2 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetClipStatus(LPDIRECT3DDEVICE3 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetClipStatus(LPDIRECT3DDEVICE2 iface,
LPD3DCLIPSTATUS lpD3DClipStatus);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD dwVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
DWORD dwVertexCount,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(LPDIRECT3DDEVICE3 iface,
D3DPRIMITIVETYPE d3dptPrimitiveType,
DWORD dwVertexType,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpD3DDrawPrimStrideData,
DWORD dwVertexCount,
LPWORD lpIndex,
DWORD dwIndexCount,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility(LPDIRECT3DDEVICE3 iface,
LPD3DVECTOR lpCenters,
LPD3DVALUE lpRadii,
DWORD dwNumSpheres,
DWORD dwFlags,
LPDWORD lpdwReturnValues);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetTextureStageState(LPDIRECT3DDEVICE3 iface,
DWORD dwStage,
D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
LPDWORD lpdwState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_SetTextureStageState(LPDIRECT3DDEVICE3 iface,
DWORD dwStage,
D3DTEXTURESTAGESTATETYPE d3dTexStageStateType,
DWORD dwState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_ValidateDevice(LPDIRECT3DDEVICE3 iface,
LPDWORD lpdwPasses);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetCaps(LPDIRECT3DDEVICE2 iface,
LPD3DDEVICEDESC lpD3DHWDevDesc,
LPD3DDEVICEDESC lpD3DHELDevDesc);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_GetCaps(LPDIRECT3DDEVICE iface,
LPD3DDEVICEDESC lpD3DHWDevDesc,
LPD3DDEVICEDESC lpD3DHELDevDesc);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetStats(LPDIRECT3DDEVICE2 iface,
LPD3DSTATS lpD3DStats);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_GetStats(LPDIRECT3DDEVICE iface,
LPD3DSTATS lpD3DStats);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(LPDIRECT3DDEVICE3 iface,
LPDIRECTDRAWSURFACE4 lpNewRenderTarget,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(LPDIRECT3DDEVICE3 iface,
LPDIRECTDRAWSURFACE4* lplpRenderTarget);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetRenderTarget(LPDIRECT3DDEVICE2 iface,
LPDIRECTDRAWSURFACE lpNewRenderTarget,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetRenderTarget(LPDIRECT3DDEVICE2 iface,
LPDIRECTDRAWSURFACE* lplpRenderTarget);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_Vertex(LPDIRECT3DDEVICE2 iface,
LPVOID lpVertexType);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_Index(LPDIRECT3DDEVICE2 iface,
WORD wVertexIndex);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_End(LPDIRECT3DDEVICE2 iface,
DWORD dwFlags);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_GetLightState(LPDIRECT3DDEVICE2 iface,
D3DLIGHTSTATETYPE dwLightStateType,
LPDWORD lpdwLightState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_2_SetLightState(LPDIRECT3DDEVICE2 iface,
D3DLIGHTSTATETYPE dwLightStateType,
DWORD dwLightState);
HRESULT WINAPI
Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(LPDIRECT3DDEVICE iface,
LPD3DENUMTEXTUREFORMATSCALLBACK lpD3DEnumTextureProc,
LPVOID lpArg);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* Direct3D Light
* Copyright (c) 1998 Lionel ULMER
* Copyright (c) 1998 / 2002 Lionel ULMER
*
* This file contains the implementation of Direct3DLight.
*
@ -26,242 +26,223 @@
#include "d3d.h"
#include "wine/debug.h"
#include "d3d_private.h"
#include "mesa_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define D3DLPRIVATE(x) mesa_d3dl_private*dlpriv=((mesa_d3dl_private*)x->private)
/* First, the 'main' interface... */
HRESULT WINAPI
Main_IDirect3DLightImpl_1_QueryInterface(LPDIRECT3DLIGHT iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
FIXME("(%p/%p)->(%s,%p): stub!\n", This, iface, debugstr_guid(riid), obp);
return DD_OK;
}
static ICOM_VTABLE(IDirect3DLight) light_vtable;
ULONG WINAPI
Main_IDirect3DLightImpl_1_AddRef(LPDIRECT3DLIGHT iface)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
return ++(This->ref);
}
enum {
D3D_1,
D3D_2
};
ULONG WINAPI
Main_IDirect3DLightImpl_1_Release(LPDIRECT3DLIGHT iface)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
HRESULT WINAPI
Main_IDirect3DLightImpl_1_Initialize(LPDIRECT3DLIGHT iface,
LPDIRECT3D lpDirect3D)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
TRACE("(%p/%p)->(%p) no-op...\n", This, iface, lpDirect3D);
return DD_OK;
}
/*** IDirect3DLight methods ***/
static void dump_light(LPD3DLIGHT2 light)
{
DPRINTF(" - dwSize : %ld\n", light->dwSize);
}
HRESULT WINAPI
Main_IDirect3DLightImpl_1_SetLight(LPDIRECT3DLIGHT iface,
LPD3DLIGHT lpLight)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpLight);
if (TRACE_ON(ddraw)) {
TRACE(" Light definition : \n");
dump_light((LPD3DLIGHT2) lpLight);
}
memcpy(&This->light, lpLight, lpLight->dwSize);
if ((This->light.dwFlags & D3DLIGHT_ACTIVE) != 0) {
This->update(This);
}
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DLightImpl_1_GetLight(LPDIRECT3DLIGHT iface,
LPD3DLIGHT lpLight)
{
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpLight);
if (TRACE_ON(ddraw)) {
TRACE(" Returning light definition : \n");
dump_light(&This->light);
}
memcpy(lpLight, &This->light, lpLight->dwSize);
return DD_OK;
}
/*******************************************************************************
* Light static functions
*/
static const float zero_value[] = {
0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0
};
static void update(IDirect3DLightImpl* This) {
D3DLPRIVATE(This);
switch (This->light.dltType) {
case D3DLIGHT_POINT: /* 1 */
TRACE("Activating POINT\n");
break;
IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This;
ENTER_GL();
switch (glThis->parent.light.dltType) {
case D3DLIGHT_POINT: /* 1 */
TRACE("Activating POINT\n");
break;
case D3DLIGHT_SPOT: /* 2 */
TRACE("Activating SPOT\n");
break;
case D3DLIGHT_SPOT: /* 2 */
TRACE("Activating SPOT\n");
break;
case D3DLIGHT_DIRECTIONAL: { /* 3 */
float direction[4];
case D3DLIGHT_DIRECTIONAL: { /* 3 */
float direction[4];
TRACE("Activating DIRECTIONAL\n");
TRACE(" direction : %f %f %f\n",
This->light.dvDirection.u1.x,
This->light.dvDirection.u2.y,
This->light.dvDirection.u3.z);
_dump_colorvalue(" color ", This->light.dcvColor);
TRACE("Activating DIRECTIONAL\n");
TRACE(" direction : %f %f %f\n",
glThis->parent.light.dvDirection.u1.x,
glThis->parent.light.dvDirection.u2.y,
glThis->parent.light.dvDirection.u3.z);
_dump_colorvalue(" color ", glThis->parent.light.dcvColor);
glLightfv(glThis->light_num, GL_AMBIENT, (float *) zero_value);
glLightfv(glThis->light_num, GL_DIFFUSE, (float *) &(glThis->parent.light.dcvColor));
glLightfv(dlpriv->light_num, GL_AMBIENT, (float *) zero_value);
glLightfv(dlpriv->light_num, GL_DIFFUSE, (float *) &(This->light.dcvColor));
direction[0] = -glThis->parent.light.dvDirection.u1.x;
direction[1] = -glThis->parent.light.dvDirection.u2.y;
direction[2] = -glThis->parent.light.dvDirection.u3.z;
direction[3] = 0.0; /* This is a directional light */
direction[0] = -This->light.dvDirection.u1.x;
direction[1] = -This->light.dvDirection.u2.y;
direction[2] = -This->light.dvDirection.u3.z;
direction[3] = 0.0; /* This is a directional light */
glLightfv(glThis->light_num, GL_POSITION, (float *) direction);
} break;
glLightfv(dlpriv->light_num, GL_POSITION, (float *) direction);
} break;
case D3DLIGHT_PARALLELPOINT: /* 4 */
TRACE("Activating PARRALLEL-POINT\n");
break;
case D3DLIGHT_PARALLELPOINT: /* 4 */
TRACE("Activating PARRALLEL-POINT\n");
break;
default:
TRACE("Not a known Light Type: %d\n",This->light.dltType);
break;
}
default:
WARN("Not a known Light Type: %d\n", glThis->parent.light.dltType);
break;
}
LEAVE_GL();
}
static void activate(IDirect3DLightImpl* This) {
D3DLPRIVATE(This);
ENTER_GL();
update(This);
/* If was not active, activate it */
if (This->is_active == 0) {
glEnable(dlpriv->light_num);
This->is_active = 1;
}
LEAVE_GL();
return ;
}
/*******************************************************************************
* Light Creation functions
*/
LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2)
{
IDirect3DLightImpl* light;
light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl));
light->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dl_private));
light->ref = 1;
ICOM_VTBL(light) = &light_vtable;
light->d3d.d3d2 = d3d2;
light->type = D3D_2;
light->next = NULL;
light->prev = NULL;
light->activate = activate;
light->is_active = 0;
return (LPDIRECT3DLIGHT)light;
}
LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1)
{
IDirect3DLightImpl* light;
light = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DLightImpl));
light->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dl_private));
light->ref = 1;
ICOM_VTBL(light) = &light_vtable;
light->d3d.d3d1 = d3d1;
light->type = D3D_1;
light->next = NULL;
light->prev = NULL;
light->activate = activate;
light->is_active = 0;
return (LPDIRECT3DLIGHT)light;
}
/*******************************************************************************
* IDirect3DLight methods
*/
static HRESULT WINAPI IDirect3DLightImpl_QueryInterface(LPDIRECT3DLIGHT iface,
REFIID riid,
LPVOID* ppvObj)
{
ICOM_THIS(IDirect3DLightImpl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK;
}
static ULONG WINAPI IDirect3DLightImpl_AddRef(LPDIRECT3DLIGHT iface)
{
ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref);
}
static ULONG WINAPI IDirect3DLightImpl_Release(LPDIRECT3DLIGHT iface)
{
ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This->private);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
}
/*** IDirect3DLight methods ***/
static void dump_light(LPD3DLIGHT light)
{
DPRINTF(" dwSize : %ld\n", light->dwSize);
}
static HRESULT WINAPI IDirect3DLightImpl_GetLight(LPDIRECT3DLIGHT iface,
LPD3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->(%p)\n", This, lpLight);
if (TRACE_ON(ddraw))
dump_light(lpLight);
/* Copies the light structure */
switch (This->type) {
case D3D_1:
*((LPD3DLIGHT)lpLight) = *((LPD3DLIGHT) &(This->light));
break;
case D3D_2:
*((LPD3DLIGHT2)lpLight) = *((LPD3DLIGHT2) &(This->light));
break;
}
return DD_OK;
}
static HRESULT WINAPI IDirect3DLightImpl_SetLight(LPDIRECT3DLIGHT iface,
LPD3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->(%p)\n", This, lpLight);
if (TRACE_ON(ddraw))
dump_light(lpLight);
/* Stores the light */
switch (This->type) {
case D3D_1:
*((LPD3DLIGHT) &(This->light)) = *((LPD3DLIGHT)lpLight);
break;
case D3D_2:
*((LPD3DLIGHT2) &(This->light)) = *((LPD3DLIGHT2)lpLight);
break;
}
ENTER_GL();
if (This->is_active)
IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This;
ENTER_GL();
update(This);
LEAVE_GL();
return DD_OK;
/* If was not active, activate it */
if ((glThis->parent.light.dwFlags & D3DLIGHT_ACTIVE) == 0) {
glEnable(glThis->light_num);
glThis->parent.light.dwFlags |= D3DLIGHT_ACTIVE;
}
LEAVE_GL();
}
static HRESULT WINAPI IDirect3DLightImpl_Initialize(LPDIRECT3DLIGHT iface,
LPDIRECT3D lpDirect3D)
{
ICOM_THIS(IDirect3DLightImpl,iface);
TRACE("(%p)->(%p)\n", This, lpDirect3D);
return DDERR_ALREADYINITIALIZED;
static void desactivate(IDirect3DLightImpl* This) {
IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This;
ENTER_GL();
/* If was not active, activate it */
if ((glThis->parent.light.dwFlags & D3DLIGHT_ACTIVE) != 0) {
glDisable(glThis->light_num);
glThis->parent.light.dwFlags &= ~D3DLIGHT_ACTIVE;
}
LEAVE_GL();
}
/*******************************************************************************
* IDirect3DLight VTable
*/
static ICOM_VTABLE(IDirect3DLight) light_vtable =
ULONG WINAPI
GL_IDirect3DLightImpl_1_Release(LPDIRECT3DLIGHT iface)
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/
IDirect3DLightImpl_QueryInterface,
IDirect3DLightImpl_AddRef,
IDirect3DLightImpl_Release,
/*** IDirect3DLight methods ***/
IDirect3DLightImpl_Initialize,
IDirect3DLightImpl_SetLight,
IDirect3DLightImpl_GetLight
ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface);
IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This;
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (!--(This->ref)) {
((IDirect3DGLImpl *) This->d3d)->light_released(This->d3d, glThis->light_num);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DLight.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DLight) VTABLE_IDirect3DLight =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Main_IDirect3DLightImpl_1_QueryInterface,
XCAST(AddRef) Main_IDirect3DLightImpl_1_AddRef,
XCAST(Release) GL_IDirect3DLightImpl_1_Release,
XCAST(Initialize) Main_IDirect3DLightImpl_1_Initialize,
XCAST(SetLight) Main_IDirect3DLightImpl_1_SetLight,
XCAST(GetLight) Main_IDirect3DLightImpl_1_GetLight,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num)
{
IDirect3DLightImpl *object;
IDirect3DLightGLImpl *gl_object;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DLightGLImpl));
if (object == NULL) return DDERR_OUTOFMEMORY;
gl_object = (IDirect3DLightGLImpl *) object;
object->ref = 1;
object->d3d = d3d;
object->next = NULL;
object->activate = activate;
object->desactivate = desactivate;
object->update = update;
gl_object->light_num = light_num;
ICOM_INIT_INTERFACE(object, IDirect3DLight, VTABLE_IDirect3DLight);
*obj = object;
TRACE(" creating implementation at %p.\n", *obj);
return D3D_OK;
}

View File

@ -1,7 +1,7 @@
/* Direct3D Material
* Copyright (c) 1998 Lionel ULMER
* Copyright (c) 2002 Lionel ULMER
*
* This file contains the implementation of Direct3DMaterial2.
* This file contains the implementation of Direct3DMaterial.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -26,25 +26,267 @@
#include "d3d.h"
#include "wine/debug.h"
#include "d3d_private.h"
#include "mesa_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirect3DMaterial2) material2_vtable;
static ICOM_VTABLE(IDirect3DMaterial) material_vtable;
static void dump_material(LPD3DMATERIAL mat)
{
DPRINTF(" dwSize : %ld\n", mat->dwSize);
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_QueryInterface(LPDIRECT3DMATERIAL3 iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
*obp = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial);
TRACE(" Creating IDirect3DMaterial interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial2, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial2);
TRACE(" Creating IDirect3DMaterial2 interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DMaterial3, riid ) ) {
IDirect3DMaterial_AddRef(ICOM_INTERFACE(This, IDirect3DMaterial));
*obp = ICOM_INTERFACE(This, IDirect3DMaterial3);
TRACE(" Creating IDirect3DMaterial3 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
return OLE_E_ENUM_NOMORE;
}
ULONG WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_AddRef(LPDIRECT3DMATERIAL3 iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
return ++(This->ref);
}
ULONG WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_Release(LPDIRECT3DMATERIAL3 iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_1_Initialize(LPDIRECT3DMATERIAL iface,
LPDIRECT3D lpDirect3D)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
TRACE("(%p/%p)->(%p) no-op...!\n", This, iface, lpDirect3D);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_1_Reserve(LPDIRECT3DMATERIAL iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
TRACE("(%p/%p)->() not implemented.\n", This, iface);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_1_Unreserve(LPDIRECT3DMATERIAL iface)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial, iface);
FIXME("(%p/%p)->() not implemented.\n", This, iface);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_SetMaterial(LPDIRECT3DMATERIAL3 iface,
LPD3DMATERIAL lpMat)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpMat);
if (TRACE_ON(ddraw))
dump_material(lpMat);
/* Stores the material */
memset(&This->mat, 0, sizeof(This->mat));
memcpy(&This->mat, lpMat, lpMat->dwSize);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_GetMaterial(LPDIRECT3DMATERIAL3 iface,
LPD3DMATERIAL lpMat)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
DWORD dwSize;
TRACE("(%p/%p)->(%p)\n", This, iface, lpMat);
if (TRACE_ON(ddraw)) {
TRACE(" Returning material : ");
dump_material(&This->mat);
}
/* Copies the material structure */
dwSize = lpMat->dwSize;
memset(lpMat, 0, dwSize);
memcpy(lpMat, &This->mat, dwSize);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DMaterialImpl_3_2T_1T_GetHandle(LPDIRECT3DMATERIAL3 iface,
LPDIRECT3DDEVICE3 lpDirect3DDevice3,
LPD3DMATERIALHANDLE lpHandle)
{
ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpDirect3DDevice3, lpHandle);
This->active_device = ICOM_OBJECT(IDirect3DDeviceImpl, IDirect3DDevice3, lpDirect3DDevice3);
*lpHandle = (DWORD) This; /* Warning: this is not 64 bit clean.
Maybe also we need to store this material somewhere in the device ? */
TRACE(" returning handle %08lx.\n", *lpHandle);
return DD_OK;
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_2_GetHandle(LPDIRECT3DMATERIAL2 iface,
LPDIRECT3DDEVICE2 lpDirect3DDevice2,
LPD3DMATERIALHANDLE lpHandle)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpDirect3DDevice2, lpHandle);
return IDirect3DMaterial3_GetHandle(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice3, lpDirect3DDevice2),
lpHandle);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_1_GetHandle(LPDIRECT3DMATERIAL iface,
LPDIRECT3DDEVICE lpDirect3DDevice,
LPD3DMATERIALHANDLE lpHandle)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpDirect3DDevice, lpHandle);
return IDirect3DMaterial3_GetHandle(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice3, lpDirect3DDevice),
lpHandle);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_2_QueryInterface(LPDIRECT3DMATERIAL2 iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3DMaterial3 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3DMaterial3_QueryInterface(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
riid,
obp);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_1_QueryInterface(LPDIRECT3DMATERIAL iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3DMaterial3 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3DMaterial3_QueryInterface(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
riid,
obp);
}
ULONG WINAPI
Thunk_IDirect3DMaterialImpl_2_AddRef(LPDIRECT3DMATERIAL2 iface)
{
TRACE("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
return IDirect3DMaterial3_AddRef(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface));
}
ULONG WINAPI
Thunk_IDirect3DMaterialImpl_1_AddRef(LPDIRECT3DMATERIAL iface)
{
TRACE("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
return IDirect3DMaterial3_AddRef(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface));
}
ULONG WINAPI
Thunk_IDirect3DMaterialImpl_2_Release(LPDIRECT3DMATERIAL2 iface)
{
TRACE("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
return IDirect3DMaterial3_Release(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface));
}
ULONG WINAPI
Thunk_IDirect3DMaterialImpl_1_Release(LPDIRECT3DMATERIAL iface)
{
TRACE("(%p)->() thunking to IDirect3DMaterial3 interface.\n", iface);
return IDirect3DMaterial3_Release(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface));
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_2_SetMaterial(LPDIRECT3DMATERIAL2 iface,
LPD3DMATERIAL lpMat)
{
TRACE("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
return IDirect3DMaterial3_SetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
lpMat);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_1_SetMaterial(LPDIRECT3DMATERIAL iface,
LPD3DMATERIAL lpMat)
{
TRACE("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
return IDirect3DMaterial3_SetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
lpMat);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_2_GetMaterial(LPDIRECT3DMATERIAL2 iface,
LPD3DMATERIAL lpMat)
{
TRACE("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
return IDirect3DMaterial3_GetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial2, IDirect3DMaterial3, iface),
lpMat);
}
HRESULT WINAPI
Thunk_IDirect3DMaterialImpl_1_GetMaterial(LPDIRECT3DMATERIAL iface,
LPD3DMATERIAL lpMat)
{
TRACE("(%p)->(%p) thunking to IDirect3DMaterial3 interface.\n", iface, lpMat);
return IDirect3DMaterial3_GetMaterial(COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial, IDirect3DMaterial3, iface),
lpMat);
}
/*******************************************************************************
* Matrial2 static functions
*/
static void activate(IDirect3DMaterial2Impl* This) {
static void activate(IDirect3DMaterialImpl* This) {
TRACE("Activating material %p\n", This);
ENTER_GL();
/* First, set the rendering context */
if (This->use_d3d2)
This->device.active_device2->set_context(This->device.active_device2);
else
This->device.active_device1->set_context(This->device.active_device1);
/* Set the current Material */
_dump_colorvalue("Diffuse", This->mat.u.diffuse);
@ -73,201 +315,95 @@ static void activate(IDirect3DMaterial2Impl* This) {
return ;
}
/*******************************************************************************
* Matrial2 Creation functions
*/
LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2)
{
IDirect3DMaterial2Impl* mat;
mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl));
mat->ref = 1;
ICOM_VTBL(mat) = &material2_vtable;
mat->use_d3d2 = 1;
mat->d3d.d3d2 = d3d2;
mat->activate = activate;
return (LPDIRECT3DMATERIAL2)mat;
}
LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1)
{
IDirect3DMaterial2Impl* mat;
mat = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DMaterial2Impl));
mat->ref = 1;
ICOM_VTBL(mat) = (ICOM_VTABLE(IDirect3DMaterial2)*)&material_vtable;
mat->use_d3d2 = 0;
mat->d3d.d3d1 = d3d1;
mat->activate = activate;
return (LPDIRECT3DMATERIAL) mat;
}
/*******************************************************************************
* IDirect3DMaterial2 methods
*/
static HRESULT WINAPI IDirect3DMaterial2Impl_QueryInterface(LPDIRECT3DMATERIAL2 iface,
REFIID riid,
LPVOID* ppvObj)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK;
}
static ULONG WINAPI IDirect3DMaterial2Impl_AddRef(LPDIRECT3DMATERIAL2 iface)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
return ++(This->ref);
}
static ULONG WINAPI IDirect3DMaterial2Impl_Release(LPDIRECT3DMATERIAL2 iface)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
}
/*** IDirect3DMaterial2 methods ***/
static void dump_material(LPD3DMATERIAL mat)
{
DPRINTF(" dwSize : %ld\n", mat->dwSize);
}
static HRESULT WINAPI IDirect3DMaterial2Impl_GetMaterial(LPDIRECT3DMATERIAL2 iface,
LPD3DMATERIAL lpMat)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(ddraw))
dump_material(lpMat);
/* Copies the material structure */
*lpMat = This->mat;
return DD_OK;
}
static HRESULT WINAPI IDirect3DMaterial2Impl_SetMaterial(LPDIRECT3DMATERIAL2 iface,
LPD3DMATERIAL lpMat)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpMat);
if (TRACE_ON(ddraw))
dump_material(lpMat);
/* Stores the material */
This->mat = *lpMat;
return DD_OK;
}
static HRESULT WINAPI IDirect3DMaterial2Impl_GetHandle(LPDIRECT3DMATERIAL2 iface,
LPDIRECT3DDEVICE2 lpD3DDevice2,
LPD3DMATERIALHANDLE lpMatHandle)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpD3DDevice2, lpMatHandle);
if (This->use_d3d2)
This->device.active_device2 = (IDirect3DDevice2Impl*)lpD3DDevice2;
else
This->device.active_device1 = (IDirect3DDeviceImpl*)lpD3DDevice2;
*lpMatHandle = (DWORD) This; /* lpD3DDevice2->store_material(This); */
return DD_OK;
}
static HRESULT WINAPI IDirect3DMaterialImpl_Reserve(LPDIRECT3DMATERIAL iface)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->(): stub\n", This);
return DDERR_INVALIDPARAMS;
}
static HRESULT WINAPI IDirect3DMaterialImpl_Unreserve(LPDIRECT3DMATERIAL iface)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
FIXME("(%p)->(): stub\n", This);
return DDERR_INVALIDPARAMS;
}
static HRESULT WINAPI IDirect3DMaterialImpl_Initialize(LPDIRECT3DMATERIAL iface,
LPDIRECT3D lpDirect3D)
{
ICOM_THIS(IDirect3DMaterial2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpDirect3D);
return DDERR_ALREADYINITIALIZED;
}
/*******************************************************************************
* IDirect3DMaterial VTable
*/
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(material_vtable.fun))
# define XCAST(fun) (typeof(VTABLE_IDirect3DMaterial3.fun))
#else
# define XCAST(fun) (void*)
# define XCAST(fun) (void*)
#endif
static ICOM_VTABLE(IDirect3DMaterial) material_vtable =
ICOM_VTABLE(IDirect3DMaterial3) VTABLE_IDirect3DMaterial3 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/
XCAST(QueryInterface)IDirect3DMaterial2Impl_QueryInterface,
XCAST(AddRef)IDirect3DMaterial2Impl_AddRef,
XCAST(Release)IDirect3DMaterial2Impl_Release,
/*** IDirect3DMaterial methods ***/
IDirect3DMaterialImpl_Initialize,
XCAST(SetMaterial)IDirect3DMaterial2Impl_SetMaterial,
XCAST(GetMaterial)IDirect3DMaterial2Impl_GetMaterial,
XCAST(GetHandle)IDirect3DMaterial2Impl_GetHandle,
IDirect3DMaterialImpl_Reserve,
IDirect3DMaterialImpl_Unreserve
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Main_IDirect3DMaterialImpl_3_2T_1T_QueryInterface,
XCAST(AddRef) Main_IDirect3DMaterialImpl_3_2T_1T_AddRef,
XCAST(Release) Main_IDirect3DMaterialImpl_3_2T_1T_Release,
XCAST(SetMaterial) Main_IDirect3DMaterialImpl_3_2T_1T_SetMaterial,
XCAST(GetMaterial) Main_IDirect3DMaterialImpl_3_2T_1T_GetMaterial,
XCAST(GetHandle) Main_IDirect3DMaterialImpl_3_2T_1T_GetHandle,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
/*******************************************************************************
* IDirect3DMaterial2 VTable
*/
static ICOM_VTABLE(IDirect3DMaterial2) material2_vtable =
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DMaterial2.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DMaterial2) VTABLE_IDirect3DMaterial2 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/
IDirect3DMaterial2Impl_QueryInterface,
IDirect3DMaterial2Impl_AddRef,
IDirect3DMaterial2Impl_Release,
/*** IDirect3DMaterial methods ***/
IDirect3DMaterial2Impl_SetMaterial,
IDirect3DMaterial2Impl_GetMaterial,
IDirect3DMaterial2Impl_GetHandle
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Thunk_IDirect3DMaterialImpl_2_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DMaterialImpl_2_AddRef,
XCAST(Release) Thunk_IDirect3DMaterialImpl_2_Release,
XCAST(SetMaterial) Thunk_IDirect3DMaterialImpl_2_SetMaterial,
XCAST(GetMaterial) Thunk_IDirect3DMaterialImpl_2_GetMaterial,
XCAST(GetHandle) Thunk_IDirect3DMaterialImpl_2_GetHandle,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DMaterial.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DMaterial) VTABLE_IDirect3DMaterial =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Thunk_IDirect3DMaterialImpl_1_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DMaterialImpl_1_AddRef,
XCAST(Release) Thunk_IDirect3DMaterialImpl_1_Release,
XCAST(Initialize) Main_IDirect3DMaterialImpl_1_Initialize,
XCAST(SetMaterial) Thunk_IDirect3DMaterialImpl_1_SetMaterial,
XCAST(GetMaterial) Thunk_IDirect3DMaterialImpl_1_GetMaterial,
XCAST(GetHandle) Thunk_IDirect3DMaterialImpl_1_GetHandle,
XCAST(Reserve) Main_IDirect3DMaterialImpl_1_Reserve,
XCAST(Unreserve) Main_IDirect3DMaterialImpl_1_Unreserve,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d)
{
IDirect3DMaterialImpl *object;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DMaterialImpl));
if (object == NULL) return DDERR_OUTOFMEMORY;
object->ref = 1;
object->d3d = d3d;
object->activate = activate;
ICOM_INIT_INTERFACE(object, IDirect3DMaterial, VTABLE_IDirect3DMaterial);
ICOM_INIT_INTERFACE(object, IDirect3DMaterial2, VTABLE_IDirect3DMaterial2);
ICOM_INIT_INTERFACE(object, IDirect3DMaterial3, VTABLE_IDirect3DMaterial3);
*obj = object;
TRACE(" creating implementation at %p.\n", *obj);
return D3D_OK;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,300 @@
/* Direct3D Viewport
* Copyright (c) 2002 Lionel ULMER
*
* This file contains the implementation of Direct3DVertexBuffer COM object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "ddraw.h"
#include "d3d.h"
#include "wine/debug.h"
#include "d3d_private.h"
#include "mesa_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_QueryInterface(LPDIRECT3DVERTEXBUFFER7 iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
/* By default, set the object pointer to NULL */
*obp = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
*obp = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) ) {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
*obp = ICOM_INTERFACE(This, IDirect3DVertexBuffer);
TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) ) {
IDirect3DVertexBuffer7_AddRef(ICOM_INTERFACE(This,IDirect3DVertexBuffer7));
*obp = ICOM_INTERFACE(This, IDirect3DVertexBuffer7);
TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
return OLE_E_ENUM_NOMORE;
}
ULONG WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_AddRef(LPDIRECT3DVERTEXBUFFER7 iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
return ++(This->ref);
}
ULONG WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_Release(LPDIRECT3DVERTEXBUFFER7 iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (--(This->ref) == 0) {
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_Lock(LPDIRECT3DVERTEXBUFFER7 iface,
DWORD dwFlags,
LPVOID* lplpData,
LPDWORD lpdwSize)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%08lx,%p,%p): stub!\n", This, iface, dwFlags, lplpData, lpdwSize);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_Unlock(LPDIRECT3DVERTEXBUFFER7 iface)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(): stub!\n", This, iface);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_ProcessVertices(LPDIRECT3DVERTEXBUFFER7 iface,
DWORD dwVertexOp,
DWORD dwDestIndex,
DWORD dwCount,
LPDIRECT3DVERTEXBUFFER7 lpSrcBuffer,
DWORD dwSrcIndex,
LPDIRECT3DDEVICE7 lpD3DDevice,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%08lx,%08lx,%08lx,%p,%08lx,%p,%08lx): stub!\n", This, iface, dwVertexOp, dwDestIndex, dwCount, lpSrcBuffer, dwSrcIndex, lpD3DDevice, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_1T_GetVertexBufferDesc(LPDIRECT3DVERTEXBUFFER7 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertexBufferDesc)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpD3DVertexBufferDesc);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_Optimize(LPDIRECT3DVERTEXBUFFER7 iface,
LPDIRECT3DDEVICE7 lpD3DDevice,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%p,%08lx): stub!\n", This, iface, lpD3DDevice, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_7_ProcessVerticesStrided(LPDIRECT3DVERTEXBUFFER7 iface,
DWORD dwVertexOp,
DWORD dwDestIndex,
DWORD dwCount,
LPD3DDRAWPRIMITIVESTRIDEDDATA lpStrideData,
DWORD dwVertexTypeDesc,
LPDIRECT3DDEVICE7 lpD3DDevice,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface);
FIXME("(%p/%p)->(%08lx,%08lx,%08lx,%p,%08lx,%p,%08lx): stub!\n", This, iface, dwVertexOp, dwDestIndex, dwCount, lpStrideData, dwVertexTypeDesc, lpD3DDevice, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_1_ProcessVertices(LPDIRECT3DVERTEXBUFFER iface,
DWORD dwVertexOp,
DWORD dwDestIndex,
DWORD dwCount,
LPDIRECT3DVERTEXBUFFER lpSrcBuffer,
DWORD dwSrcIndex,
LPDIRECT3DDEVICE3 lpD3DDevice,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
FIXME("(%p/%p)->(%08lx,%08lx,%08lx,%p,%08lx,%p,%08lx): stub!\n", This, iface, dwVertexOp, dwDestIndex, dwCount, lpSrcBuffer, dwSrcIndex, lpD3DDevice, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DVertexBufferImpl_1_Optimize(LPDIRECT3DVERTEXBUFFER iface,
LPDIRECT3DDEVICE3 lpD3DDevice,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, iface);
FIXME("(%p/%p)->(%p,%08lx): stub!\n", This, iface, lpD3DDevice, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(LPDIRECT3DVERTEXBUFFER iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3DVertexBuffer7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3DVertexBuffer7_QueryInterface(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface),
riid,
obp);
}
ULONG WINAPI
Thunk_IDirect3DVertexBufferImpl_1_AddRef(LPDIRECT3DVERTEXBUFFER iface)
{
TRACE("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", iface);
return IDirect3DVertexBuffer7_AddRef(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface));
}
ULONG WINAPI
Thunk_IDirect3DVertexBufferImpl_1_Release(LPDIRECT3DVERTEXBUFFER iface)
{
TRACE("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", iface);
return IDirect3DVertexBuffer7_Release(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface));
}
HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_Lock(LPDIRECT3DVERTEXBUFFER iface,
DWORD dwFlags,
LPVOID* lplpData,
LPDWORD lpdwSize)
{
TRACE("(%p)->(%08lx,%p,%p) thunking to IDirect3DVertexBuffer7 interface.\n", iface, dwFlags, lplpData, lpdwSize);
return IDirect3DVertexBuffer7_Lock(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface),
dwFlags,
lplpData,
lpdwSize);
}
HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_Unlock(LPDIRECT3DVERTEXBUFFER iface)
{
TRACE("(%p)->() thunking to IDirect3DVertexBuffer7 interface.\n", iface);
return IDirect3DVertexBuffer7_Unlock(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface));
}
HRESULT WINAPI
Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(LPDIRECT3DVERTEXBUFFER iface,
LPD3DVERTEXBUFFERDESC lpD3DVertexBufferDesc)
{
TRACE("(%p)->(%p) thunking to IDirect3DVertexBuffer7 interface.\n", iface, lpD3DVertexBufferDesc);
return IDirect3DVertexBuffer7_GetVertexBufferDesc(COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer, IDirect3DVertexBuffer7, iface),
lpD3DVertexBufferDesc);
}
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DVertexBuffer7.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DVertexBuffer7) VTABLE_IDirect3DVertexBuffer7 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Main_IDirect3DVertexBufferImpl_7_1T_QueryInterface,
XCAST(AddRef) Main_IDirect3DVertexBufferImpl_7_1T_AddRef,
XCAST(Release) Main_IDirect3DVertexBufferImpl_7_1T_Release,
XCAST(Lock) Main_IDirect3DVertexBufferImpl_7_1T_Lock,
XCAST(Unlock) Main_IDirect3DVertexBufferImpl_7_1T_Unlock,
XCAST(ProcessVertices) Main_IDirect3DVertexBufferImpl_7_ProcessVertices,
XCAST(GetVertexBufferDesc) Main_IDirect3DVertexBufferImpl_7_1T_GetVertexBufferDesc,
XCAST(Optimize) Main_IDirect3DVertexBufferImpl_7_Optimize,
XCAST(ProcessVerticesStrided) Main_IDirect3DVertexBufferImpl_7_ProcessVerticesStrided,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DVertexBuffer.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DVertexBuffer) VTABLE_IDirect3DVertexBuffer =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(AddRef) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(Release) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(Lock) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(Unlock) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(ProcessVertices) Main_IDirect3DVertexBufferImpl_1_ProcessVertices,
XCAST(GetVertexBufferDesc) Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc,
XCAST(Optimize) Main_IDirect3DVertexBufferImpl_1_Optimize,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc)
{
IDirect3DVertexBufferImpl *object;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBufferImpl));
if (object == NULL) return DDERR_OUTOFMEMORY;
object->ref = 1;
object->d3d = d3d;
ICOM_INIT_INTERFACE(object, IDirect3DVertexBuffer, VTABLE_IDirect3DVertexBuffer);
ICOM_INIT_INTERFACE(object, IDirect3DVertexBuffer7, VTABLE_IDirect3DVertexBuffer7);
*obj = object;
TRACE(" creating implementation at %p.\n", *obj);
return D3D_OK;
}

View File

@ -31,390 +31,497 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#ifdef HAVE_OPENGL
static void activate(IDirect3DViewportImpl* This) {
IDirect3DLightImpl* light;
#define D3DVPRIVATE(x) mesa_d3dv_private*dvpriv=((mesa_d3dv_private*)x->private)
#define D3DLPRIVATE(x) mesa_d3dl_private*dlpriv=((mesa_d3dl_private*)x->private)
/* Activate all the lights associated with this context */
light = This->lights;
static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable;
/*******************************************************************************
* Viewport1/2 static functions
*/
static void activate(IDirect3DViewport2Impl* This) {
IDirect3DLightImpl* l;
/* Activate all the lights associated with this context */
l = This->lights;
while (l != NULL) {
l->activate(l);
l = l->next;
}
}
/*******************************************************************************
* Viewport1/2 Creation functions
*/
LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2)
{
IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1;
ICOM_VTBL(vp) = &viewport2_vtable;
vp->d3d.d3d2 = d3d2;
vp->use_d3d2 = 1;
vp->device.active_device2 = NULL;
vp->activate = activate;
vp->lights = NULL;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT2)vp;
}
LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1)
{
IDirect3DViewport2Impl* vp;
vp = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DViewport2Impl));
vp->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dv_private));
vp->ref = 1;
ICOM_VTBL(vp) = &viewport2_vtable;
vp->d3d.d3d1 = d3d1;
vp->use_d3d2 = 0;
vp->device.active_device1 = NULL;
vp->activate = activate;
vp->lights = NULL;
((mesa_d3dv_private *) vp->private)->nextlight = GL_LIGHT0;
return (LPDIRECT3DVIEWPORT) vp;
}
/*******************************************************************************
* IDirect3DViewport2 methods
*/
HRESULT WINAPI IDirect3DViewport2Impl_QueryInterface(LPDIRECT3DVIEWPORT2 iface,
REFIID riid,
LPVOID* ppvObj)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
return S_OK;
while (light != NULL) {
light->activate(light);
light = light->next;
}
}
ULONG WINAPI IDirect3DViewport2Impl_AddRef(LPDIRECT3DVIEWPORT2 iface)
static void _dump_D3DVIEWPORT(D3DVIEWPORT *lpvp)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
TRACE(" - dwSize = %ld dwX = %ld dwY = %ld\n",
lpvp->dwSize, lpvp->dwX, lpvp->dwY);
TRACE(" - dwWidth = %ld dwHeight = %ld\n",
lpvp->dwWidth, lpvp->dwHeight);
TRACE(" - dvScaleX = %f dvScaleY = %f\n",
lpvp->dvScaleX, lpvp->dvScaleY);
TRACE(" - dvMaxX = %f dvMaxY = %f\n",
lpvp->dvMaxX, lpvp->dvMaxY);
TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
lpvp->dvMinZ, lpvp->dvMaxZ);
}
return ++(This->ref);
static void _dump_D3DVIEWPORT2(D3DVIEWPORT2 *lpvp)
{
TRACE(" - dwSize = %ld dwX = %ld dwY = %ld\n",
lpvp->dwSize, lpvp->dwX, lpvp->dwY);
TRACE(" - dwWidth = %ld dwHeight = %ld\n",
lpvp->dwWidth, lpvp->dwHeight);
TRACE(" - dvClipX = %f dvClipY = %f\n",
lpvp->dvClipX, lpvp->dvClipY);
TRACE(" - dvClipWidth = %f dvClipHeight = %f\n",
lpvp->dvClipWidth, lpvp->dvClipHeight);
TRACE(" - dvMinZ = %f dvMaxZ = %f\n",
lpvp->dvMinZ, lpvp->dvMaxZ);
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_QueryInterface(LPDIRECT3DVIEWPORT3 iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
*obp = NULL;
if ( IsEqualGUID(&IID_IUnknown, riid) ||
IsEqualGUID(&IID_IDirect3DViewport, riid) ||
IsEqualGUID(&IID_IDirect3DViewport2, riid) ||
IsEqualGUID(&IID_IDirect3DViewport3, riid) ) {
IDirect3DViewport3_AddRef(ICOM_INTERFACE(This, IDirect3DViewport3));
*obp = ICOM_INTERFACE(This, IDirect3DViewport3);
TRACE(" Creating IDirect3DViewport1/2/3 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
return OLE_E_ENUM_NOMORE;
}
ULONG WINAPI
Main_IDirect3DViewportImpl_3_2_1_AddRef(LPDIRECT3DVIEWPORT3 iface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
return ++(This->ref);
}
ULONG WINAPI
Main_IDirect3DViewportImpl_3_2_1_Release(LPDIRECT3DVIEWPORT3 iface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
ULONG WINAPI IDirect3DViewport2Impl_Release(LPDIRECT3DVIEWPORT2 iface)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_Initialize(LPDIRECT3DVIEWPORT3 iface,
LPDIRECT3D lpDirect3D)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This->private);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
TRACE("(%p/%p)->(%p) no-op...\n", This, iface, lpDirect3D);
return DD_OK;
}
/*** IDirect3DViewport methods ***/
HRESULT WINAPI IDirect3DViewport2Impl_Initialize(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3D d3d)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_GetViewport(LPDIRECT3DVIEWPORT3 iface,
LPD3DVIEWPORT lpData)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, d3d);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
DWORD dwSize;
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
if (This->use_vp2 != 0) {
ERR(" Requesting to get a D3DVIEWPORT struct where a D3DVIEWPORT2 was set !\n");
return DDERR_INVALIDPARAMS;
}
dwSize = lpData->dwSize;
memset(lpData, 0, dwSize);
memcpy(lpData, &(This->viewports.vp1), dwSize);
return DD_OK;
if (TRACE_ON(ddraw)) {
TRACE(" returning D3DVIEWPORT :");
_dump_D3DVIEWPORT(lpData);
}
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_GetViewport(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT lpvp)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_SetViewport(LPDIRECT3DVIEWPORT3 iface,
LPD3DVIEWPORT lpData)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpvp);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
if (This->use_vp2 != 0)
if (TRACE_ON(ddraw)) {
TRACE(" getting D3DVIEWPORT :\n");
_dump_D3DVIEWPORT(lpData);
}
This->use_vp2 = 0;
memset(&(This->viewports.vp1), 0, sizeof(This->viewports.vp1));
memcpy(&(This->viewports.vp1), lpData, lpData->dwSize);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_TransformVertices(LPDIRECT3DVIEWPORT3 iface,
DWORD dwVertexCount,
LPD3DTRANSFORMDATA lpData,
DWORD dwFlags,
LPDWORD lpOffScreen)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%08lx,%p,%08lx,%p): stub!\n", This, iface, dwVertexCount, lpData, dwFlags, lpOffScreen);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_LightElements(LPDIRECT3DVIEWPORT3 iface,
DWORD dwElementCount,
LPD3DLIGHTDATA lpData)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%08lx,%p): stub!\n", This, iface, dwElementCount, lpData);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_SetBackground(LPDIRECT3DVIEWPORT3 iface,
D3DMATERIALHANDLE hMat)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%08lx): stub!\n", This, iface, (DWORD) hMat);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_GetBackground(LPDIRECT3DVIEWPORT3 iface,
LPD3DMATERIALHANDLE lphMat,
LPBOOL lpValid)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lphMat, lpValid);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_SetBackgroundDepth(LPDIRECT3DVIEWPORT3 iface,
LPDIRECTDRAWSURFACE lpDDSurface)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpDDSurface);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_GetBackgroundDepth(LPDIRECT3DVIEWPORT3 iface,
LPDIRECTDRAWSURFACE* lplpDDSurface,
LPBOOL lpValid)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDSurface, lpValid);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_Clear(LPDIRECT3DVIEWPORT3 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%08lx,%p,%08lx): stub!\n", This, iface, dwCount, lpRects, dwFlags);
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_AddLight(LPDIRECT3DVIEWPORT3 iface,
LPDIRECT3DLIGHT lpDirect3DLight)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DLight);
/* Add the light in the 'linked' chain */
lpDirect3DLightImpl->next = This->lights;
This->lights = lpDirect3DLightImpl;
/* If active, activate the light */
if (This->active_device != NULL) {
lpDirect3DLightImpl->activate(lpDirect3DLightImpl);
}
return DD_OK;
}
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_DeleteLight(LPDIRECT3DVIEWPORT3 iface,
LPDIRECT3DLIGHT lpDirect3DLight)
{
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
IDirect3DLightImpl *lpDirect3DLightImpl = ICOM_OBJECT(IDirect3DLightImpl, IDirect3DLight, lpDirect3DLight);
IDirect3DLightImpl *cur_light, *prev_light = NULL;
TRACE("(%p/%p)->(%p)\n", This, iface, lpDirect3DLight);
cur_light = This->lights;
while (cur_light != NULL) {
if (cur_light == lpDirect3DLightImpl) {
lpDirect3DLightImpl->desactivate(lpDirect3DLightImpl);
if (prev_light == NULL) This->lights = cur_light->next;
else prev_light->next = cur_light->next;
return DD_OK;
}
prev_light = cur_light;
cur_light = cur_light->next;
}
return DDERR_INVALIDPARAMS;
*lpvp = This->viewport.vp1;
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_SetViewport(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT lpvp)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_1_NextLight(LPDIRECT3DVIEWPORT3 iface,
LPDIRECT3DLIGHT lpDirect3DLight,
LPDIRECT3DLIGHT* lplpDirect3DLight,
DWORD dwFlags)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpvp);
This->use_vp2 = 0;
This->viewport.vp1 = *lpvp;
TRACE("dwSize = %ld dwX = %ld dwY = %ld\n",
lpvp->dwSize, lpvp->dwX, lpvp->dwY);
TRACE("dwWidth = %ld dwHeight = %ld\n",
lpvp->dwWidth, lpvp->dwHeight);
TRACE("dvScaleX = %f dvScaleY = %f\n",
lpvp->dvScaleX, lpvp->dvScaleY);
TRACE("dvMaxX = %f dvMaxY = %f\n",
lpvp->dvMaxX, lpvp->dvMaxY);
TRACE("dvMinZ = %f dvMaxZ = %f\n",
lpvp->dvMinZ, lpvp->dvMaxZ);
return DD_OK;
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpDirect3DLight, lplpDirect3DLight, dwFlags);
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_TransformVertices(LPDIRECT3DVIEWPORT2 iface,
DWORD dwVertexCount,
LPD3DTRANSFORMDATA lpData,
DWORD dwFlags,
LPDWORD lpOffScreen)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_GetViewport2(LPDIRECT3DVIEWPORT3 iface,
LPD3DVIEWPORT2 lpData)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%8ld,%p,%08lx,%p): stub\n",
This, dwVertexCount, lpData, dwFlags, lpOffScreen);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
DWORD dwSize;
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
if (This->use_vp2 != 1) {
ERR(" Requesting to get a D3DVIEWPORT2 struct where a D3DVIEWPORT was set !\n");
return DDERR_INVALIDPARAMS;
}
dwSize = lpData->dwSize;
memset(lpData, 0, dwSize);
memcpy(lpData, &(This->viewports.vp2), dwSize);
return DD_OK;
if (TRACE_ON(ddraw)) {
TRACE(" returning D3DVIEWPORT2 :");
_dump_D3DVIEWPORT2(lpData);
}
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_LightElements(LPDIRECT3DVIEWPORT2 iface,
DWORD dwElementCount,
LPD3DLIGHTDATA lpData)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_2_SetViewport2(LPDIRECT3DVIEWPORT3 iface,
LPD3DVIEWPORT2 lpData)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%8ld,%p): stub\n", This, dwElementCount, lpData);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lpData);
return DD_OK;
if (TRACE_ON(ddraw)) {
TRACE(" getting D3DVIEWPORT2 :\n");
_dump_D3DVIEWPORT2(lpData);
}
This->use_vp2 = 1;
memset(&(This->viewports.vp2), 0, sizeof(This->viewports.vp2));
memcpy(&(This->viewports.vp2), lpData, lpData->dwSize);
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_SetBackground(LPDIRECT3DVIEWPORT2 iface,
D3DMATERIALHANDLE hMat)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_SetBackgroundDepth2(LPDIRECT3DVIEWPORT3 iface,
LPDIRECTDRAWSURFACE4 lpDDS)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%08lx): stub\n", This, (DWORD) hMat);
return DD_OK;
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p): stub!\n", This, iface, lpDDS);
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_GetBackground(LPDIRECT3DVIEWPORT2 iface,
LPD3DMATERIALHANDLE lphMat,
LPBOOL lpValid)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_GetBackgroundDepth2(LPDIRECT3DVIEWPORT3 iface,
LPDIRECTDRAWSURFACE4* lplpDDS,
LPBOOL lpValid)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lphMat, lpValid);
return DD_OK;
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDDS, lpValid);
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_SetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
LPDIRECTDRAWSURFACE lpDDSurface)
HRESULT WINAPI
Main_IDirect3DViewportImpl_3_Clear2(LPDIRECT3DVIEWPORT3 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags,
DWORD dwColor,
D3DVALUE dvZ,
DWORD dwStencil)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p): stub\n", This, lpDDSurface);
return DD_OK;
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
FIXME("(%p/%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx): stub!\n", This, iface, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_GetBackgroundDepth(LPDIRECT3DVIEWPORT2 iface,
LPDIRECTDRAWSURFACE* lplpDDSurface,
LPBOOL lpValid)
HRESULT WINAPI
GL_IDirect3DViewportImpl_3_2_1_Clear(LPDIRECT3DVIEWPORT3 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lplpDDSurface, lpValid);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
GLboolean ztest;
TRACE("(%p/%p)->(%08lx,%p,%08lx)\n", This, iface, dwCount, lpRects, dwFlags);
return DD_OK;
if (dwCount != 1) {
WARN(" Warning, this function only for now clears the whole screen...\n");
}
/* Clears the screen */
ENTER_GL();
glGetBooleanv(GL_DEPTH_WRITEMASK, &ztest);
glDepthMask(GL_TRUE); /* Enables Z writing to be sure to delete also the Z buffer */
glClear(((dwFlags & D3DCLEAR_TARGET) ? GL_COLOR_BUFFER_BIT : 0) |
((dwFlags & D3DCLEAR_ZBUFFER) ? GL_DEPTH_BUFFER_BIT : 0));
glDepthMask(ztest);
LEAVE_GL();
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_Clear(LPDIRECT3DVIEWPORT2 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags)
HRESULT WINAPI
GL_IDirect3DViewportImpl_3_Clear2(LPDIRECT3DVIEWPORT3 iface,
DWORD dwCount,
LPD3DRECT lpRects,
DWORD dwFlags,
DWORD dwColor,
D3DVALUE dvZ,
DWORD dwStencil)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
GLboolean ztest;
FIXME("(%p)->(%8ld,%p,%08lx): stub\n", This, dwCount, lpRects, dwFlags);
ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface);
GLboolean ztest;
GLfloat old_z_clear_value;
GLbitfield bitfield = 0;
GLint old_stencil_clear_value;
GLfloat old_color_clear_value[4];
TRACE("(%p/%p)->(%08lx,%p,%08lx,%08lx,%f,%08lx)\n", This, iface, dwCount, lpRects, dwFlags, dwColor, dvZ, dwStencil);
/* For the moment, ignore the rectangles */
if (This->device.active_device1 != NULL) {
/* Get the rendering context */
if (This->use_d3d2)
This->device.active_device2->set_context(This->device.active_device2);
else
This->device.active_device1->set_context(This->device.active_device1);
}
if (dwCount != 1) {
WARN(" Warning, this function only for now clears the whole screen...\n");
}
/* Clears the screen */
ENTER_GL();
glGetBooleanv(GL_DEPTH_TEST, &ztest);
glDepthMask(GL_TRUE); /* Enables Z writing to be sure to delete also the Z buffer */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDepthMask(ztest);
LEAVE_GL();
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_AddLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
IDirect3DLightImpl* ilpLight=(IDirect3DLightImpl*)lpLight;
FIXME("(%p)->(%p): stub\n", This, ilpLight);
/* Add the light in the 'linked' chain */
ilpLight->next = This->lights;
This->lights = ilpLight;
/* If active, activate the light */
if (This->device.active_device1 != NULL) {
D3DVPRIVATE(This);
D3DLPRIVATE(ilpLight);
/* Get the rendering context */
if (This->use_d3d2)
This->device.active_device2->set_context(This->device.active_device2);
else
This->device.active_device1->set_context(This->device.active_device1);
/* Activate the light */
dlpriv->light_num = dvpriv->nextlight++;
ilpLight->activate(ilpLight);
}
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_DeleteLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
IDirect3DLightImpl** currentlplpLight;
TRACE("(%p)->(%p): stub\n", This, lpLight);
currentlplpLight = &(This->lights);
while(*currentlplpLight) {
if (*currentlplpLight == (IDirect3DLightImpl*)lpLight) {
*currentlplpLight = (*currentlplpLight)->next;
return DD_OK;
if (dwFlags & D3DCLEAR_ZBUFFER) {
glGetBooleanv(GL_DEPTH_WRITEMASK, &ztest);
glDepthMask(GL_TRUE); /* Enables Z writing to be sure to delete also the Z buffer */
glGetFloatv(GL_DEPTH_CLEAR_VALUE, &old_z_clear_value);
glClearDepth(dvZ);
TRACE(" Depth value : %f\n", dvZ);
bitfield |= GL_DEPTH_BUFFER_BIT;
}
currentlplpLight = &((*currentlplpLight)->next);
}
return DDERR_INVALIDOBJECT;
if (dwFlags & D3DCLEAR_STENCIL) {
bitfield |= GL_STENCIL_BUFFER_BIT;
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &old_stencil_clear_value);
glClearStencil(dwStencil);
TRACE(" Stencil value : %ld\n", dwStencil);
}
if (dwFlags & D3DCLEAR_TARGET) {
bitfield |= GL_COLOR_BUFFER_BIT;
glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
glClearColor(((dwColor >> 16) & 0xFF) / 255.0,
((dwColor >> 8) & 0xFF) / 255.0,
((dwColor >> 0) & 0xFF) / 255.0,
((dwColor >> 24) & 0xFF) / 255.0);
TRACE("Color value (ARGB) : %08lx", dwColor);
}
glClear(bitfield);
if (dwFlags & D3DCLEAR_ZBUFFER) {
glDepthMask(ztest);
glClearDepth(old_z_clear_value);
}
if (dwFlags & D3DCLEAR_STENCIL) {
bitfield |= GL_STENCIL_BUFFER_BIT;
glClearStencil(old_stencil_clear_value);
}
if (dwFlags & D3DCLEAR_TARGET) {
bitfield |= GL_COLOR_BUFFER_BIT;
glClearColor(old_color_clear_value[0],
old_color_clear_value[1],
old_color_clear_value[2],
old_color_clear_value[3]);
}
LEAVE_GL();
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_NextLight(LPDIRECT3DVIEWPORT2 iface,
LPDIRECT3DLIGHT lpLight,
LPDIRECT3DLIGHT* lplpLight,
DWORD dwFlags)
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3DViewport3.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3DViewport3) VTABLE_IDirect3DViewport3 =
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
FIXME("(%p)->(%p,%p,%08lx): stub\n", This, lpLight, lplpLight, dwFlags);
return DD_OK;
}
/*** IDirect3DViewport2 methods ***/
HRESULT WINAPI IDirect3DViewport2Impl_GetViewport2(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT2 lpViewport2)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpViewport2);
if (This->use_vp2 != 1)
return DDERR_INVALIDPARAMS;
*lpViewport2 = This->viewport.vp2;
return DD_OK;
}
HRESULT WINAPI IDirect3DViewport2Impl_SetViewport2(LPDIRECT3DVIEWPORT2 iface,
LPD3DVIEWPORT2 lpViewport2)
{
ICOM_THIS(IDirect3DViewport2Impl,iface);
TRACE("(%p)->(%p)\n", This, lpViewport2);
TRACE("dwSize = %ld dwX = %ld dwY = %ld\n",
lpViewport2->dwSize, lpViewport2->dwX, lpViewport2->dwY);
TRACE("dwWidth = %ld dwHeight = %ld\n",
lpViewport2->dwWidth, lpViewport2->dwHeight);
TRACE("dvClipX = %f dvClipY = %f\n",
lpViewport2->dvClipX, lpViewport2->dvClipY);
TRACE("dvClipWidth = %f dvClipHeight = %f\n",
lpViewport2->dvClipWidth, lpViewport2->dvClipHeight);
TRACE("dvMinZ = %f dvMaxZ = %f\n",
lpViewport2->dvMinZ, lpViewport2->dvMaxZ);
This->viewport.vp2 = *lpViewport2;
This->use_vp2 = 1;
return DD_OK;
}
/*******************************************************************************
* IDirect3DViewport1/2 VTable
*/
static ICOM_VTABLE(IDirect3DViewport2) viewport2_vtable =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/*** IUnknown methods ***/
IDirect3DViewport2Impl_QueryInterface,
IDirect3DViewport2Impl_AddRef,
IDirect3DViewport2Impl_Release,
/*** IDirect3DViewport methods ***/
IDirect3DViewport2Impl_Initialize,
IDirect3DViewport2Impl_GetViewport,
IDirect3DViewport2Impl_SetViewport,
IDirect3DViewport2Impl_TransformVertices,
IDirect3DViewport2Impl_LightElements,
IDirect3DViewport2Impl_SetBackground,
IDirect3DViewport2Impl_GetBackground,
IDirect3DViewport2Impl_SetBackgroundDepth,
IDirect3DViewport2Impl_GetBackgroundDepth,
IDirect3DViewport2Impl_Clear,
IDirect3DViewport2Impl_AddLight,
IDirect3DViewport2Impl_DeleteLight,
IDirect3DViewport2Impl_NextLight,
/*** IDirect3DViewport2 methods ***/
IDirect3DViewport2Impl_GetViewport2,
IDirect3DViewport2Impl_SetViewport2
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Main_IDirect3DViewportImpl_3_2_1_QueryInterface,
XCAST(AddRef) Main_IDirect3DViewportImpl_3_2_1_AddRef,
XCAST(Release) Main_IDirect3DViewportImpl_3_2_1_Release,
XCAST(Initialize) Main_IDirect3DViewportImpl_3_2_1_Initialize,
XCAST(GetViewport) Main_IDirect3DViewportImpl_3_2_1_GetViewport,
XCAST(SetViewport) Main_IDirect3DViewportImpl_3_2_1_SetViewport,
XCAST(TransformVertices) Main_IDirect3DViewportImpl_3_2_1_TransformVertices,
XCAST(LightElements) Main_IDirect3DViewportImpl_3_2_1_LightElements,
XCAST(SetBackground) Main_IDirect3DViewportImpl_3_2_1_SetBackground,
XCAST(GetBackground) Main_IDirect3DViewportImpl_3_2_1_GetBackground,
XCAST(SetBackgroundDepth) Main_IDirect3DViewportImpl_3_2_1_SetBackgroundDepth,
XCAST(GetBackgroundDepth) Main_IDirect3DViewportImpl_3_2_1_GetBackgroundDepth,
XCAST(Clear) GL_IDirect3DViewportImpl_3_2_1_Clear,
XCAST(AddLight) Main_IDirect3DViewportImpl_3_2_1_AddLight,
XCAST(DeleteLight) Main_IDirect3DViewportImpl_3_2_1_DeleteLight,
XCAST(NextLight) Main_IDirect3DViewportImpl_3_2_1_NextLight,
XCAST(GetViewport2) Main_IDirect3DViewportImpl_3_2_GetViewport2,
XCAST(SetViewport2) Main_IDirect3DViewportImpl_3_2_SetViewport2,
XCAST(SetBackgroundDepth2) Main_IDirect3DViewportImpl_3_SetBackgroundDepth2,
XCAST(GetBackgroundDepth2) Main_IDirect3DViewportImpl_3_GetBackgroundDepth2,
XCAST(Clear2) GL_IDirect3DViewportImpl_3_Clear2,
};
#else /* HAVE_OPENGL */
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1) {
ERR("Should not be called...\n");
return NULL;
HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d)
{
IDirect3DViewportImpl *object;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DViewportImpl));
if (object == NULL) return DDERR_OUTOFMEMORY;
object->ref = 1;
object->d3d = d3d;
object->activate = activate;
object->use_vp2 = 0xFF;
object->next = NULL;
object->lights = NULL;
ICOM_INIT_INTERFACE(object, IDirect3DViewport3, VTABLE_IDirect3DViewport3);
*obj = object;
TRACE(" creating implementation at %p.\n", *obj);
return D3D_OK;
}
LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2) {
ERR("Should not be called...\n");
return NULL;
}
#endif /* HAVE_OPENGL */

View File

@ -17,6 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DDCOMIMPL_H_
#define _DDCOMIMPL_H_
#include <stddef.h>
/* Generates the name for a vtable pointer for a given interface. */
@ -51,3 +54,5 @@
#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
#endif /* _DDCOMIMPL_H_ */

View File

@ -37,6 +37,7 @@
#include "wine/debug.h"
#include "ddraw_private.h"
#include "mesa_private.h" /* To have the D3D creation function */
#include "ddraw/main.h"
#include "dclipper/main.h"
#include "dpalette/main.h"
@ -139,13 +140,15 @@ ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) {
return ref;
}
/* TODO: need to support IDirect3D. */
HRESULT WINAPI Main_DirectDraw_QueryInterface(
LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj
) {
ICOM_THIS(IDirectDrawImpl,iface);
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(refiid), obj);
/* According to COM docs, if the QueryInterface fails, obj should be set to NULL */
*obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, refiid )
|| IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{
@ -164,17 +167,53 @@ HRESULT WINAPI Main_DirectDraw_QueryInterface(
*obj = ICOM_INTERFACE(This, IDirectDraw4);
}
#ifdef HAVE_OPENGL
else if ( IsEqualGUID( &IID_IDirect3D3, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{
return create_direct3d3(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D);
TRACE(" returning Direct3D interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{
return create_direct3d2(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D2);
TRACE(" returning Direct3D2 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D, refiid ) )
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{
return create_direct3d(obj, This);
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D3);
TRACE(" returning Direct3D3 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D7 , refiid ) )
{
IDirect3DImpl *d3d_impl;
HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This);
if (FAILED(ret_value)) return ret_value;
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D7);
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
}
#endif
else

View File

@ -280,8 +280,8 @@ struct IDirectDrawSurfaceImpl
void (*aux_release)(LPVOID ctx, LPVOID data);
BOOL (*aux_flip)(LPVOID ctx, LPVOID data);
void (*aux_unlock)(LPVOID ctx, LPVOID data, LPRECT lpRect);
struct IDirect3DTexture2Impl* texture;
HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
struct IDirect3DTextureImpl *texture;
HRESULT (WINAPI *SetColorKey_cb)(struct IDirect3DTextureImpl *texture, DWORD dwFlags, LPDDCOLORKEY ckey ) ;
};
/*****************************************************************************
@ -333,11 +333,6 @@ typedef struct {
extern Convert ModeEmulations[8];
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
extern HRESULT create_direct3d(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d2(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d3(LPVOID *obj,IDirectDrawImpl*);
extern HRESULT create_direct3d7(LPVOID *obj,IDirectDrawImpl*);
/******************************************************************************
* Structure conversion (for thunks)
*/

View File

@ -35,263 +35,466 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirect3D) d3dvt;
static ICOM_VTABLE(IDirect3D2) d3d2vt;
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
/*******************************************************************************
* IDirect3D
*/
HRESULT WINAPI IDirect3DImpl_QueryInterface(
LPDIRECT3D iface,REFIID refiid,LPVOID *obj
) {
ICOM_THIS(IDirect3DImpl,iface);
/* FIXME: Not sure if this is correct */
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(riid), obp);
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
if (( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
( IsEqualGUID (&IID_IDirectDraw2, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
/* By default, set the object pointer to NULL */
*obp = NULL;
if (( IsEqualGUID( &IID_IDirectDraw, riid ) ) ||
( IsEqualGUID (&IID_IDirectDraw2, riid ) ) ||
( IsEqualGUID (&IID_IDirectDraw4, riid ) ) ||
( IsEqualGUID( &IID_IDirectDraw7, riid ) )
) {
*obj = This->ddraw;
IDirect3D_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
HRESULT ret;
TRACE(" Creating IDirectDrawX interface by calling DirectDraw function.\n");
ret = IDirectDraw_QueryInterface(ICOM_INTERFACE(This->ddraw,IDirectDraw), riid, obp);
if (ret == S_OK) {
IDirectDraw_Release(ICOM_INTERFACE(This->ddraw,IDirectDraw));
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
}
return ret;
}
if ( IsEqualGUID( &IID_IUnknown, riid ) ) {
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obp);
return S_OK;
}
if (( IsEqualGUID( &IID_IDirect3D, refiid ) ) ||
( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
*obj = This;
IDirect3D_AddRef(iface);
TRACE(" Creating IDirect3D interface (%p)\n", *obj);
if ( IsEqualGUID( &IID_IDirect3D, riid ) ) {
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = ICOM_INTERFACE(This, IDirect3D);
TRACE(" Creating IDirect3D interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) {
IDirect3D2Impl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = This->ddraw;
IDirect3D_AddRef(iface);
ICOM_VTBL(d3d) = &d3d2vt;
*obj = d3d;
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
if ( IsEqualGUID( &IID_IDirect3D2, riid ) ) {
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = ICOM_INTERFACE(This, IDirect3D2);
TRACE(" Creating IDirect3D2 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
if ( IsEqualGUID( &IID_IDirect3D3, riid ) ) {
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = ICOM_INTERFACE(This, IDirect3D3);
TRACE(" Creating IDirect3D3 interface %p\n", *obp);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3D7, riid ) ) {
/* This is not 100 % true as we should not be able to QueryInterface a '7' version from another one.
But well, to factorize the code, why check for application bugs :-) ?
*/
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = ICOM_INTERFACE(This, IDirect3D7);
TRACE(" Creating IDirect3D7 interface %p\n", *obp);
return S_OK;
}
FIXME("(%p): interface for IID %s NOT found!\n", This, debugstr_guid(riid));
return OLE_E_ENUM_NOMORE;
}
ULONG WINAPI IDirect3DImpl_AddRef(LPDIRECT3D iface) {
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_AddRef(LPDIRECT3D7 iface)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref);
return ++(This->ref);
}
ULONG WINAPI IDirect3DImpl_Release(LPDIRECT3D iface)
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_Release(LPDIRECT3D7 iface)
{
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
HeapFree(GetProcessHeap(),0,This);
return S_OK;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref);
if (--(This->ref) == 0) {
IDirectDraw_Release(ICOM_INTERFACE(This->ddraw, IDirectDraw));
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return This->ref;
}
HRESULT WINAPI IDirect3DImpl_Initialize(LPDIRECT3D iface,REFIID refiid) {
ICOM_THIS(IDirect3DImpl,iface);
/* FIXME: Not sure if this is correct */
FIXME("(%p)->(%s):stub.\n",This,debugstr_guid(refiid));
return DDERR_ALREADYINITIALIZED;
}
HRESULT WINAPI IDirect3DImpl_EnumDevices(
LPDIRECT3D iface, LPD3DENUMDEVICESCALLBACK cb, LPVOID context
) {
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
return DD_OK;
}
HRESULT WINAPI IDirect3DImpl_CreateLight(
LPDIRECT3D iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3DImpl_CreateMaterial(
LPDIRECT3D iface, LPDIRECT3DMATERIAL *lpmaterial, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3DImpl_CreateViewport(
LPDIRECT3D iface, LPDIRECT3DVIEWPORT *lpviewport, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3DImpl_FindDevice(
LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst)
HRESULT WINAPI
Main_IDirect3DImpl_1_Initialize(LPDIRECT3D iface,
REFIID riid)
{
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%s) no-op...\n", This, iface, debugstr_guid(riid));
return D3D_OK;
}
/* This is for checking the correctness of the prototypes/functions.
* Do not remove.
*/
static ICOM_VTABLE(IDirect3D) WINE_UNUSED d3dvt = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3DImpl_QueryInterface,
IDirect3DImpl_AddRef,
IDirect3DImpl_Release,
IDirect3DImpl_Initialize,
IDirect3DImpl_EnumDevices,
IDirect3DImpl_CreateLight,
IDirect3DImpl_CreateMaterial,
IDirect3DImpl_CreateViewport,
IDirect3DImpl_FindDevice
};
/*******************************************************************************
* IDirect3D2
*/
HRESULT WINAPI IDirect3D2Impl_QueryInterface(
LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IDirect3D2Impl,iface);
/* FIXME: Not sure if this is correct */
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) ) {
*obj = This->ddraw;
IDirect3D2_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
return S_OK;
}
if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) ||
( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
*obj = This;
IDirect3D2_AddRef(iface);
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3D, refiid ) ) {
IDirect3DImpl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = This->ddraw;
IDirect3D2_AddRef(iface);
ICOM_VTBL(d3d) = &d3dvt;
*obj = d3d;
TRACE(" Creating IDirect3D interface (%p)\n", *obj);
return S_OK;
}
FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE;
}
ULONG WINAPI IDirect3D2Impl_AddRef(LPDIRECT3D2 iface) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
return ++(This->ref);
}
ULONG WINAPI IDirect3D2Impl_Release(LPDIRECT3D2 iface) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
HeapFree(GetProcessHeap(),0,This);
return S_OK;
}
return This->ref;
}
HRESULT WINAPI IDirect3D2Impl_EnumDevices(
LPDIRECT3D2 iface,LPD3DENUMDEVICESCALLBACK cb, LPVOID context
) {
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
return DD_OK;
}
HRESULT WINAPI IDirect3D2Impl_CreateLight(
LPDIRECT3D2 iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3D2Impl_CreateMaterial(
LPDIRECT3D2 iface, LPDIRECT3DMATERIAL2 *lpmaterial, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3D2Impl_CreateViewport(
LPDIRECT3D2 iface, LPDIRECT3DVIEWPORT2 *lpviewport, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
return E_FAIL;
}
HRESULT WINAPI IDirect3D2Impl_FindDevice(
LPDIRECT3D2 iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst)
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return DD_OK;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg);
return D3D_OK;
}
HRESULT WINAPI IDirect3D2Impl_CreateDevice(
LPDIRECT3D2 iface, REFCLSID rguid, LPDIRECTDRAWSURFACE surface,
LPDIRECT3DDEVICE2 *device)
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter)
{
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%s,%p,%p): stub\n",This,debugstr_guid(rguid),surface,device);
return DDERR_INVALIDPARAMS;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DLight, pUnkOuter);
return D3D_OK;
}
/* This is for checking the correctness of the prototypes/functions.
* Do not remove.
*/
static ICOM_VTABLE(IDirect3D2) WINE_UNUSED d3d2vt =
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3,
IUnknown* pUnkOuter)
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirect3D2Impl_QueryInterface,
IDirect3D2Impl_AddRef,
IDirect3D2Impl_Release,
IDirect3D2Impl_EnumDevices,
IDirect3D2Impl_CreateLight,
IDirect3D2Impl_CreateMaterial,
IDirect3D2Impl_CreateViewport,
IDirect3D2Impl_FindDevice,
IDirect3D2Impl_CreateDevice
};
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DMaterial3, pUnkOuter);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
LPDIRECT3DVIEWPORT3* lplpD3DViewport3,
IUnknown* pUnkOuter)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpD3DViewport3, pUnkOuter);
return D3D_OK;
}
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_3_2T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lpD3DFDR);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE4 lpDDS,
LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%s,%p,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3, lpUnk);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EvictManagedTextures(LPDIRECT3D7 iface)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(): stub!\n", This, iface);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE7 lpDDS,
LPDIRECT3DDEVICE7* lplpD3DDevice)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice);
return D3D_OK;
}
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf,
DWORD dwFlags)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpD3DVertBufDesc, lplpD3DVertBuf, dwFlags);
return D3D_OK;
}
HRESULT WINAPI
Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface),
riid,
obp);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_QueryInterface(LPDIRECT3D2 iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface),
riid,
obp);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_QueryInterface(LPDIRECT3D iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface),
riid,
obp);
}
ULONG WINAPI
Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_2_Release(LPDIRECT3D2 iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_1_Release(LPDIRECT3D iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface));
}
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EnumZBufferFormats(LPDIRECT3D3 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext)
{
TRACE("(%p)->(%s,%p,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext);
return IDirect3D7_EnumZBufferFormats(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface),
riidDevice,
lpEnumCallback,
lpContext);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EvictManagedTextures(LPDIRECT3D3 iface)
{
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_EvictManagedTextures(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface));
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpEnumDevicesCallback, lpUserArg);
return IDirect3D3_EnumDevices(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface),
lpEnumDevicesCallback,
lpUserArg);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpEnumDevicesCallback, lpUserArg);
return IDirect3D3_EnumDevices(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
lpEnumDevicesCallback,
lpUserArg);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateLight(LPDIRECT3D2 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter);
return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface),
lplpDirect3DLight,
pUnkOuter);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateLight(LPDIRECT3D iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter);
return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
lplpDirect3DLight,
pUnkOuter);
}
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, IDirect3D2, IDirect3D3, iface),
lpD3DDFS,
lpD3DFDR);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateMaterial(LPDIRECT3D iface,
LPDIRECT3DMATERIAL* lplpDirect3DMaterial,
IUnknown* pUnkOuter)
{
HRESULT ret;
LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial, pUnkOuter);
ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
&ret_val,
pUnkOuter);
*lplpDirect3DMaterial = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial, &ret_val);
TRACE(" returning interface %p.\n", *lplpDirect3DMaterial);
return ret;
}
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateViewport(LPDIRECT3D iface,
LPDIRECT3DVIEWPORT* lplpD3DViewport,
IUnknown* pUnkOuter)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport, pUnkOuter);
return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface),
(LPDIRECT3DVIEWPORT3 *) lplpD3DViewport /* No need to cast here */,
pUnkOuter);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateMaterial(LPDIRECT3D2 iface,
LPDIRECT3DMATERIAL2* lplpDirect3DMaterial2,
IUnknown* pUnkOuter)
{
HRESULT ret;
LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial2, pUnkOuter);
ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface),
&ret_val,
pUnkOuter);
*lplpDirect3DMaterial2 = COM_INTERFACE_CAST(IDirect3DMaterialImpl, IDirect3DMaterial3, IDirect3DMaterial2, &ret_val);
TRACE(" returning interface %p.\n", *lplpDirect3DMaterial2);
return ret;
}
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateViewport(LPDIRECT3D2 iface,
LPDIRECT3DVIEWPORT* lplpD3DViewport2,
IUnknown* pUnkOuter)
{
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport2, pUnkOuter);
return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface),
(LPDIRECT3DVIEWPORT3 *) lplpD3DViewport2 /* No need to cast here */,
pUnkOuter);
}
HRESULT WINAPI
Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER* lplpD3DVertBuf,
DWORD dwFlags,
LPUNKNOWN lpUnk)
{
HRESULT ret;
LPDIRECT3DVERTEXBUFFER7 ret_val;
TRACE("(%p)->(%p,%p,%08lx,%p) thunking to IDirect3D7 interface.\n", iface, lpD3DVertBufDesc, lplpD3DVertBuf, dwFlags, lpUnk);
ret = IDirect3D7_CreateVertexBuffer(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface),
lpD3DVertBufDesc,
&ret_val,
dwFlags);
*lplpD3DVertBuf = COM_INTERFACE_CAST(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, IDirect3DVertexBuffer, ret_val);
TRACE(" returning interface %p.\n", *lplpD3DVertBuf);
return ret;
}

199
dlls/ddraw/direct3d/main.h Normal file
View File

@ -0,0 +1,199 @@
/*
* Copyright 2002 Lionel Ulmer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
/* This is defined here so as to be able to put them in 'drivers' */
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_AddRef(LPDIRECT3D7 iface);
ULONG WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_Release(LPDIRECT3D7 iface);
HRESULT WINAPI
Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Main_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE7 lpDDS,
LPDIRECT3DDEVICE7* lplpD3DDevice);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf,
DWORD dwFlags);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EvictManagedTextures(LPDIRECT3D7 iface);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
LPDIRECT3DVIEWPORT3* lplpD3DViewport3,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_3_2T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);
HRESULT WINAPI
Main_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE4 lpDDS,
LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER* lplpD3DVertBuf,
DWORD dwFlags,
LPUNKNOWN lpUnk);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateMaterial(LPDIRECT3D2 iface,
LPDIRECT3DMATERIAL2* lplpDirect3DMaterial2,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateViewport(LPDIRECT3D2 iface,
LPDIRECT3DVIEWPORT2* lplpD3DViewport2,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2);
HRESULT WINAPI
Main_IDirect3DImpl_1_Initialize(LPDIRECT3D iface,
REFIID riid);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateMaterial(LPDIRECT3D iface,
LPDIRECT3DMATERIAL* lplpDirect3DMaterial,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateViewport(LPDIRECT3D iface,
LPDIRECT3DVIEWPORT* lplpD3DViewport,
IUnknown* pUnkOuter);
HRESULT WINAPI
Main_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_QueryInterface(LPDIRECT3D2 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_QueryInterface(LPDIRECT3D iface,
REFIID riid,
LPVOID* obp);
ULONG WINAPI
Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface);
ULONG WINAPI
Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_2_Release(LPDIRECT3D2 iface);
ULONG WINAPI
Thunk_IDirect3DImpl_1_Release(LPDIRECT3D iface);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EnumZBufferFormats(LPDIRECT3D3 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext);
HRESULT WINAPI
Thunk_IDirect3DImpl_3_EvictManagedTextures(LPDIRECT3D3 iface);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_CreateLight(LPDIRECT3D2 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_1_CreateLight(LPDIRECT3D iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter);
HRESULT WINAPI
Thunk_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR);

View File

@ -32,382 +32,342 @@
#include "winerror.h"
#include "ddraw_private.h"
#include "d3d_private.h"
#include "mesa_private.h"
#include "main.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/*******************************************************************************
* IDirect3D
*/
static HRESULT WINAPI MESA_IDirect3DImpl_QueryInterface(
LPDIRECT3D iface,REFIID refiid,LPVOID *obj
) {
ICOM_THIS(IDirect3DImpl,iface);
/* FIXME: Not sure if this is correct */
#define MAX_LIGHTS 8
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
if (( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
( IsEqualGUID (&IID_IDirectDraw2, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
) {
*obj = This->ddraw;
IDirect3D_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
return S_OK;
}
if (( IsEqualGUID( &IID_IDirect3D, refiid ) ) ||
( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
*obj = This;
IDirect3D_AddRef(iface);
TRACE(" Creating IDirect3D interface (%p)\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) {
IDirect3D2Impl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = This->ddraw;
IDirect3D_AddRef(iface);
ICOM_VTBL(d3d) = &mesa_d3d2vt;
*obj = d3d;
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
return S_OK;
}
FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI MESA_IDirect3DImpl_Release(LPDIRECT3D iface)
HRESULT WINAPI
GL_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
HeapFree(GetProcessHeap(),0,This);
return S_OK;
}
return This->ref;
}
static HRESULT WINAPI MESA_IDirect3DImpl_EnumDevices(
LPDIRECT3D iface, LPD3DENUMDEVICESCALLBACK cb, LPVOID context
) {
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL_dx3(cb, context))
if (d3device_enumerate(lpEnumDevicesCallback, lpUserArg, 1) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3DImpl_CreateLight(
LPDIRECT3D iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
/* Call the creation function that is located in d3dlight.c */
*lplight = d3dlight_create_dx3(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3DImpl_CreateMaterial(
LPDIRECT3D iface, LPDIRECT3DMATERIAL *lpmaterial, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
/* Call the creation function that is located in d3dviewport.c */
*lpmaterial = d3dmaterial_create(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3DImpl_CreateViewport(
LPDIRECT3D iface, LPDIRECT3DVIEWPORT *lpviewport, IUnknown *lpunk
) {
ICOM_THIS(IDirect3DImpl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
/* Call the creation function that is located in d3dviewport.c */
*lpviewport = d3dviewport_create(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3DImpl_FindDevice(
LPDIRECT3D iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst)
HRESULT WINAPI
GL_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS(IDirect3DImpl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
return D3D_OK;
}
ICOM_VTABLE(IDirect3D) mesa_d3dvt =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
MESA_IDirect3DImpl_QueryInterface,
IDirect3DImpl_AddRef,
MESA_IDirect3DImpl_Release,
IDirect3DImpl_Initialize,
MESA_IDirect3DImpl_EnumDevices,
MESA_IDirect3DImpl_CreateLight,
MESA_IDirect3DImpl_CreateMaterial,
MESA_IDirect3DImpl_CreateViewport,
MESA_IDirect3DImpl_FindDevice
};
/*******************************************************************************
* IDirect3D2
*/
static HRESULT WINAPI MESA_IDirect3D2Impl_QueryInterface(
LPDIRECT3D2 iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IDirect3D2Impl,iface);
/* FIXME: Not sure if this is correct */
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) ||
( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) ) {
*obj = This->ddraw;
IDirect3D2_AddRef(iface);
TRACE(" Creating IDirectDrawX interface (%p)\n", *obj);
return S_OK;
}
if ( ( IsEqualGUID( &IID_IDirect3D2, refiid ) ) ||
( IsEqualGUID( &IID_IUnknown, refiid ) ) ) {
*obj = This;
IDirect3D2_AddRef(iface);
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3D, refiid ) ) {
IDirect3DImpl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = This->ddraw;
IDirect3D2_AddRef(iface);
ICOM_VTBL(d3d) = &mesa_d3dvt;
*obj = d3d;
TRACE(" Creating IDirect3D interface (%p)\n", *obj);
return S_OK;
}
FIXME("(%p):interface for IID %s NOT found!\n",This,debugstr_guid(refiid));
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI MESA_IDirect3D2Impl_Release(LPDIRECT3D2 iface) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
if (!--(This->ref)) {
IDirectDraw2_Release((IDirectDraw2*)This->ddraw);
HeapFree(GetProcessHeap(),0,This);
return S_OK;
}
return This->ref;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_EnumDevices(
LPDIRECT3D2 iface,LPD3DENUMDEVICESCALLBACK cb, LPVOID context
) {
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p),stub!\n",This,cb,context);
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (!d3d_OpenGL(cb, context))
if (d3device_enumerate(lpEnumDevicesCallback, lpUserArg, 2) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateLight(
LPDIRECT3D2 iface, LPDIRECT3DLIGHT *lplight, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lplight, lpunk);
/* Call the creation function that is located in d3dlight.c */
*lplight = d3dlight_create(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateMaterial(
LPDIRECT3D2 iface, LPDIRECT3DMATERIAL2 *lpmaterial, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lpmaterial, lpunk);
/* Call the creation function that is located in d3dviewport.c */
*lpmaterial = d3dmaterial2_create(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateViewport(
LPDIRECT3D2 iface, LPDIRECT3DVIEWPORT2 *lpviewport, IUnknown *lpunk
) {
ICOM_THIS(IDirect3D2Impl,iface);
TRACE("(%p)->(%p,%p): stub\n", This, lpviewport, lpunk);
/* Call the creation function that is located in d3dviewport.c */
*lpviewport = d3dviewport2_create(This);
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_FindDevice(
LPDIRECT3D2 iface, LPD3DFINDDEVICESEARCH lpfinddevsrc,
LPD3DFINDDEVICERESULT lpfinddevrst)
HRESULT WINAPI
GL_IDirect3DImpl_3_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg)
{
ICOM_THIS(IDirect3D2Impl,iface);
FIXME("(%p)->(%p,%p): stub\n", This, lpfinddevsrc, lpfinddevrst);
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */
if (d3device_enumerate(lpEnumDevicesCallback, lpUserArg, 3) != D3DENUMRET_OK)
return D3D_OK;
return D3D_OK;
}
static HRESULT WINAPI MESA_IDirect3D2Impl_CreateDevice(
LPDIRECT3D2 iface, REFCLSID rguid, LPDIRECTDRAWSURFACE surface,
LPDIRECT3DDEVICE2 *device)
HRESULT WINAPI
GL_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter)
{
ICOM_THIS(IDirect3D2Impl,iface);
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
int fl;
IDirect3DLightImpl *d3dlimpl;
HRESULT ret_value;
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpDirect3DLight, pUnkOuter);
for (fl = 0; fl < MAX_LIGHTS; fl++) {
if ((glThis->free_lights & (0x01 << fl)) != 0) {
glThis->free_lights &= ~(0x01 << fl);
break;
}
}
if (fl == MAX_LIGHTS) {
return DDERR_INVALIDPARAMS; /* No way to say 'max lights reached' ... */
}
ret_value = d3dlight_create(&d3dlimpl, This, GL_LIGHT0 + fl);
*lplpDirect3DLight = ICOM_INTERFACE(d3dlimpl, IDirect3DLight);
FIXME("(%p)->(%s,%p,%p): stub\n",This,debugstr_guid(rguid),surface,device);
return ret_value;
}
if (is_OpenGL(rguid, (IDirectDrawSurfaceImpl*)surface, (IDirect3DDevice2Impl**)device, This)) {
IDirect3D2_AddRef(iface);
HRESULT WINAPI
GL_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3,
IUnknown* pUnkOuter)
{
IDirect3DMaterialImpl *D3Dmat_impl;
HRESULT ret_value;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpDirect3DMaterial3, pUnkOuter);
ret_value = d3dmaterial_create(&D3Dmat_impl, This);
*lplpDirect3DMaterial3 = ICOM_INTERFACE(D3Dmat_impl, IDirect3DMaterial3);
return ret_value;
}
HRESULT WINAPI
GL_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
LPDIRECT3DVIEWPORT3* lplpD3DViewport3,
IUnknown* pUnkOuter)
{
IDirect3DViewportImpl *D3Dvp_impl;
HRESULT ret_value;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpD3DViewport3, pUnkOuter);
ret_value = d3dviewport_create(&D3Dvp_impl, This);
*lplpD3DViewport3 = ICOM_INTERFACE(D3Dvp_impl, IDirect3DViewport3);
return ret_value;
}
static HRESULT
create_device_helper(IDirect3DImpl *This,
REFCLSID iid,
IDirectDrawSurfaceImpl *lpDDS,
void **obj,
int interface) {
IDirect3DDeviceImpl *lpd3ddev;
HRESULT ret_value;
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 )) {
TRACE(" returning OpenGL D3DDevice2 %p\n", *obj);
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice2);
return D3D_OK;
}
if (IsEqualGUID( &IID_D3DDEVICE3_OpenGL, iid )) {
TRACE(" returning OpenGL D3DDevice3 %p\n", *obj);
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice3);
return D3D_OK;
}
if (IsEqualGUID( &IID_D3DDEVICE7_OpenGL, iid )) {
TRACE(" returning OpenGL D3DDevice7 %p\n", *obj);
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice7);
return D3D_OK;
}
if ((iid == NULL) ||
(IsEqualGUID(&IID_IDirect3DHALDevice, iid)) ||
(IsEqualGUID(&IID_D3DDEVICE_Default, iid))) {
switch (interface) {
case 1:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice);
TRACE(" returning OpenGL D3DDevice %p via default / HAL interface\n", *obj);
return D3D_OK;
case 2:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice2);
TRACE(" returning OpenGL D3DDevice2 %p via default / HAL interface\n", *obj);
return D3D_OK;
case 3:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice3);
TRACE(" returning OpenGL D3DDevice3 %p via default / HAL interface\n", *obj);
return D3D_OK;
case 7:
*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice7);
TRACE(" returning OpenGL D3DDevice7 %p via default / HAL interface\n", *obj);
return D3D_OK;
}
}
*obj = NULL;
ERR(" Interface unknown when creating D3DDevice (%s)\n", debugstr_guid(iid));
IDirect3DDevice7_Release(ICOM_INTERFACE(lpd3ddev, IDirect3DDevice7));
return DDERR_INVALIDPARAMS;
}
ICOM_VTABLE(IDirect3D2) mesa_d3d2vt =
HRESULT WINAPI
GL_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2)
{
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
};
static HRESULT WINAPI MESA_IDirect3D3Impl_CreateVertexBuffer(
LPDIRECT3D3 iface,
LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc,
LPDIRECT3DVERTEXBUFFER* lplpD3DVertBuf,
DWORD dwFlags,
LPUNKNOWN lpUnk)
{
FIXME(":stub\n");
return D3D_OK;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface);
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, lpDDS);
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2);
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice2, 2);
}
static HRESULT WINAPI MESA_IDirect3D3Impl_EnumZBufferFormats(
LPDIRECT3D3 iface,
REFCLSID riidDevice,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext)
HRESULT WINAPI
GL_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
REFCLSID rclsid,
LPDIRECTDRAWSURFACE4 lpDDS,
LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk)
{
FIXME(":stub\n");
return DDERR_NOZBUFFERHW; /* Pretend we don't have valid HW */
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface);
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS);
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3);
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice3, 3);
}
static HRESULT WINAPI MESA_IDirect3D3Impl_EvictManagedTextures(
LPDIRECT3D3 iface)
static void light_released(IDirect3DImpl *This, GLenum light_num)
{
FIXME(":stub\n");
return D3D_OK;
IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
glThis->free_lights |= (light_num - GL_LIGHT0);
}
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(mesa_d3d3vt.fun))
# define XCAST(fun) (typeof(VTABLE_IDirect3D7.fun))
#else
# define XCAST(fun) (void*)
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3D3) mesa_d3d3vt =
ICOM_VTABLE(IDirect3D7) VTABLE_IDirect3D7 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface)MESA_IDirect3D2Impl_QueryInterface,
XCAST(AddRef)IDirect3D2Impl_AddRef,
XCAST(Release)MESA_IDirect3D2Impl_Release,
XCAST(EnumDevices)MESA_IDirect3D2Impl_EnumDevices,
XCAST(CreateLight)MESA_IDirect3D2Impl_CreateLight,
XCAST(CreateMaterial)MESA_IDirect3D2Impl_CreateMaterial,
XCAST(CreateViewport)MESA_IDirect3D2Impl_CreateViewport,
XCAST(FindDevice)MESA_IDirect3D2Impl_FindDevice,
XCAST(CreateDevice)MESA_IDirect3D2Impl_CreateDevice,
XCAST(CreateVertexBuffer)MESA_IDirect3D3Impl_CreateVertexBuffer,
XCAST(EnumZBufferFormats)MESA_IDirect3D3Impl_EnumZBufferFormats,
XCAST(EvictManagedTextures)MESA_IDirect3D3Impl_EvictManagedTextures
XCAST(QueryInterface) Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface,
XCAST(AddRef) Main_IDirect3DImpl_7_3T_2T_1T_AddRef,
XCAST(Release) Main_IDirect3DImpl_7_3T_2T_1T_Release,
XCAST(EnumDevices) Main_IDirect3DImpl_7_EnumDevices,
XCAST(CreateDevice) Main_IDirect3DImpl_7_CreateDevice,
XCAST(CreateVertexBuffer) Main_IDirect3DImpl_7_3T_CreateVertexBuffer,
XCAST(EnumZBufferFormats) Main_IDirect3DImpl_7_3T_EnumZBufferFormats,
XCAST(EvictManagedTextures) Main_IDirect3DImpl_7_3T_EvictManagedTextures,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
HRESULT create_direct3d(LPVOID *obj,IDirectDrawImpl* ddraw) {
IDirect3DImpl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = (IDirectDrawImpl *) ddraw;
d3d->private = NULL; /* unused for now */
IDirectDraw_AddRef((LPDIRECTDRAW)ddraw);
ICOM_VTBL(d3d) = &mesa_d3dvt;
*obj = (LPUNKNOWN)d3d;
TRACE(" Created IDirect3D interface (%p)\n", *obj);
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3D3.fun))
#else
# define XCAST(fun) (void*)
#endif
return S_OK;
ICOM_VTABLE(IDirect3D3) VTABLE_IDirect3D3 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
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(CreateLight) Main_IDirect3DImpl_3_2T_1T_CreateLight,
XCAST(CreateMaterial) GL_IDirect3DImpl_3_2T_1T_CreateMaterial,
XCAST(CreateViewport) GL_IDirect3DImpl_3_2T_1T_CreateViewport,
XCAST(FindDevice) Main_IDirect3DImpl_3_2T_FindDevice,
XCAST(CreateDevice) GL_IDirect3DImpl_3_CreateDevice,
XCAST(CreateVertexBuffer) Thunk_IDirect3DImpl_3_CreateVertexBuffer,
XCAST(EnumZBufferFormats) Thunk_IDirect3DImpl_3_EnumZBufferFormats,
XCAST(EvictManagedTextures) Thunk_IDirect3DImpl_3_EvictManagedTextures,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3D2.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3D2) VTABLE_IDirect3D2 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Thunk_IDirect3DImpl_2_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DImpl_2_AddRef,
XCAST(Release) Thunk_IDirect3DImpl_2_Release,
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) Thunk_IDirect3DImpl_2_FindDevice,
XCAST(CreateDevice) GL_IDirect3DImpl_2_CreateDevice,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(VTABLE_IDirect3D.fun))
#else
# define XCAST(fun) (void*)
#endif
ICOM_VTABLE(IDirect3D) VTABLE_IDirect3D =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Thunk_IDirect3DImpl_1_QueryInterface,
XCAST(AddRef) Thunk_IDirect3DImpl_1_AddRef,
XCAST(Release) Thunk_IDirect3DImpl_1_Release,
XCAST(Initialize) Main_IDirect3DImpl_1_Initialize,
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) Main_IDirect3DImpl_1_FindDevice,
};
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#undef XCAST
#endif
HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw)
{
IDirect3DImpl *object;
IDirect3DGLImpl *globject;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DGLImpl));
if (object == NULL) return DDERR_OUTOFMEMORY;
object->ref = 1;
object->ddraw = ddraw;
ICOM_INIT_INTERFACE(object, IDirect3D, VTABLE_IDirect3D);
ICOM_INIT_INTERFACE(object, IDirect3D2, VTABLE_IDirect3D2);
ICOM_INIT_INTERFACE(object, IDirect3D3, VTABLE_IDirect3D3);
ICOM_INIT_INTERFACE(object, IDirect3D7, VTABLE_IDirect3D7);
globject = (IDirect3DGLImpl *) object;
globject->free_lights = (0x01 << MAX_LIGHTS) - 1; /* There are, in total, 8 lights in OpenGL */
globject->light_released = light_released;
*obj = object;
TRACE(" creating implementation at %p.\n", *obj);
return D3D_OK;
}
HRESULT create_direct3d2(LPVOID *obj,IDirectDrawImpl* ddraw) {
IDirect3D2Impl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = (IDirectDrawImpl *) ddraw;
d3d->private = NULL; /* unused for now */
IDirectDraw_AddRef((LPDIRECTDRAW)ddraw);
ICOM_VTBL(d3d) = &mesa_d3d2vt;
*obj = (LPUNKNOWN)d3d;
TRACE(" Creating IDirect3D2 interface (%p)\n", *obj);
return S_OK;
}
HRESULT create_direct3d3(LPVOID *obj,IDirectDrawImpl* ddraw) {
IDirect3D3Impl* d3d;
d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d));
d3d->ref = 1;
d3d->ddraw = (IDirectDrawImpl *) 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;
}

View File

@ -395,14 +395,31 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
}
if (xsrc.bottom > sdesc.dwHeight)
xsrc.bottom = sdesc.dwHeight;
if (xdst.bottom > ddesc.dwHeight)
xdst.bottom = ddesc.dwHeight;
/* First check for the validity of source / destination rectangles. This was
verified using a test application + by MSDN.
*/
if ((src != NULL) &&
((xsrc.bottom > sdesc.dwHeight) || (xsrc.bottom < 0) ||
(xsrc.top > sdesc.dwHeight) || (xsrc.top < 0) ||
(xsrc.left > sdesc.dwWidth) || (xsrc.left < 0) ||
(xsrc.right > sdesc.dwWidth) || (xsrc.right < 0) ||
(xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top))) {
WARN("Application gave us bad source rectangle for Blt.\n");
return DDERR_INVALIDRECT;
}
/* For the Destination rect, it can be out of bounds on the condition that a clipper
is set for the given surface.
*/
if ((This->clipper == NULL) &&
((xdst.bottom > ddesc.dwHeight) || (xdst.bottom < 0) ||
(xdst.top > ddesc.dwHeight) || (xdst.top < 0) ||
(xdst.left > ddesc.dwWidth) || (xdst.left < 0) ||
(xdst.right > ddesc.dwWidth) || (xdst.right < 0) ||
(xdst.right < xdst.left) || (xdst.bottom < xdst.top))) {
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
return DDERR_INVALIDRECT;
}
if (src) assert((xsrc.bottom-xsrc.top) <= sdesc.dwHeight);
assert((xdst.bottom-xdst.top) <= ddesc.dwHeight);
/* Now handle negative values in the rectangles. Warning: only supported for now
in the 'simple' cases (ie not in any stretching / rotation cases).
@ -428,9 +445,9 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
IntersectRect(&temp_rect, &full_rect, &xdst);
xdst = temp_rect;
} else {
/* This is trickier as any update to one rectangle need to be propagated to the other */
int clip_horiz = (xdst.left < 0) || (xdst.right > (int) ddesc.dwWidth ) || (xsrc.left < 0) || (xsrc.right > (int) sdesc.dwWidth );
int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) ddesc.dwHeight) || (xsrc.top < 0) || (xsrc.bottom > (int) sdesc.dwHeight);
/* Only handle clipping on the destination rectangle */
int clip_horiz = (xdst.left < 0) || (xdst.right > (int) ddesc.dwWidth );
int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) ddesc.dwHeight);
if (clip_vert || clip_horiz) {
/* Now check if this is a special case or not... */
if ((((xdst.bottom - xdst.top ) != (xsrc.bottom - xsrc.top )) && clip_vert ) ||
@ -441,15 +458,11 @@ DIB_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
}
if (clip_horiz) {
if (xsrc.left < 0) { xdst.left -= xsrc.left; xsrc.left = 0; }
if (xdst.left < 0) { xsrc.left -= xdst.left; xdst.left = 0; }
if (xsrc.right > sdesc.dwWidth) { xdst.right -= (xsrc.right - (int) sdesc.dwWidth); xsrc.right = (int) sdesc.dwWidth; }
if (xdst.right > ddesc.dwWidth) { xsrc.right -= (xdst.right - (int) ddesc.dwWidth); xdst.right = (int) ddesc.dwWidth; }
}
if (clip_vert) {
if (xsrc.top < 0) { xdst.top -= xsrc.top; xsrc.top = 0; }
if (xdst.top < 0) { xsrc.top -= xdst.top; xdst.top = 0; }
if (xsrc.bottom > sdesc.dwHeight) { xdst.bottom -= (xsrc.bottom - (int) sdesc.dwHeight); xsrc.bottom = (int) sdesc.dwHeight; }
if (xdst.bottom > ddesc.dwHeight) { xsrc.bottom -= (xdst.bottom - (int) ddesc.dwHeight); xdst.bottom = (int) ddesc.dwHeight; }
}
/* And check if after clipping something is still to be done... */

View File

@ -169,36 +169,52 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
return S_OK;
}
#ifdef HAVE_OPENGL
else if ( IsEqualGUID( &IID_D3DDEVICE_OpenGL, riid ) )
else if ( IsEqualGUID( &IID_D3DDEVICE_OpenGL, riid ) ||
IsEqualGUID( &IID_IDirect3DHALDevice, riid) )
{
This->ref++;
return is_OpenGL_dx3(riid, This, (IDirect3DDeviceImpl**)ppObj)?S_OK:E_NOINTERFACE;
IDirect3DDeviceImpl *d3ddevimpl;
HRESULT ret_value;
ret_value = d3ddevice_create(&d3ddevimpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice);
TRACE(" returning Direct3DDevice interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
else if (IsEqualGUID( &IID_IDirect3DTexture, riid ))
{
LPDIRECT3DTEXTURE iface;
This->ref++;
iface = d3dtexture_create(This);
if (iface) {
*ppObj = (LPVOID)iface;
return S_OK;
} else
return E_NOINTERFACE;
IDirect3DTextureImpl *d3dteximpl;
HRESULT ret_value;
ret_value = d3dtexture_create(&d3dteximpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3dteximpl, IDirect3DTexture);
TRACE(" returning Direct3DTexture interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
else if (IsEqualGUID( &IID_IDirect3DTexture2, riid ))
{
LPDIRECT3DTEXTURE2 iface;
This->ref++;
iface = d3dtexture2_create(This);
if (iface) {
*ppObj = (LPVOID)iface;
return S_OK;
} else
return E_NOINTERFACE;
IDirect3DTextureImpl *d3dteximpl;
HRESULT ret_value;
ret_value = d3dtexture_create(&d3dteximpl, NULL, This);
if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3dteximpl, IDirect3DTexture2);
TRACE(" returning Direct3DTexture2 interface at %p.\n", *ppObj);
This->ref++; /* No idea if this is correct.. Need to check using real Windows */
return ret_value;
}
#endif
else
return E_NOINTERFACE;
return E_NOINTERFACE;
}
/*** Callbacks */

View File

@ -30,249 +30,227 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
#define D3DTPRIVATE(x) mesa_d3dt_private *dtpriv = (mesa_d3dt_private*)(x)->private
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState, RenderState *rs)
{
if (TRACE_ON(ddraw))
TRACE("%s = %08lx\n", _get_renderstate(dwRenderStateType), dwRenderState);
if (TRACE_ON(ddraw))
TRACE("%s = %08lx\n", _get_renderstate(dwRenderStateType), dwRenderState);
/* First, all the stipple patterns */
if ((dwRenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00) &&
(dwRenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31)) {
ERR("Unhandled dwRenderStateType stipple %d!\n",dwRenderStateType);
} else {
ENTER_GL();
/* First, all the stipple patterns */
if ((dwRenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00) &&
(dwRenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31)) {
ERR("Unhandled dwRenderStateType stipple %d!\n",dwRenderStateType);
} else {
ENTER_GL();
/* All others state variables */
switch (dwRenderStateType) {
case D3DRENDERSTATE_TEXTUREHANDLE: { /* 1 */
IDirect3DTextureImpl *tex = (IDirect3DTextureImpl*) dwRenderState;
if (tex == NULL) {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
TRACE("disabling texturing\n");
} else {
IDirect3DTextureGLImpl *gl_tex = (IDirect3DTextureGLImpl *) tex;
glEnable(GL_TEXTURE_2D);
/* Default parameters */
glBindTexture(GL_TEXTURE_2D, gl_tex->tex_name);
/* To prevent state change, we could test here what are the parameters
stored in the texture */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, rs->mag);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, rs->min);
TRACE("setting OpenGL texture handle : %d\n", gl_tex->tex_name);
}
} break;
/* All others state variables */
switch (dwRenderStateType) {
case D3DRENDERSTATE_TEXTUREPERSPECTIVE: /* 4 */
if (dwRenderState)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
else
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
break;
case D3DRENDERSTATE_TEXTUREHANDLE: { /* 1 */
IDirect3DTexture2Impl* tex = (IDirect3DTexture2Impl*) dwRenderState;
case D3DRENDERSTATE_ZENABLE: /* 7 */
if (dwRenderState)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
break;
if (tex == NULL) {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
TRACE("disabling texturing\n");
} else {
D3DTPRIVATE(tex);
case D3DRENDERSTATE_FILLMODE: /* 8 */
switch ((D3DFILLMODE) dwRenderState) {
case D3DFILL_POINT:
glPolygonMode(GL_FRONT_AND_BACK,GL_POINT);
break;
case D3DFILL_WIREFRAME:
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
break;
case D3DFILL_SOLID:
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
break;
default:
ERR("Unhandled fill mode !\n");
}
break;
glEnable(GL_TEXTURE_2D);
/* Default parameters */
glBindTexture(GL_TEXTURE_2D, dtpriv->tex_name);
/* To prevent state change, we could test here what are the parameters
stored in the texture */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, rs->mag);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, rs->min);
TRACE("setting OpenGL texture handle : %d\n", dtpriv->tex_name);
}
} break;
case D3DRENDERSTATE_SHADEMODE: /* 9 */
switch ((D3DSHADEMODE) dwRenderState) {
case D3DSHADE_FLAT:
glShadeModel(GL_FLAT);
break;
case D3DSHADE_GOURAUD:
glShadeModel(GL_SMOOTH);
break;
default:
ERR("Unhandled shade mode !\n");
}
break;
case D3DRENDERSTATE_TEXTUREPERSPECTIVE: /* 4 */
if (dwRenderState)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
else
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
break;
case D3DRENDERSTATE_ZWRITEENABLE: /* 14 */
if (dwRenderState)
glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
break;
case D3DRENDERSTATE_ZENABLE: /* 7 */
if (dwRenderState)
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
break;
case D3DRENDERSTATE_TEXTUREMAG: /* 17 */
switch ((D3DTEXTUREFILTER) dwRenderState) {
case D3DFILTER_NEAREST:
rs->mag = GL_NEAREST;
break;
case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR;
break;
default:
ERR("Unhandled texture mag !\n");
}
break;
case D3DRENDERSTATE_FILLMODE: /* 8 */
switch ((D3DFILLMODE) dwRenderState) {
case D3DFILL_POINT:
glPolygonMode(GL_FRONT_AND_BACK,GL_POINT);
break;
case D3DFILL_WIREFRAME:
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
break;
case D3DFILL_SOLID:
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
break;
case D3DRENDERSTATE_TEXTUREMIN: /* 18 */
switch ((D3DTEXTUREFILTER) dwRenderState) {
case D3DFILTER_NEAREST:
rs->min = GL_NEAREST;
break;
case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR;
break;
default:
ERR("Unhandled texture min !\n");
}
break;
default:
ERR("Unhandled fill mode !\n");
}
break;
case D3DRENDERSTATE_SRCBLEND: /* 19 */
switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_SRCALPHA:
rs->src = GL_SRC_ALPHA;
break;
default:
ERR("Unhandled blend mode !\n");
}
glBlendFunc(rs->src, rs->dst);
break;
case D3DRENDERSTATE_SHADEMODE: /* 9 */
switch ((D3DSHADEMODE) dwRenderState) {
case D3DSHADE_FLAT:
glShadeModel(GL_FLAT);
break;
case D3DRENDERSTATE_DESTBLEND: /* 20 */
switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_INVSRCALPHA:
rs->dst = GL_ONE_MINUS_SRC_ALPHA;
break;
default:
ERR("Unhandled blend mode !\n");
}
glBlendFunc(rs->src, rs->dst);
break;
case D3DSHADE_GOURAUD:
glShadeModel(GL_SMOOTH);
break;
case D3DRENDERSTATE_TEXTUREMAPBLEND: /* 21 */
switch ((D3DTEXTUREBLEND) dwRenderState) {
case D3DTBLEND_MODULATE:
case D3DTBLEND_MODULATEALPHA:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
break;
default:
ERR("Unhandled texture environment !\n");
}
break;
default:
ERR("Unhandled shade mode !\n");
}
break;
case D3DRENDERSTATE_CULLMODE: /* 22 */
switch ((D3DCULL) dwRenderState) {
case D3DCULL_NONE:
glDisable(GL_CULL_FACE);
break;
case D3DCULL_CW:
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
break;
case D3DCULL_CCW:
glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW);
break;
default:
ERR("Unhandled cull mode !\n");
}
break;
case D3DRENDERSTATE_ZWRITEENABLE: /* 14 */
if (dwRenderState)
glDepthMask(GL_TRUE);
else
glDepthMask(GL_FALSE);
break;
case D3DRENDERSTATE_ZFUNC: /* 23 */
switch ((D3DCMPFUNC) dwRenderState) {
case D3DCMP_NEVER:
glDepthFunc(GL_NEVER);
break;
case D3DCMP_LESS:
glDepthFunc(GL_LESS);
break;
case D3DCMP_EQUAL:
glDepthFunc(GL_EQUAL);
break;
case D3DCMP_LESSEQUAL:
glDepthFunc(GL_LEQUAL);
break;
case D3DCMP_GREATER:
glDepthFunc(GL_GREATER);
break;
case D3DCMP_NOTEQUAL:
glDepthFunc(GL_NOTEQUAL);
break;
case D3DCMP_GREATEREQUAL:
glDepthFunc(GL_GEQUAL);
break;
case D3DCMP_ALWAYS:
glDepthFunc(GL_ALWAYS);
break;
default:
ERR("Unexpected value\n");
}
break;
case D3DRENDERSTATE_TEXTUREMAG: /* 17 */
switch ((D3DTEXTUREFILTER) dwRenderState) {
case D3DFILTER_NEAREST:
rs->mag = GL_NEAREST;
break;
case D3DRENDERSTATE_DITHERENABLE: /* 26 */
if (dwRenderState)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
break;
case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR;
break;
case D3DRENDERSTATE_ALPHABLENDENABLE: /* 27 */
if (dwRenderState)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
break;
default:
ERR("Unhandled texture mag !\n");
}
break;
case D3DRENDERSTATE_COLORKEYENABLE: /* 41 */
if (dwRenderState)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
break;
case D3DRENDERSTATE_TEXTUREMIN: /* 18 */
switch ((D3DTEXTUREFILTER) dwRenderState) {
case D3DFILTER_NEAREST:
rs->min = GL_NEAREST;
break;
case D3DRENDERSTATE_FLUSHBATCH: /* 50 */
break;
case D3DFILTER_LINEAR:
rs->mag = GL_LINEAR;
break;
default:
ERR("Unhandled texture min !\n");
}
break;
case D3DRENDERSTATE_SRCBLEND: /* 19 */
switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_SRCALPHA:
rs->src = GL_SRC_ALPHA;
break;
default:
ERR("Unhandled blend mode !\n");
}
glBlendFunc(rs->src, rs->dst);
break;
case D3DRENDERSTATE_DESTBLEND: /* 20 */
switch ((D3DBLEND) dwRenderState) {
case D3DBLEND_INVSRCALPHA:
rs->dst = GL_ONE_MINUS_SRC_ALPHA;
break;
default:
ERR("Unhandled blend mode !\n");
}
glBlendFunc(rs->src, rs->dst);
break;
case D3DRENDERSTATE_TEXTUREMAPBLEND: /* 21 */
switch ((D3DTEXTUREBLEND) dwRenderState) {
case D3DTBLEND_MODULATE:
case D3DTBLEND_MODULATEALPHA:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
break;
default:
ERR("Unhandled texture environment !\n");
}
break;
case D3DRENDERSTATE_CULLMODE: /* 22 */
switch ((D3DCULL) dwRenderState) {
case D3DCULL_NONE:
glDisable(GL_CULL_FACE);
break;
case D3DCULL_CW:
glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
break;
case D3DCULL_CCW:
glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW);
break;
default:
ERR("Unhandled cull mode !\n");
}
break;
case D3DRENDERSTATE_ZFUNC: /* 23 */
switch ((D3DCMPFUNC) dwRenderState) {
case D3DCMP_NEVER:
glDepthFunc(GL_NEVER);
break;
case D3DCMP_LESS:
glDepthFunc(GL_LESS);
break;
case D3DCMP_EQUAL:
glDepthFunc(GL_EQUAL);
break;
case D3DCMP_LESSEQUAL:
glDepthFunc(GL_LEQUAL);
break;
case D3DCMP_GREATER:
glDepthFunc(GL_GREATER);
break;
case D3DCMP_NOTEQUAL:
glDepthFunc(GL_NOTEQUAL);
break;
case D3DCMP_GREATEREQUAL:
glDepthFunc(GL_GEQUAL);
break;
case D3DCMP_ALWAYS:
glDepthFunc(GL_ALWAYS);
break;
default:
ERR("Unexpected value\n");
}
break;
case D3DRENDERSTATE_DITHERENABLE: /* 26 */
if (dwRenderState)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
break;
case D3DRENDERSTATE_ALPHABLENDENABLE: /* 27 */
if (dwRenderState)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
break;
case D3DRENDERSTATE_COLORKEYENABLE: /* 41 */
if (dwRenderState)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
break;
case D3DRENDERSTATE_FLUSHBATCH: /* 50 */
break;
default:
ERR("Unhandled dwRenderStateType %s !\n", _get_renderstate(dwRenderStateType));
break;
default:
ERR("Unhandled dwRenderStateType %s !\n", _get_renderstate(dwRenderStateType));
}
LEAVE_GL();
}
LEAVE_GL();
}
}

View File

@ -56,30 +56,74 @@ extern void (*wine_tsx11_unlock_ptr)(void);
#define ENTER_GL() wine_tsx11_lock_ptr()
#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;
extern const GUID IID_D3DDEVICE_Default;
/*****************************************************************************
* IDirect3DLight MESA private structure
*/
typedef struct mesa_d3dl_private
{
GLenum light_num;
} mesa_d3dl_private;
typedef struct render_state {
/* This is used for the device mode */
GLenum src, dst;
/* This is used for textures */
GLenum mag, min;
} RenderState;
/*****************************************************************************
* IDirect3DTexture2 MESA private structure
*/
typedef struct mesa_d3dt_private
{
GLuint tex_name;
} mesa_d3dt_private;
/* Common functions defined in d3dcommon.c */
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState, RenderState *rs) ;
/*****************************************************************************
* IDirect3DViewport2 implementation structure
*/
typedef struct mesa_d3dv_private
typedef struct IDirect3DGLImpl
{
GLenum nextlight;
} mesa_d3dv_private;
struct IDirect3DImpl parent;
int free_lights;
void (*light_released)(IDirect3DImpl *, GLenum light_num);
} IDirect3DGLImpl;
typedef struct IDirect3DLightGLImpl
{
struct IDirect3DLightImpl parent;
GLenum light_num;
} IDirect3DLightGLImpl;
typedef struct IDirect3DTextureGLImpl
{
struct IDirect3DTextureImpl parent;
GLuint tex_name;
} IDirect3DTextureGLImpl;
typedef struct IDirect3DDeviceGLImpl
{
struct IDirect3DDeviceImpl parent;
GLXContext gl_context;
/* The current render state */
RenderState render_state;
/* The last type of vertex drawn */
D3DVERTEXTYPE vertex_type;
D3DMATRIX *world_mat;
D3DMATRIX *view_mat;
D3DMATRIX *proj_mat;
Display *display;
Drawable drawable;
} IDirect3DDeviceGLImpl;
/* All non-static functions 'exported' by various sub-objects */
extern HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw);
extern HRESULT d3dtexture_create(IDirect3DTextureImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf);
extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num);
extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d);
extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d);
extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc);
extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface);
/* Used for Direct3D to request the device to enumerate itself */
extern HRESULT d3device_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version) ;
/* Matrix copy WITH transposition */
#define conv_mat2(mat,gl_mat) \
@ -116,74 +160,9 @@ typedef struct mesa_d3dv_private
memcpy(gl_mat, (mat), 16 * sizeof(float)); \
};
typedef struct render_state {
/* This is used for the device mode */
GLenum src, dst;
/* This is used for textures */
GLenum mag, min;
} RenderState;
typedef struct mesa_d3dd_private {
GLXContext ctx;
/* The current render state */
RenderState rs;
/* The last type of vertex drawn */
D3DVERTEXTYPE vt;
D3DMATRIX *world_mat;
D3DMATRIX *view_mat;
D3DMATRIX *proj_mat;
Display *gdi_display;
Drawable drawable;
} mesa_d3dd_private;
#define _dump_colorvalue(s,v) \
TRACE(" " s " : %f %f %f %f\n", \
(v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
/* Common functions defined in d3dcommon.c */
void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
DWORD dwRenderState, RenderState *rs) ;
/* All non-static functions 'exported' by various sub-objects */
extern LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf);
extern LPDIRECT3DLIGHT d3dlight_create_dx3(IDirect3DImpl* d3d1);
extern LPDIRECT3DLIGHT d3dlight_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DEXECUTEBUFFER d3dexecutebuffer_create(IDirect3DDeviceImpl* d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern LPDIRECT3DMATERIAL d3dmaterial_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DMATERIAL2 d3dmaterial2_create(IDirect3D2Impl* d3d2);
extern LPDIRECT3DVIEWPORT d3dviewport_create(IDirect3DImpl* d3d1);
extern LPDIRECT3DVIEWPORT2 d3dviewport2_create(IDirect3D2Impl* d3d2);
extern int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDeviceImpl** device);
extern int d3d_OpenGL_dx3(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int d3d_OpenGL(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) ;
extern int is_OpenGL(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevice2Impl** device, IDirect3D2Impl* d3d);
extern LPDIRECT3DTEXTURE2 mesa_d3dtexture2_create(IDirectDrawSurfaceImpl*);
extern LPDIRECT3DTEXTURE mesa_d3dtexture_create(IDirectDrawSurfaceImpl*);
static const GUID WINE_UNUSED IID_D3DDEVICE2_OpenGL = {
0x39a0da38,
0x7e57,
0x11d2,
{ 0x8b,0x7c,0x0e,0x4e,0xd8,0x3c,0x2b,0x3c }
};
static const GUID WINE_UNUSED IID_D3DDEVICE_OpenGL = {
0x31416d44,
0x86ae,
0x11d2,
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
};
#define _dump_colorvalue(s,v) \
TRACE(" " s " : %f %f %f %f\n", \
(v).u1.r, (v).u2.g, (v).u3.b, (v).u4.a);
/* This structure contains all the function pointers to OpenGL extensions
that are used by Wine */
@ -192,10 +171,6 @@ typedef struct {
GLsizei width, GLenum format, GLenum type, const GLvoid *table);
} Mesa_DeviceCapabilities;
extern ICOM_VTABLE(IDirect3D) mesa_d3dvt;
extern ICOM_VTABLE(IDirect3D2) mesa_d3d2vt;
extern ICOM_VTABLE(IDirect3D3) mesa_d3d3vt;
#endif /* HAVE_OPENGL */
#endif /* __GRAPHICS_WINE_MESA_PRIVATE_H */

View File

@ -281,7 +281,7 @@ ICOM_DEFINE(IDirect3D3,IUnknown)
#define IDirect3D3_CreateDevice(p,a,b,c,d) ICOM_CALL4(CreateDevice,p,a,b,c,d)
#define IDirect3D3_CreateVertexBuffer(p,a,b,c,d) ICOM_CALL4(CreateVertexBuffer,p,a,b,c,d)
#define IDirect3D3_EnumZBufferFormats(p,a,b,c) ICOM_CALL3(EnumZBufferFormats,p,a,b,c)
#define IDirect3D3_EvictManagedTextures(p) ICOM_CALL0(EvictManagedTextures,p)
#define IDirect3D3_EvictManagedTextures(p) ICOM_CALL (EvictManagedTextures,p)
/*****************************************************************************
* IDirect3D7 interface
@ -306,9 +306,9 @@ ICOM_DEFINE(IDirect3D7,IUnknown)
/*** IDirect3D3 methods ***/
#define IDirect3D7_EnumDevices(p,a,b) ICOM_CALL2(EnumDevices,p,a,b)
#define IDirect3D7_CreateDevice(p,a,b,c) ICOM_CALL3(CreateDevice,p,a,b,c)
#define IDirect3D7_CreateVertexBuffer(p,a,b,c) ICOM_CALL4(CreateVertexBuffer,p,a,b,c)
#define IDirect3D7_CreateVertexBuffer(p,a,b,c) ICOM_CALL3(CreateVertexBuffer,p,a,b,c)
#define IDirect3D7_EnumZBufferFormats(p,a,b,c) ICOM_CALL3(EnumZBufferFormats,p,a,b,c)
#define IDirect3D7_EvictManagedTextures(p) ICOM_CALL0(EvictManagedTextures,p)
#define IDirect3D7_EvictManagedTextures(p) ICOM_CALL (EvictManagedTextures,p)
/*****************************************************************************
@ -396,7 +396,7 @@ ICOM_DEFINE(IDirect3DMaterial2,IUnknown)
#define IDirect3DMaterial3_METHODS \
ICOM_METHOD1(HRESULT,SetMaterial, LPD3DMATERIAL,lpMat) \
ICOM_METHOD1(HRESULT,GetMaterial, LPD3DMATERIAL,lpMat) \
ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE3,lpDirect3DDevice2, LPD3DMATERIALHANDLE,lpHandle)
ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE3,lpDirect3DDevice3, LPD3DMATERIALHANDLE,lpHandle)
#define IDirect3DMaterial3_IMETHODS \
IUnknown_IMETHODS \
IDirect3DMaterial3_METHODS
@ -418,8 +418,8 @@ ICOM_DEFINE(IDirect3DMaterial3,IUnknown)
*/
#define ICOM_INTERFACE IDirect3DTexture
#define IDirect3DTexture_METHODS \
ICOM_METHOD2(HRESULT,Initialize, LPDIRECT3DDEVICE,lpDirect3DDevice, LPDIRECTDRAWSURFACE,) \
ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE,lpDirect3DDevice, LPD3DTEXTUREHANDLE,) \
ICOM_METHOD2(HRESULT,Initialize, LPDIRECT3DDEVICE,lpDirect3DDevice, LPDIRECTDRAWSURFACE,lpDDSurface) \
ICOM_METHOD2(HRESULT,GetHandle, LPDIRECT3DDEVICE,lpDirect3DDevice, LPD3DTEXTUREHANDLE, lpHandle) \
ICOM_METHOD2(HRESULT,PaletteChanged, DWORD,dwStart, DWORD,dwCount) \
ICOM_METHOD1(HRESULT,Load, LPDIRECT3DTEXTURE,lpD3DTexture) \
ICOM_METHOD (HRESULT,Unload)
@ -476,7 +476,7 @@ ICOM_DEFINE(IDirect3DTexture2,IUnknown)
ICOM_METHOD4(HRESULT,TransformVertices, DWORD,dwVertexCount, LPD3DTRANSFORMDATA,lpData, DWORD,dwFlags, LPDWORD,lpOffScreen) \
ICOM_METHOD2(HRESULT,LightElements, DWORD,dwElementCount, LPD3DLIGHTDATA,lpData) \
ICOM_METHOD1(HRESULT,SetBackground, D3DMATERIALHANDLE,hMat) \
ICOM_METHOD2(HRESULT,GetBackground, LPD3DMATERIALHANDLE,, LPBOOL,) \
ICOM_METHOD2(HRESULT,GetBackground, LPD3DMATERIALHANDLE,lphMat, LPBOOL,lpValid) \
ICOM_METHOD1(HRESULT,SetBackgroundDepth, LPDIRECTDRAWSURFACE,lpDDSurface) \
ICOM_METHOD2(HRESULT,GetBackgroundDepth, LPDIRECTDRAWSURFACE*,lplpDDSurface, LPBOOL,lpValid) \
ICOM_METHOD3(HRESULT,Clear, DWORD,dwCount, LPD3DRECT,lpRects, DWORD,dwFlags) \
@ -597,7 +597,7 @@ ICOM_DEFINE(IDirect3DViewport3,IDirect3DViewport2)
ICOM_METHOD1(HRESULT,SetExecuteData, LPD3DEXECUTEDATA,lpData) \
ICOM_METHOD1(HRESULT,GetExecuteData, LPD3DEXECUTEDATA,lpData) \
ICOM_METHOD4(HRESULT,Validate, LPDWORD,lpdwOffset, LPD3DVALIDATECALLBACK,lpFunc, LPVOID,lpUserArg, DWORD,dwReserved) \
ICOM_METHOD1(HRESULT,Optimize, DWORD,)
ICOM_METHOD1(HRESULT,Optimize, DWORD,dwDummy)
#define IDirect3DExecuteBuffer_IMETHODS \
IUnknown_IMETHODS \
IDirect3DExecuteBuffer_METHODS
@ -694,7 +694,7 @@ ICOM_DEFINE(IDirect3DDevice,IUnknown)
ICOM_METHOD1(HRESULT,GetCurrentViewport, LPDIRECT3DVIEWPORT2*,lplpDirect3DViewport2) \
ICOM_METHOD2(HRESULT,SetRenderTarget, LPDIRECTDRAWSURFACE,lpNewRenderTarget, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,GetRenderTarget, LPDIRECTDRAWSURFACE*,lplpRenderTarget) \
ICOM_METHOD3(HRESULT,Begin, D3DPRIMITIVETYPE,, D3DVERTEXTYPE,, DWORD,) \
ICOM_METHOD3(HRESULT,Begin, D3DPRIMITIVETYPE,d3dpt,D3DVERTEXTYPE,dwVertexTypeDesc,DWORD,dwFlags) \
ICOM_METHOD5(HRESULT,BeginIndexed, D3DPRIMITIVETYPE,d3dptPrimitiveType, D3DVERTEXTYPE,d3dvtVertexType, LPVOID,lpvVertices, DWORD,dwNumVertices, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,Vertex, LPVOID,lpVertexType) \
ICOM_METHOD1(HRESULT,Index, WORD,wVertexIndex) \
@ -769,8 +769,8 @@ ICOM_DEFINE(IDirect3DDevice2,IUnknown)
/*** DrawPrimitive API ***/ \
ICOM_METHOD1(HRESULT,SetCurrentViewport, LPDIRECT3DVIEWPORT3,lpDirect3DViewport3) \
ICOM_METHOD1(HRESULT,GetCurrentViewport, LPDIRECT3DVIEWPORT3*,lplpDirect3DViewport3) \
ICOM_METHOD2(HRESULT,SetRenderTarget, LPDIRECTDRAWSURFACE,lpNewRenderTarget, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,GetRenderTarget, LPDIRECTDRAWSURFACE*,lplpRenderTarget) \
ICOM_METHOD2(HRESULT,SetRenderTarget, LPDIRECTDRAWSURFACE4,lpNewRenderTarget, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,GetRenderTarget, LPDIRECTDRAWSURFACE4*,lplpRenderTarget) \
ICOM_METHOD3(HRESULT,Begin, D3DPRIMITIVETYPE,d3dptPrimitiveType,DWORD,dwVertexTypeDesc, DWORD,dwFlags) \
ICOM_METHOD5(HRESULT,BeginIndexed, D3DPRIMITIVETYPE,d3dptPrimitiveType,DWORD,d3dvtVertexType, LPVOID,lpvVertices, DWORD,dwNumVertices, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,Vertex, LPVOID,lpVertexType) \
@ -864,7 +864,7 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown)
ICOM_METHOD2(HRESULT,SetTransform, D3DTRANSFORMSTATETYPE,dtstTransformStateType, LPD3DMATRIX,lpD3DMatrix) \
ICOM_METHOD2(HRESULT,GetTransform, D3DTRANSFORMSTATETYPE,dtstTransformStateType, LPD3DMATRIX,lpD3DMatrix) \
ICOM_METHOD1(HRESULT,SetViewport, LPD3DVIEWPORT7,lpData) \
ICOM_METHOD2(HRESULT,MultiplyTransform, D3DTRANSFORMSTATETYPE,,LPD3DMATRIX,) \
ICOM_METHOD2(HRESULT,MultiplyTransform, D3DTRANSFORMSTATETYPE,dtstTransformStateType,LPD3DMATRIX,lpD3DMatrix) \
ICOM_METHOD1(HRESULT,GetViewport, LPD3DVIEWPORT7,lpData) \
ICOM_METHOD1(HRESULT,SetMaterial, LPD3DMATERIAL7,lpMat) \
ICOM_METHOD1(HRESULT,GetMaterial, LPD3DMATERIAL7,lpMat) \
@ -873,8 +873,8 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown)
ICOM_METHOD2(HRESULT,SetRenderState, D3DRENDERSTATETYPE,dwRenderStateType, DWORD,dwRenderState) \
ICOM_METHOD2(HRESULT,GetRenderState, D3DRENDERSTATETYPE,dwRenderStateType, LPDWORD,lpdwRenderState) \
ICOM_METHOD (HRESULT,BeginStateBlock) \
ICOM_METHOD1(HRESULT,EndStateBlock, LPDWORD,) \
ICOM_METHOD1(HRESULT,PreLoad, LPDIRECTDRAWSURFACE7,) \
ICOM_METHOD1(HRESULT,EndStateBlock, LPDWORD,lpdwBlockHandle) \
ICOM_METHOD1(HRESULT,PreLoad, LPDIRECTDRAWSURFACE7,lpddsTexture) \
ICOM_METHOD5(HRESULT,DrawPrimitive, D3DPRIMITIVETYPE,d3dptPrimitiveType, DWORD,d3dvtVertexType, LPVOID,lpvVertices, DWORD,dwVertexCount, DWORD,dwFlags) \
ICOM_METHOD7(HRESULT,DrawIndexedPrimitive, D3DPRIMITIVETYPE,d3dptPrimitiveType, DWORD,d3dvtVertexType, LPVOID,lpvVertices, DWORD,dwVertexCount, LPWORD,dwIndices, DWORD,dwIndexCount, DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,SetClipStatus, LPD3DCLIPSTATUS,lpD3DClipStatus) \
@ -882,23 +882,23 @@ ICOM_DEFINE(IDirect3DDevice3,IUnknown)
ICOM_METHOD5(HRESULT,DrawPrimitiveStrided, D3DPRIMITIVETYPE,d3dptPrimitiveType,DWORD,dwVertexType,LPD3DDRAWPRIMITIVESTRIDEDDATA,lpD3DDrawPrimStrideData,DWORD,dwVertexCount,DWORD,dwFlags) \
ICOM_METHOD7(HRESULT,DrawIndexedPrimitiveStrided, D3DPRIMITIVETYPE,d3dptPrimitiveType,DWORD,dwVertexType,LPD3DDRAWPRIMITIVESTRIDEDDATA,lpD3DDrawPrimStrideData,DWORD,dwVertexCount,LPWORD,lpIndex,DWORD,dwIndexCount,DWORD,dwFlags) \
ICOM_METHOD5(HRESULT,DrawPrimitiveVB, D3DPRIMITIVETYPE,d3dptPrimitiveType,LPDIRECT3DVERTEXBUFFER7,lpD3DVertexBuf,DWORD,dwStartVertex,DWORD,dwNumVertices,DWORD,dwFlags) \
ICOM_METHOD7(HRESULT,DrawIndexedPrimitiveVB, D3DPRIMITIVETYPE,d3dptPrimitiveType,LPDIRECT3DVERTEXBUFFER7,lpD3DVertexBuf,DWORD,,DWORD,,LPWORD,lpwIndices,DWORD,dwIndexCount,DWORD,dwFlags) \
ICOM_METHOD7(HRESULT,DrawIndexedPrimitiveVB, D3DPRIMITIVETYPE,d3dptPrimitiveType,LPDIRECT3DVERTEXBUFFER7,lpD3DVertexBuf,DWORD,dwStartVertex,DWORD,dwNumVertices,LPWORD,lpwIndices,DWORD,dwIndexCount,DWORD,dwFlags) \
ICOM_METHOD5(HRESULT,ComputeSphereVisibility, LPD3DVECTOR,lpCenters,LPD3DVALUE,lpRadii,DWORD,dwNumSpheres,DWORD,dwFlags,LPDWORD,lpdwReturnValues) \
ICOM_METHOD2(HRESULT,GetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7*,lpTexture) \
ICOM_METHOD2(HRESULT,SetTexture, DWORD,dwStage,LPDIRECTDRAWSURFACE7,lpTexture) \
ICOM_METHOD3(HRESULT,GetTextureStageState, DWORD,dwStage,D3DTEXTURESTAGESTATETYPE,d3dTexStageStateType,LPDWORD,lpdwState) \
ICOM_METHOD3(HRESULT,SetTextureStageState, DWORD,dwStage,D3DTEXTURESTAGESTATETYPE,d3dTexStageStateType,DWORD,dwState) \
ICOM_METHOD1(HRESULT,ValidateDevice, LPDWORD,lpdwPasses) \
ICOM_METHOD1(HRESULT,ApplyStateBlock, DWORD,) \
ICOM_METHOD1(HRESULT,CaptureStateBlock, DWORD,) \
ICOM_METHOD1(HRESULT,DeleteStateBlock, DWORD,) \
ICOM_METHOD2(HRESULT,CreateStateBlock, D3DSTATEBLOCKTYPE,,LPDWORD,) \
ICOM_METHOD5(HRESULT,Load, LPDIRECTDRAWSURFACE7,,LPPOINT,,LPDIRECTDRAWSURFACE7,,LPRECT,,DWORD,) \
ICOM_METHOD1(HRESULT,ApplyStateBlock, DWORD,dwBlockHandle) \
ICOM_METHOD1(HRESULT,CaptureStateBlock, DWORD,dwBlockHandle) \
ICOM_METHOD1(HRESULT,DeleteStateBlock, DWORD,dwBlockHandle) \
ICOM_METHOD2(HRESULT,CreateStateBlock, D3DSTATEBLOCKTYPE,d3dsbType,LPDWORD,lpdwBlockHandle) \
ICOM_METHOD5(HRESULT,Load, LPDIRECTDRAWSURFACE7,lpDestTex,LPPOINT,lpDestPoint,LPDIRECTDRAWSURFACE7,lpSrcTex,LPRECT,lprcSrcRect,DWORD,dwFlags) \
ICOM_METHOD2(HRESULT,LightEnable, DWORD,dwLightIndex,BOOL,bEnable) \
ICOM_METHOD2(HRESULT,GetLightEnable, DWORD,,BOOL*,) \
ICOM_METHOD2(HRESULT,SetClipPlane, DWORD,,D3DVALUE*,) \
ICOM_METHOD2(HRESULT,GetClipPlane, DWORD,,D3DVALUE*,) \
ICOM_METHOD3(HRESULT,GetInfo, DWORD,,LPVOID,,DWORD, )
ICOM_METHOD2(HRESULT,GetLightEnable, DWORD,dwLightIndex,BOOL*,pbEnable) \
ICOM_METHOD2(HRESULT,SetClipPlane, DWORD,dwIndex,D3DVALUE*,pPlaneEquation) \
ICOM_METHOD2(HRESULT,GetClipPlane, DWORD,dwIndex,D3DVALUE*,pPlaneEquation) \
ICOM_METHOD3(HRESULT,GetInfo, DWORD,dwDevInfoID,LPVOID,pDevInfoStruct,DWORD,dwSize)
#define IDirect3DDevice7_IMETHODS \
IUnknown_IMETHODS \
IDirect3DDevice7_METHODS
@ -994,7 +994,7 @@ ICOM_DEFINE(IDirect3DVertexBuffer,IUnknown)
ICOM_METHOD7(HRESULT,ProcessVertices, DWORD,dwVertexOp,DWORD,dwDestIndex,DWORD,dwCount,LPDIRECT3DVERTEXBUFFER7,lpSrcBuffer,DWORD,dwSrcIndex,LPDIRECT3DDEVICE7,lpD3DDevice,DWORD,dwFlags) \
ICOM_METHOD1(HRESULT,GetVertexBufferDesc, LPD3DVERTEXBUFFERDESC,lpD3DVertexBufferDesc) \
ICOM_METHOD2(HRESULT,Optimize, LPDIRECT3DDEVICE7, lpD3DDevice,DWORD,dwFlags) \
ICOM_METHOD7(HRESULT,ProcessVerticesStrided, DWORD,,DWORD,,DWORD,,LPD3DDRAWPRIMITIVESTRIDEDDATA,,DWORD,,LPDIRECT3DDEVICE7,,DWORD,)
ICOM_METHOD7(HRESULT,ProcessVerticesStrided, DWORD,dwVertexOp,DWORD,dwDestIndex,DWORD,dwCount,LPD3DDRAWPRIMITIVESTRIDEDDATA,lpStrideData,DWORD,dwVertexTypeDesc,LPDIRECT3DDEVICE7,lpD3DDevice,DWORD,dwFlags)
#define IDirect3DVertexBuffer7_IMETHODS \
IUnknown_IMETHODS \
IDirect3DVertexBuffer7_METHODS