- proper (tested on Win2K) reference counting for Direct3D object

- fix one case of reference counting on textures
- fix stupid bug in texture upload code
- yet another texture enumeration reordering
This commit is contained in:
Lionel Ulmer 2003-06-04 23:31:39 +00:00 committed by Alexandre Julliard
parent f683839c13
commit 4aba282bb8
18 changed files with 211 additions and 294 deletions

View File

@ -35,12 +35,10 @@
/***************************************************************************** /*****************************************************************************
* Predeclare the interface implementation structures * Predeclare the interface implementation structures
*/ */
typedef struct IDirect3DImpl IDirect3DImpl;
typedef struct IDirect3DLightImpl IDirect3DLightImpl; typedef struct IDirect3DLightImpl IDirect3DLightImpl;
typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl; typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl;
typedef struct IDirect3DViewportImpl IDirect3DViewportImpl; typedef struct IDirect3DViewportImpl IDirect3DViewportImpl;
typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl; typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl;
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl; typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl;
#include "ddraw_private.h" #include "ddraw_private.h"
@ -56,30 +54,6 @@ typedef struct STATEBLOCK {
DWORD texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE]; DWORD texture_stage_state[MAX_TEXTURES][HIGHEST_TEXTURE_STAGE_STATE];
} STATEBLOCK; } STATEBLOCK;
/*****************************************************************************
* IDirect3D implementation structure.
* This is common for interfaces 1, 2, 3 and 7.
*/
struct IDirect3DImpl
{
ICOM_VFIELD_MULTI(IDirect3D7);
ICOM_VFIELD_MULTI(IDirect3D3);
ICOM_VFIELD_MULTI(IDirect3D2);
ICOM_VFIELD_MULTI(IDirect3D);
DWORD ref;
/* IDirect3D fields */
IDirectDrawImpl* ddraw;
/* Used as a callback function to create a texture */
HRESULT (*create_texture)(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main);
/* Used as a callback for Devices to tell to the D3D object it's been created */
HRESULT (*added_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
HRESULT (*removed_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
/* This is needed for delayed texture creation and Z buffer blits */
IDirect3DDeviceImpl *current_device;
};
/***************************************************************************** /*****************************************************************************
* IDirect3DLight implementation structure * IDirect3DLight implementation structure
@ -89,7 +63,7 @@ struct IDirect3DLightImpl
ICOM_VFIELD_MULTI(IDirect3DLight); ICOM_VFIELD_MULTI(IDirect3DLight);
DWORD ref; DWORD ref;
/* IDirect3DLight fields */ /* IDirect3DLight fields */
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
/* If this light is active for one viewport, put the viewport here */ /* If this light is active for one viewport, put the viewport here */
IDirect3DViewportImpl *active_viewport; IDirect3DViewportImpl *active_viewport;
@ -117,7 +91,7 @@ struct IDirect3DMaterialImpl
ICOM_VFIELD_MULTI(IDirect3DMaterial); ICOM_VFIELD_MULTI(IDirect3DMaterial);
DWORD ref; DWORD ref;
/* IDirect3DMaterial2 fields */ /* IDirect3DMaterial2 fields */
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
IDirect3DDeviceImpl *active_device; IDirect3DDeviceImpl *active_device;
D3DMATERIAL mat; D3DMATERIAL mat;
@ -133,7 +107,7 @@ struct IDirect3DViewportImpl
ICOM_VFIELD_MULTI(IDirect3DViewport3); ICOM_VFIELD_MULTI(IDirect3DViewport3);
DWORD ref; DWORD ref;
/* IDirect3DViewport fields */ /* IDirect3DViewport fields */
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
/* If this viewport is active for one device, put the device here */ /* If this viewport is active for one device, put the device here */
IDirect3DDeviceImpl *active_device; IDirect3DDeviceImpl *active_device;
@ -167,7 +141,7 @@ struct IDirect3DExecuteBufferImpl
ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer); ICOM_VFIELD_MULTI(IDirect3DExecuteBuffer);
DWORD ref; DWORD ref;
/* IDirect3DExecuteBuffer fields */ /* IDirect3DExecuteBuffer fields */
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
IDirect3DDeviceImpl* d3ddev; IDirect3DDeviceImpl* d3ddev;
D3DEXECUTEBUFFERDESC desc; D3DEXECUTEBUFFERDESC desc;
@ -217,7 +191,7 @@ struct IDirect3DDeviceImpl
ICOM_VFIELD_MULTI(IDirect3DDevice); ICOM_VFIELD_MULTI(IDirect3DDevice);
DWORD ref; DWORD ref;
/* IDirect3DDevice fields */ /* IDirect3DDevice fields */
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
IDirectDrawSurfaceImpl *surface; IDirectDrawSurfaceImpl *surface;
IDirect3DViewportImpl *viewport_list; IDirect3DViewportImpl *viewport_list;
@ -270,7 +244,7 @@ struct IDirect3DVertexBufferImpl
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7); ICOM_VFIELD_MULTI(IDirect3DVertexBuffer7);
ICOM_VFIELD_MULTI(IDirect3DVertexBuffer); ICOM_VFIELD_MULTI(IDirect3DVertexBuffer);
DWORD ref; DWORD ref;
IDirect3DImpl *d3d; IDirectDrawImpl *d3d;
D3DVERTEXBUFFERDESC desc; D3DVERTEXBUFFERDESC desc;
LPVOID *vertices; LPVOID *vertices;
DWORD vertex_buffer_size; DWORD vertex_buffer_size;

View File

@ -318,15 +318,15 @@ Main_IDirect3DDeviceImpl_7_3T_2T_1T_EndScene(LPDIRECT3DDEVICE7 iface)
HRESULT WINAPI HRESULT WINAPI
Main_IDirect3DDeviceImpl_7_3T_2T_1T_GetDirect3D(LPDIRECT3DDEVICE7 iface, Main_IDirect3DDeviceImpl_7_3T_2T_1T_GetDirect3D(LPDIRECT3DDEVICE7 iface,
LPDIRECT3D7* lplpDirect3D3) LPDIRECT3D7* lplpDirect3D7)
{ {
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3D3); TRACE("(%p/%p)->(%p)\n", This, iface, lplpDirect3D7);
*lplpDirect3D3 = ICOM_INTERFACE(This->d3d, IDirect3D7); *lplpDirect3D7 = ICOM_INTERFACE(This->d3d, IDirect3D7);
IDirect3D7_AddRef(ICOM_INTERFACE(This->d3d, IDirect3D7)); IDirect3D7_AddRef(ICOM_INTERFACE(This->d3d, IDirect3D7));
TRACE(" returning interface %p\n", *lplpDirect3D3); TRACE(" returning interface %p\n", *lplpDirect3D7);
return DD_OK; return DD_OK;
} }
@ -812,14 +812,13 @@ Main_IDirect3DDeviceImpl_7_3T_GetTexture(LPDIRECT3DDEVICE7 iface,
if (This->current_texture[dwStage] != NULL) { if (This->current_texture[dwStage] != NULL) {
*lpTexture = ICOM_INTERFACE(This->current_texture[dwStage], IDirectDrawSurface7); *lpTexture = ICOM_INTERFACE(This->current_texture[dwStage], IDirectDrawSurface7);
IDirectDrawSurface7_AddRef(*lpTexture);
} else { } else {
*lpTexture = NULL; *lpTexture = NULL;
} }
TRACE(" returning interface at %p (for implementation at %p).\n", *lpTexture, This->current_texture[dwStage]); TRACE(" returning interface at %p (for implementation at %p).\n", *lpTexture, This->current_texture[dwStage]);
/* Note: should this method increase the reference count for this ?? */
return DD_OK; return DD_OK;
} }
@ -1559,7 +1558,7 @@ Thunk_IDirect3DDeviceImpl_3_GetDirect3D(LPDIRECT3DDEVICE3 iface,
TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D3); TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D3);
ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface), ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice3, IDirect3DDevice7, iface),
&ret_ptr); &ret_ptr);
*lplpDirect3D3 = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D3, ret_ptr); *lplpDirect3D3 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D3, ret_ptr);
TRACE(" returning interface %p\n", *lplpDirect3D3); TRACE(" returning interface %p\n", *lplpDirect3D3);
return ret; return ret;
} }
@ -1574,7 +1573,7 @@ Thunk_IDirect3DDeviceImpl_2_GetDirect3D(LPDIRECT3DDEVICE2 iface,
TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D2); TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D2);
ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface), ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice2, IDirect3DDevice7, iface),
&ret_ptr); &ret_ptr);
*lplpDirect3D2 = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D2, ret_ptr); *lplpDirect3D2 = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D2, ret_ptr);
TRACE(" returning interface %p\n", *lplpDirect3D2); TRACE(" returning interface %p\n", *lplpDirect3D2);
return ret; return ret;
} }
@ -1589,7 +1588,7 @@ Thunk_IDirect3DDeviceImpl_1_GetDirect3D(LPDIRECT3DDEVICE iface,
TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D); TRACE("(%p)->(%p) thunking to IDirect3DDevice7 interface.\n", iface, lplpDirect3D);
ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface), ret = IDirect3DDevice7_GetDirect3D(COM_INTERFACE_CAST(IDirect3DDeviceImpl, IDirect3DDevice, IDirect3DDevice7, iface),
&ret_ptr); &ret_ptr);
*lplpDirect3D = COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D7, IDirect3D, ret_ptr); *lplpDirect3D = COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirect3D, ret_ptr);
TRACE(" returning interface %p\n", *lplpDirect3D); TRACE(" returning interface %p\n", *lplpDirect3D);
return ret; return ret;
} }

View File

@ -351,7 +351,7 @@ GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface)
} }
/* And warn the D3D object that this device is no longer active... */ /* And warn the D3D object that this device is no longer active... */
This->d3d->removed_device(This->d3d, This); This->d3d->d3d_removed_device(This->d3d, This);
HeapFree(GetProcessHeap(), 0, This->world_mat); HeapFree(GetProcessHeap(), 0, This->world_mat);
HeapFree(GetProcessHeap(), 0, This->view_mat); HeapFree(GetProcessHeap(), 0, This->view_mat);
@ -415,19 +415,6 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
pformat->dwSize = sizeof(DDPIXELFORMAT); pformat->dwSize = sizeof(DDPIXELFORMAT);
pformat->dwFourCC = 0; pformat->dwFourCC = 0;
#if 0
/* See argument about the RGBA format for 'packed' texture formats */
TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32;
pformat->u2.dwRBitMask = 0xFF000000;
pformat->u3.dwGBitMask = 0x00FF0000;
pformat->u4.dwBBitMask = 0x0000FF00;
pformat->u5.dwRGBAlphaBitMask = 0x000000FF;
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
#endif
TRACE("Enumerating GL_RGBA unpacked (32)\n"); TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32; pformat->u1.dwRGBBitCount = 32;
@ -438,7 +425,6 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK; if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK; if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
#if 0 /* Enabling this breaks Tomb Raider 3, need to investigate... */
TRACE("Enumerating GL_RGB unpacked (32)\n"); TRACE("Enumerating GL_RGB unpacked (32)\n");
pformat->dwFlags = DDPF_RGB; pformat->dwFlags = DDPF_RGB;
pformat->u1.dwRGBBitCount = 32; pformat->u1.dwRGBBitCount = 32;
@ -448,7 +434,6 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
pformat->u5.dwRGBAlphaBitMask = 0x00000000; pformat->u5.dwRGBAlphaBitMask = 0x00000000;
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK; if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK; if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
#endif
TRACE("Enumerating GL_RGB unpacked (24)\n"); TRACE("Enumerating GL_RGB unpacked (24)\n");
pformat->dwFlags = DDPF_RGB; pformat->dwFlags = DDPF_RGB;
@ -508,6 +493,17 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
So basically, forget our OpenGL roots and do not even enumerate our RGBA ones. So basically, forget our OpenGL roots and do not even enumerate our RGBA ones.
*/ */
/* See argument about the RGBA format for 'packed' texture formats */
TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32;
pformat->u2.dwRBitMask = 0xFF000000;
pformat->u3.dwGBitMask = 0x00FF0000;
pformat->u4.dwBBitMask = 0x0000FF00;
pformat->u5.dwRGBAlphaBitMask = 0x000000FF;
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
TRACE("Enumerating GL_RGBA packed GL_UNSIGNED_SHORT_4_4_4_4 (16)\n"); TRACE("Enumerating GL_RGBA packed GL_UNSIGNED_SHORT_4_4_4_4 (16)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS; pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 16; pformat->u1.dwRGBBitCount = 16;
@ -555,7 +551,7 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
HRESULT HRESULT
d3ddevice_find(IDirect3DImpl *d3d, d3ddevice_find(IDirectDrawImpl *d3d,
LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice) LPD3DFINDDEVICERESULT lplpD3DDevice)
{ {
@ -3079,7 +3075,7 @@ apply_texture_state(IDirect3DDeviceImpl *This)
} }
HRESULT HRESULT
d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface) d3ddevice_create(IDirect3DDeviceImpl **obj, IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surface)
{ {
IDirect3DDeviceImpl *object; IDirect3DDeviceImpl *object;
IDirect3DDeviceGLImpl *gl_object; IDirect3DDeviceGLImpl *gl_object;
@ -3240,7 +3236,7 @@ d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfa
TRACE(" creating implementation at %p.\n", *obj); TRACE(" creating implementation at %p.\n", *obj);
/* And finally warn D3D that this device is now present */ /* And finally warn D3D that this device is now present */
object->d3d->added_device(object->d3d, object); object->d3d->d3d_added_device(object->d3d, object);
/* FIXME: Should handle other versions than just 7 */ /* FIXME: Should handle other versions than just 7 */
InitDefaultStateBlock(&object->state_block, 7); InitDefaultStateBlock(&object->state_block, 7);

View File

@ -661,7 +661,7 @@ ICOM_VTABLE(IDirect3DExecuteBuffer) VTABLE_IDirect3DExecuteBuffer =
#endif #endif
HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc) HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirectDrawImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc)
{ {
IDirect3DExecuteBufferImpl* object; IDirect3DExecuteBufferImpl* object;

View File

@ -214,7 +214,7 @@ ICOM_VTABLE(IDirect3DLight) VTABLE_IDirect3DLight =
HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num) HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirectDrawImpl *d3d, GLenum light_num)
{ {
IDirect3DLightImpl *object; IDirect3DLightImpl *object;
IDirect3DLightGLImpl *gl_object; IDirect3DLightGLImpl *gl_object;

View File

@ -388,7 +388,7 @@ ICOM_VTABLE(IDirect3DMaterial) VTABLE_IDirect3DMaterial =
HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d) HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirectDrawImpl *d3d)
{ {
IDirect3DMaterialImpl *object; IDirect3DMaterialImpl *object;

View File

@ -650,7 +650,7 @@ ICOM_VTABLE(IDirect3DTexture) VTABLE_IDirect3DTexture =
#undef XCAST #undef XCAST
#endif #endif
HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, HRESULT d3dtexture_create(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation,
IDirectDrawSurfaceImpl *main) IDirectDrawSurfaceImpl *main)
{ {
/* First, initialize the texture vtables... */ /* First, initialize the texture vtables... */

View File

@ -507,7 +507,7 @@ ICOM_VTABLE(IDirect3DVertexBuffer) VTABLE_IDirect3DVertexBuffer =
#undef XCAST #undef XCAST
#endif #endif
HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags) HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirectDrawImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags)
{ {
IDirect3DVertexBufferImpl *object; IDirect3DVertexBufferImpl *object;
static const flag_info flags[] = { static const flag_info flags[] = {

View File

@ -479,7 +479,7 @@ ICOM_VTABLE(IDirect3DViewport3) VTABLE_IDirect3DViewport3 =
HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d) HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirectDrawImpl *d3d)
{ {
IDirect3DViewportImpl *object; IDirect3DViewportImpl *object;

View File

@ -185,28 +185,24 @@ HRESULT WINAPI Main_DirectDraw_QueryInterface(
IsEqualGUID( &IID_IDirect3D7 , refiid ) ) IsEqualGUID( &IID_IDirect3D7 , refiid ) )
{ {
if (opengl_initialized) { if (opengl_initialized) {
IDirect3DImpl *d3d_impl;
HRESULT ret_value; HRESULT ret_value;
ret_value = direct3d_create(&d3d_impl, This); ret_value = direct3d_create(This);
if (FAILED(ret_value)) return ret_value; if (FAILED(ret_value)) return ret_value;
if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) { if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) {
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D); *obj = ICOM_INTERFACE(This, IDirect3D);
TRACE(" returning Direct3D interface at %p.\n", *obj); TRACE(" returning Direct3D interface at %p.\n", *obj);
} else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) { } else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) {
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D2); *obj = ICOM_INTERFACE(This, IDirect3D2);
TRACE(" returning Direct3D2 interface at %p.\n", *obj); TRACE(" returning Direct3D2 interface at %p.\n", *obj);
} else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) { } else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) {
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D3); *obj = ICOM_INTERFACE(This, IDirect3D3);
TRACE(" returning Direct3D3 interface at %p.\n", *obj); TRACE(" returning Direct3D3 interface at %p.\n", *obj);
} else { } else {
*obj = ICOM_INTERFACE(d3d_impl, IDirect3D7); *obj = ICOM_INTERFACE(This, IDirect3D7);
TRACE(" returning Direct3D7 interface at %p.\n", *obj); TRACE(" returning Direct3D7 interface at %p.\n", *obj);
} }
/* And store the D3D object */
This->d3d = d3d_impl;
} else { } else {
ERR("Application requests a Direct3D interface but dynamic OpenGL support loading failed !\n"); ERR("Application requests a Direct3D interface but dynamic OpenGL support loading failed !\n");
ERR("(%p)->(%s,%p): no interface\n",This,debugstr_guid(refiid),obj); ERR("(%p)->(%s,%p): no interface\n",This,debugstr_guid(refiid),obj);
@ -384,8 +380,8 @@ create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD,
hr = This->create_texture(This, &ddsd, ppSurf, pUnkOuter, mipmap_level); hr = This->create_texture(This, &ddsd, ppSurf, pUnkOuter, mipmap_level);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
if (This->d3d) This->d3d->create_texture(This->d3d, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf), TRUE, if (This->d3d_private) This->d3d_create_texture(This, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf), TRUE,
ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf)); ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf));
/* Create attached mipmaps if required. */ /* Create attached mipmaps if required. */
if (more_mipmaps(&ddsd)) if (more_mipmaps(&ddsd))
@ -430,8 +426,8 @@ create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD,
mipmap_impl->mip_main = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf); mipmap_impl->mip_main = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf);
mipmap_impl->mipmap_level = mipmap_level; mipmap_impl->mipmap_level = mipmap_level;
if (This->d3d) This->d3d->create_texture(This->d3d, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, mipmap), TRUE, if (This->d3d_private) This->d3d_create_texture(This, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, mipmap), TRUE,
ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf)); ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf));
IDirectDrawSurface7_AddAttachedSurface(prev_mipmap, mipmap); IDirectDrawSurface7_AddAttachedSurface(prev_mipmap, mipmap);
IDirectDrawSurface7_Release(prev_mipmap); IDirectDrawSurface7_Release(prev_mipmap);

View File

@ -58,6 +58,7 @@ typedef struct IDirectDrawImpl IDirectDrawImpl;
typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl; typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl;
typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl; typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl;
typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl; typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
typedef void (*pixel_convert_func)(void *src, void *dst, DWORD width, typedef void (*pixel_convert_func)(void *src, void *dst, DWORD width,
DWORD height, LONG pitch, DWORD height, LONG pitch,
@ -73,6 +74,10 @@ struct IDirectDrawImpl
ICOM_VFIELD_MULTI(IDirectDraw4); ICOM_VFIELD_MULTI(IDirectDraw4);
ICOM_VFIELD_MULTI(IDirectDraw2); ICOM_VFIELD_MULTI(IDirectDraw2);
ICOM_VFIELD_MULTI(IDirectDraw); ICOM_VFIELD_MULTI(IDirectDraw);
ICOM_VFIELD_MULTI(IDirect3D7);
ICOM_VFIELD_MULTI(IDirect3D3);
ICOM_VFIELD_MULTI(IDirect3D2);
ICOM_VFIELD_MULTI(IDirect3D);
DWORD ref; DWORD ref;
@ -159,8 +164,18 @@ struct IDirectDrawImpl
void (*free_memory)(IDirectDrawImpl *This, DWORD mem); void (*free_memory)(IDirectDrawImpl *This, DWORD mem);
DWORD total_vidmem, available_vidmem; DWORD total_vidmem, available_vidmem;
/* This is to get the D3D object associated to this DDraw object */ /* IDirect3D fields */
struct IDirect3DImpl *d3d; LPVOID d3d_private;
/* Used as a callback function to create a texture */
HRESULT (*d3d_create_texture)(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main);
/* Used as a callback for Devices to tell to the D3D object it's been created */
HRESULT (*d3d_added_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device);
HRESULT (*d3d_removed_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device);
/* This is needed for delayed texture creation and Z buffer blits */
IDirect3DDeviceImpl *current_device;
/* This is for the fake mainWindow */ /* This is for the fake mainWindow */
ATOM winclass; ATOM winclass;

View File

@ -35,96 +35,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw); WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
HRESULT WINAPI
Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp)
{
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, 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_IDirectDraw, riid ) ) ||
( IsEqualGUID (&IID_IDirectDraw2, riid ) ) ||
( IsEqualGUID (&IID_IDirectDraw4, riid ) ) ||
( IsEqualGUID( &IID_IDirectDraw7, riid ) )
) {
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, 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, riid ) ) {
IDirect3D_AddRef(ICOM_INTERFACE(This,IDirect3D));
*obp = ICOM_INTERFACE(This, IDirect3D2);
TRACE(" Creating IDirect3D2 interface %p\n", *obp);
return S_OK;
}
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
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
Main_IDirect3DImpl_7_3T_2T_1T_Release(LPDIRECT3D7 iface)
{
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 HRESULT WINAPI
Main_IDirect3DImpl_1_Initialize(LPDIRECT3D iface, Main_IDirect3DImpl_1_Initialize(LPDIRECT3D iface,
REFIID riid) REFIID riid)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%s) no-op...\n", This, iface, debugstr_guid(riid)); TRACE("(%p/%p)->(%s) no-op...\n", This, iface, debugstr_guid(riid));
return D3D_OK; return D3D_OK;
} }
@ -134,7 +50,7 @@ Main_IDirect3DImpl_3_2T_1T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg);
return D3D_OK; return D3D_OK;
} }
@ -144,7 +60,7 @@ Main_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight, LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DLight, pUnkOuter); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DLight, pUnkOuter);
return D3D_OK; return D3D_OK;
} }
@ -154,7 +70,7 @@ Main_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3, LPDIRECT3DMATERIAL3* lplpDirect3DMaterial3,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DMaterial3, pUnkOuter); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpDirect3DMaterial3, pUnkOuter);
return D3D_OK; return D3D_OK;
} }
@ -164,7 +80,7 @@ Main_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
LPDIRECT3DVIEWPORT3* lplpD3DViewport3, LPDIRECT3DVIEWPORT3* lplpD3DViewport3,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpD3DViewport3, pUnkOuter); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lplpD3DViewport3, pUnkOuter);
return D3D_OK; return D3D_OK;
} }
@ -174,7 +90,7 @@ Main_IDirect3DImpl_3_2T_1T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR) LPD3DFINDDEVICERESULT lpD3DFDR)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lpD3DFDR); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpD3DDFS, lpD3DFDR);
return D3D_OK; return D3D_OK;
} }
@ -185,7 +101,7 @@ Main_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
LPDIRECTDRAWSURFACE lpDDS, LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2) LPDIRECT3DDEVICE2* lplpD3DDevice2)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2); FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2);
return D3D_OK; return D3D_OK;
} }
@ -197,7 +113,7 @@ Main_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
LPDIRECT3DDEVICE3* lplpD3DDevice3, LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk) LPUNKNOWN lpUnk)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
FIXME("(%p/%p)->(%s,%p,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3, lpUnk); FIXME("(%p/%p)->(%s,%p,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3, lpUnk);
return D3D_OK; return D3D_OK;
} }
@ -208,7 +124,7 @@ Main_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext) LPVOID lpContext)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext); FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext);
return D3D_OK; return D3D_OK;
} }
@ -216,7 +132,7 @@ Main_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
HRESULT WINAPI HRESULT WINAPI
Main_IDirect3DImpl_7_3T_EvictManagedTextures(LPDIRECT3D7 iface) Main_IDirect3DImpl_7_3T_EvictManagedTextures(LPDIRECT3D7 iface)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(): stub!\n", This, iface); FIXME("(%p/%p)->(): stub!\n", This, iface);
return D3D_OK; return D3D_OK;
} }
@ -226,7 +142,7 @@ Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg); FIXME("(%p/%p)->(%p,%p): stub!\n", This, iface, lpEnumDevicesCallback, lpUserArg);
return D3D_OK; return D3D_OK;
} }
@ -237,7 +153,7 @@ Main_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECTDRAWSURFACE7 lpDDS,
LPDIRECT3DDEVICE7* lplpD3DDevice) LPDIRECT3DDEVICE7* lplpD3DDevice)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice); FIXME("(%p/%p)->(%s,%p,%p): stub!\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice);
return D3D_OK; return D3D_OK;
} }
@ -248,20 +164,31 @@ Main_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf,
DWORD dwFlags) DWORD dwFlags)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpD3DVertBufDesc, lplpD3DVertBuf, dwFlags); FIXME("(%p/%p)->(%p,%p,%08lx): stub!\n", This, iface, lpD3DVertBufDesc, lplpD3DVertBuf, dwFlags);
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI
Thunk_IDirect3DImpl_7_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp)
{
TRACE("(%p)->(%s,%p) thunking to IDirectDraw7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirectDraw7, iface),
riid,
obp);
}
HRESULT WINAPI HRESULT WINAPI
Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface, Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface,
REFIID riid, REFIID riid,
LPVOID* obp) LPVOID* obp)
{ {
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp); TRACE("(%p)->(%s,%p) thunking to IDirectDraw7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface), return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirectDraw7, iface),
riid, riid,
obp); obp);
} }
HRESULT WINAPI HRESULT WINAPI
@ -269,10 +196,10 @@ Thunk_IDirect3DImpl_2_QueryInterface(LPDIRECT3D2 iface,
REFIID riid, REFIID riid,
LPVOID* obp) LPVOID* obp)
{ {
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp); TRACE("(%p)->(%s,%p) thunking to IDirectDraw7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface), return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirectDraw7, iface),
riid, riid,
obp); obp);
} }
HRESULT WINAPI HRESULT WINAPI
@ -280,52 +207,66 @@ Thunk_IDirect3DImpl_1_QueryInterface(LPDIRECT3D iface,
REFIID riid, REFIID riid,
LPVOID* obp) LPVOID* obp)
{ {
TRACE("(%p)->(%s,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riid), obp); TRACE("(%p)->(%s,%p) thunking to IDirectDraw7 interface.\n", iface, debugstr_guid(riid), obp);
return IDirect3D7_QueryInterface(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface), return IDirectDraw7_QueryInterface(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirectDraw7, iface),
riid, riid,
obp); obp);
}
ULONG WINAPI
Thunk_IDirect3DImpl_7_AddRef(LPDIRECT3D7 iface)
{
TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface) Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface)); return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface) Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface)); return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface) Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_AddRef(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface)); return IDirectDraw7_AddRef(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirectDraw7, iface));
}
ULONG WINAPI
Thunk_IDirect3DImpl_7_Release(LPDIRECT3D7 iface)
{
TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D7, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface) Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface)); return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_2_Release(LPDIRECT3D2 iface) Thunk_IDirect3DImpl_2_Release(LPDIRECT3D2 iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D7, iface)); return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirectDraw7, iface));
} }
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_1_Release(LPDIRECT3D iface) Thunk_IDirect3DImpl_1_Release(LPDIRECT3D iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirectDraw7 interface.\n", iface);
return IDirect3D7_Release(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D7, iface)); return IDirectDraw7_Release(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirectDraw7, iface));
} }
HRESULT WINAPI HRESULT WINAPI
@ -335,7 +276,7 @@ Thunk_IDirect3DImpl_3_EnumZBufferFormats(LPDIRECT3D3 iface,
LPVOID lpContext) LPVOID lpContext)
{ {
TRACE("(%p)->(%s,%p,%p) thunking to IDirect3D7 interface.\n", iface, debugstr_guid(riidDevice), lpEnumCallback, 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), return IDirect3D7_EnumZBufferFormats(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirect3D7, iface),
riidDevice, riidDevice,
lpEnumCallback, lpEnumCallback,
lpContext); lpContext);
@ -345,7 +286,7 @@ HRESULT WINAPI
Thunk_IDirect3DImpl_3_EvictManagedTextures(LPDIRECT3D3 iface) Thunk_IDirect3DImpl_3_EvictManagedTextures(LPDIRECT3D3 iface)
{ {
TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface); TRACE("(%p)->() thunking to IDirect3D7 interface.\n", iface);
return IDirect3D7_EvictManagedTextures(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface)); return IDirect3D7_EvictManagedTextures(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirect3D7, iface));
} }
HRESULT WINAPI HRESULT WINAPI
@ -354,7 +295,7 @@ Thunk_IDirect3DImpl_2_EnumDevices(LPDIRECT3D2 iface,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpEnumDevicesCallback, lpUserArg); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpEnumDevicesCallback, lpUserArg);
return IDirect3D3_EnumDevices(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface), return IDirect3D3_EnumDevices(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirect3D3, iface),
lpEnumDevicesCallback, lpEnumDevicesCallback,
lpUserArg); lpUserArg);
} }
@ -365,7 +306,7 @@ Thunk_IDirect3DImpl_2_CreateLight(LPDIRECT3D2 iface,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter);
return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface), return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirect3D3, iface),
lplpDirect3DLight, lplpDirect3DLight,
pUnkOuter); pUnkOuter);
} }
@ -376,7 +317,7 @@ Thunk_IDirect3DImpl_1_CreateLight(LPDIRECT3D iface,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DLight, pUnkOuter);
return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface), return IDirect3D3_CreateLight(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirect3D3, iface),
lplpDirect3DLight, lplpDirect3DLight,
pUnkOuter); pUnkOuter);
} }
@ -390,7 +331,7 @@ Thunk_IDirect3DImpl_1_CreateMaterial(LPDIRECT3D iface,
LPDIRECT3DMATERIAL3 ret_val; LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial, pUnkOuter);
ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface), ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirect3D3, iface),
&ret_val, &ret_val,
pUnkOuter); pUnkOuter);
@ -407,7 +348,7 @@ Thunk_IDirect3DImpl_1_CreateViewport(LPDIRECT3D iface,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport, pUnkOuter);
return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface), return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirect3D3, iface),
(LPDIRECT3DVIEWPORT3 *) lplpD3DViewport /* No need to cast here */, (LPDIRECT3DVIEWPORT3 *) lplpD3DViewport /* No need to cast here */,
pUnkOuter); pUnkOuter);
} }
@ -421,7 +362,7 @@ Thunk_IDirect3DImpl_2_CreateMaterial(LPDIRECT3D2 iface,
LPDIRECT3DMATERIAL3 ret_val; LPDIRECT3DMATERIAL3 ret_val;
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial2, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpDirect3DMaterial2, pUnkOuter);
ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface), ret = IDirect3D3_CreateMaterial(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirect3D3, iface),
&ret_val, &ret_val,
pUnkOuter); pUnkOuter);
@ -438,7 +379,7 @@ Thunk_IDirect3DImpl_2_CreateViewport(LPDIRECT3D2 iface,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport2, pUnkOuter); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lplpD3DViewport2, pUnkOuter);
return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface), return IDirect3D3_CreateViewport(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirect3D3, iface),
(LPDIRECT3DVIEWPORT3 *) lplpD3DViewport2 /* No need to cast here */, (LPDIRECT3DVIEWPORT3 *) lplpD3DViewport2 /* No need to cast here */,
pUnkOuter); pUnkOuter);
} }
@ -459,7 +400,7 @@ Thunk_IDirect3DImpl_3_CreateVertexBuffer(LPDIRECT3D3 iface,
/* dwFlags is not used in the D3D7 interface, use the vertex buffer description instead */ /* dwFlags is not used in the D3D7 interface, use the vertex buffer description instead */
if (dwFlags & D3DDP_DONOTCLIP) lpD3DVertBufDesc->dwCaps |= D3DVBCAPS_DONOTCLIP; if (dwFlags & D3DDP_DONOTCLIP) lpD3DVertBufDesc->dwCaps |= D3DVBCAPS_DONOTCLIP;
ret = IDirect3D7_CreateVertexBuffer(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D3, IDirect3D7, iface), ret = IDirect3D7_CreateVertexBuffer(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D3, IDirect3D7, iface),
lpD3DVertBufDesc, lpD3DVertBufDesc,
&ret_val, &ret_val,
dwFlags); dwFlags);
@ -477,7 +418,7 @@ Thunk_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICERESULT lplpD3DDevice) LPD3DFINDDEVICERESULT lplpD3DDevice)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lplpD3DDevice); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lplpD3DDevice);
return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D, IDirect3D3, iface), return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D, IDirect3D3, iface),
lpD3DDFS, lpD3DDFS,
lplpD3DDevice); lplpD3DDevice);
} }
@ -488,7 +429,7 @@ Thunk_IDirect3DImpl_2_FindDevice(LPDIRECT3D2 iface,
LPD3DFINDDEVICERESULT lpD3DFDR) LPD3DFINDDEVICERESULT lpD3DFDR)
{ {
TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lpD3DFDR); TRACE("(%p)->(%p,%p) thunking to IDirect3D3 interface.\n", iface, lpD3DDFS, lpD3DFDR);
return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirect3DImpl, IDirect3D2, IDirect3D3, iface), return IDirect3D3_FindDevice(COM_INTERFACE_CAST(IDirectDrawImpl, IDirect3D2, IDirect3D3, iface),
lpD3DDFS, lpD3DDFS,
lpD3DFDR); lpD3DFDR);
} }

View File

@ -18,17 +18,6 @@
/* This is defined here so as to be able to put them in 'drivers' */ /* 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 HRESULT WINAPI
Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface, Main_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
@ -129,6 +118,11 @@ Main_IDirect3DImpl_1_FindDevice(LPDIRECT3D iface,
LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lplpD3DDevice); LPD3DFINDDEVICERESULT lplpD3DDevice);
HRESULT WINAPI
Thunk_IDirect3DImpl_7_QueryInterface(LPDIRECT3D7 iface,
REFIID riid,
LPVOID* obp);
HRESULT WINAPI HRESULT WINAPI
Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface, Thunk_IDirect3DImpl_3_QueryInterface(LPDIRECT3D3 iface,
REFIID riid, REFIID riid,
@ -144,6 +138,9 @@ Thunk_IDirect3DImpl_1_QueryInterface(LPDIRECT3D iface,
REFIID riid, REFIID riid,
LPVOID* obp); LPVOID* obp);
ULONG WINAPI
Thunk_IDirect3DImpl_7_AddRef(LPDIRECT3D7 iface);
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface); Thunk_IDirect3DImpl_3_AddRef(LPDIRECT3D3 iface);
@ -153,6 +150,9 @@ Thunk_IDirect3DImpl_2_AddRef(LPDIRECT3D2 iface);
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface); Thunk_IDirect3DImpl_1_AddRef(LPDIRECT3D iface);
ULONG WINAPI
Thunk_IDirect3DImpl_7_Release(LPDIRECT3D7 iface);
ULONG WINAPI ULONG WINAPI
Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface); Thunk_IDirect3DImpl_3_Release(LPDIRECT3D3 iface);

View File

@ -47,7 +47,7 @@ GL_IDirect3DImpl_1_EnumDevices(LPDIRECT3D iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */ /* Call functions defined in d3ddevices.c */
@ -62,7 +62,7 @@ GL_IDirect3DImpl_3_2T_EnumDevices(LPDIRECT3D3 iface,
LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK lpEnumDevicesCallback,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
/* Call functions defined in d3ddevices.c */ /* Call functions defined in d3ddevices.c */
@ -77,7 +77,7 @@ GL_IDirect3DImpl_3_2T_1T_CreateLight(LPDIRECT3D3 iface,
LPDIRECT3DLIGHT* lplpDirect3DLight, LPDIRECT3DLIGHT* lplpDirect3DLight,
IUnknown* pUnkOuter) IUnknown* pUnkOuter)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This; IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
int fl; int fl;
IDirect3DLightImpl *d3dlimpl; IDirect3DLightImpl *d3dlimpl;
@ -106,7 +106,7 @@ GL_IDirect3DImpl_3_2T_1T_CreateMaterial(LPDIRECT3D3 iface,
{ {
IDirect3DMaterialImpl *D3Dmat_impl; IDirect3DMaterialImpl *D3Dmat_impl;
HRESULT ret_value; HRESULT ret_value;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpDirect3DMaterial3, pUnkOuter); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpDirect3DMaterial3, pUnkOuter);
ret_value = d3dmaterial_create(&D3Dmat_impl, This); ret_value = d3dmaterial_create(&D3Dmat_impl, This);
@ -123,7 +123,7 @@ GL_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
{ {
IDirect3DViewportImpl *D3Dvp_impl; IDirect3DViewportImpl *D3Dvp_impl;
HRESULT ret_value; HRESULT ret_value;
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpD3DViewport3, pUnkOuter); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lplpD3DViewport3, pUnkOuter);
ret_value = d3dviewport_create(&D3Dvp_impl, This); ret_value = d3dviewport_create(&D3Dvp_impl, This);
@ -134,7 +134,7 @@ GL_IDirect3DImpl_3_2T_1T_CreateViewport(LPDIRECT3D3 iface,
} }
static HRESULT static HRESULT
create_device_helper(IDirect3DImpl *This, create_device_helper(IDirectDrawImpl *This,
REFCLSID iid, REFCLSID iid,
IDirectDrawSurfaceImpl *lpDDS, IDirectDrawSurfaceImpl *lpDDS,
void **obj, void **obj,
@ -186,7 +186,7 @@ GL_IDirect3DImpl_2_CreateDevice(LPDIRECT3D2 iface,
LPDIRECTDRAWSURFACE lpDDS, LPDIRECTDRAWSURFACE lpDDS,
LPDIRECT3DDEVICE2* lplpD3DDevice2) LPDIRECT3DDEVICE2* lplpD3DDevice2)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D2, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D2, iface);
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, lpDDS); IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface3, lpDDS);
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2); TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice2);
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice2, 2); return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice2, 2);
@ -199,7 +199,7 @@ GL_IDirect3DImpl_3_CreateDevice(LPDIRECT3D3 iface,
LPDIRECT3DDEVICE3* lplpD3DDevice3, LPDIRECT3DDEVICE3* lplpD3DDevice3,
LPUNKNOWN lpUnk) LPUNKNOWN lpUnk)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS); IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS);
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3); TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice3);
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice3, 3); return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice3, 3);
@ -210,7 +210,7 @@ GL_IDirect3DImpl_3_2T_1T_FindDevice(LPDIRECT3D3 iface,
LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICESEARCH lpD3DDFS,
LPD3DFINDDEVICERESULT lpD3DFDR) LPD3DFINDDEVICERESULT lpD3DFDR)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D3, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D3, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpD3DDFS, lpD3DFDR); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpD3DDFS, lpD3DFDR);
return d3ddevice_find(This, lpD3DDFS, lpD3DFDR); return d3ddevice_find(This, lpD3DDFS, lpD3DFDR);
} }
@ -221,7 +221,7 @@ GL_IDirect3DImpl_7_3T_EnumZBufferFormats(LPDIRECT3D7 iface,
LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback,
LPVOID lpContext) LPVOID lpContext)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
DDPIXELFORMAT pformat; DDPIXELFORMAT pformat;
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext); TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(riidDevice), lpEnumCallback, lpContext);
@ -246,7 +246,7 @@ GL_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
LPVOID lpUserArg) LPVOID lpUserArg)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg); TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
if (d3ddevice_enumerate7(lpEnumDevicesCallback, lpUserArg) != D3DENUMRET_OK) if (d3ddevice_enumerate7(lpEnumDevicesCallback, lpUserArg) != D3DENUMRET_OK)
@ -261,7 +261,7 @@ GL_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECTDRAWSURFACE7 lpDDS,
LPDIRECT3DDEVICE7* lplpD3DDevice) LPDIRECT3DDEVICE7* lplpD3DDevice)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS); IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS);
TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice); TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice);
return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice, 7); return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice, 7);
@ -273,7 +273,7 @@ GL_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertBuf,
DWORD dwFlags) DWORD dwFlags)
{ {
ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface); ICOM_THIS_FROM(IDirectDrawImpl, IDirect3D7, iface);
IDirect3DVertexBufferImpl *vbimpl; IDirect3DVertexBufferImpl *vbimpl;
HRESULT res; HRESULT res;
@ -286,7 +286,7 @@ GL_IDirect3DImpl_7_3T_CreateVertexBuffer(LPDIRECT3D7 iface,
return res; return res;
} }
static void light_released(IDirect3DImpl *This, GLenum light_num) static void light_released(IDirectDrawImpl *This, GLenum light_num)
{ {
IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This; IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
glThis->free_lights |= (light_num - GL_LIGHT0); glThis->free_lights |= (light_num - GL_LIGHT0);
@ -301,9 +301,9 @@ static void light_released(IDirect3DImpl *This, GLenum light_num)
ICOM_VTABLE(IDirect3D7) VTABLE_IDirect3D7 = ICOM_VTABLE(IDirect3D7) VTABLE_IDirect3D7 =
{ {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
XCAST(QueryInterface) Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface, XCAST(QueryInterface) Thunk_IDirect3DImpl_7_QueryInterface,
XCAST(AddRef) Main_IDirect3DImpl_7_3T_2T_1T_AddRef, XCAST(AddRef) Thunk_IDirect3DImpl_7_AddRef,
XCAST(Release) Main_IDirect3DImpl_7_3T_2T_1T_Release, XCAST(Release) Thunk_IDirect3DImpl_7_Release,
XCAST(EnumDevices) GL_IDirect3DImpl_7_EnumDevices, XCAST(EnumDevices) GL_IDirect3DImpl_7_EnumDevices,
XCAST(CreateDevice) GL_IDirect3DImpl_7_CreateDevice, XCAST(CreateDevice) GL_IDirect3DImpl_7_CreateDevice,
XCAST(CreateVertexBuffer) GL_IDirect3DImpl_7_3T_CreateVertexBuffer, XCAST(CreateVertexBuffer) GL_IDirect3DImpl_7_3T_CreateVertexBuffer,
@ -393,13 +393,13 @@ ICOM_VTABLE(IDirect3D) VTABLE_IDirect3D =
#undef XCAST #undef XCAST
#endif #endif
static HRESULT d3d_add_device(IDirect3DImpl *This, IDirect3DDeviceImpl *device) static HRESULT d3d_add_device(IDirectDrawImpl *This, IDirect3DDeviceImpl *device)
{ {
if (This->current_device == NULL) { if (This->current_device == NULL) {
/* Create delayed textures now that we have an OpenGL context... /* Create delayed textures now that we have an OpenGL context...
For that, go through all surface attached to our DDraw object and create For that, go through all surface attached to our DDraw object and create
OpenGL textures for all textures.. */ OpenGL textures for all textures.. */
IDirectDrawSurfaceImpl *surf = This->ddraw->surfaces; IDirectDrawSurfaceImpl *surf = This->surfaces;
while (surf != NULL) { while (surf != NULL) {
if (surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) { if (surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) {
@ -415,38 +415,34 @@ static HRESULT d3d_add_device(IDirect3DImpl *This, IDirect3DDeviceImpl *device)
return DD_OK; return DD_OK;
} }
static HRESULT d3d_remove_device(IDirect3DImpl *This, IDirect3DDeviceImpl *device) static HRESULT d3d_remove_device(IDirectDrawImpl *This, IDirect3DDeviceImpl *device)
{ {
This->current_device = NULL; This->current_device = NULL;
return DD_OK; return DD_OK;
} }
HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw) HRESULT direct3d_create(IDirectDrawImpl *This)
{ {
IDirect3DImpl *object;
IDirect3DGLImpl *globject; IDirect3DGLImpl *globject;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DGLImpl)); globject = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DGLImpl));
if (object == NULL) return DDERR_OUTOFMEMORY; if (globject == NULL) return DDERR_OUTOFMEMORY;
object->ref = 1; This->d3d_create_texture = d3dtexture_create;
object->ddraw = ddraw; This->d3d_added_device = d3d_add_device;
object->create_texture = d3dtexture_create; This->d3d_removed_device = d3d_remove_device;
object->added_device = d3d_add_device;
object->removed_device = d3d_remove_device;
ICOM_INIT_INTERFACE(object, IDirect3D, VTABLE_IDirect3D); ICOM_INIT_INTERFACE(This, IDirect3D, VTABLE_IDirect3D);
ICOM_INIT_INTERFACE(object, IDirect3D2, VTABLE_IDirect3D2); ICOM_INIT_INTERFACE(This, IDirect3D2, VTABLE_IDirect3D2);
ICOM_INIT_INTERFACE(object, IDirect3D3, VTABLE_IDirect3D3); ICOM_INIT_INTERFACE(This, IDirect3D3, VTABLE_IDirect3D3);
ICOM_INIT_INTERFACE(object, IDirect3D7, VTABLE_IDirect3D7); ICOM_INIT_INTERFACE(This, IDirect3D7, VTABLE_IDirect3D7);
globject = (IDirect3DGLImpl *) object;
globject->free_lights = (0x01 << MAX_LIGHTS) - 1; /* There are, in total, 8 lights in OpenGL */ globject->free_lights = (0x01 << MAX_LIGHTS) - 1; /* There are, in total, 8 lights in OpenGL */
globject->light_released = light_released; globject->light_released = light_released;
*obj = object; This->d3d_private = globject;
TRACE(" creating implementation at %p.\n", *obj); TRACE(" creating Mesa private storage at %p.\n", globject);
return D3D_OK; return D3D_OK;
} }

View File

@ -132,8 +132,8 @@ FakeZBuffer_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
} }
/* We only support the BLT with DEPTH_FILL for now */ /* We only support the BLT with DEPTH_FILL for now */
if ((dwFlags & DDBLT_DEPTHFILL) && (This->ddraw_owner->d3d != NULL)) { if ((dwFlags & DDBLT_DEPTHFILL) && (This->ddraw_owner->d3d_private != NULL)) {
if (This->ddraw_owner->d3d->current_device != NULL) { if (This->ddraw_owner->current_device != NULL) {
D3DRECT rect; D3DRECT rect;
if (rdst) { if (rdst) {
rect.u1.x1 = rdst->left; rect.u1.x1 = rdst->left;
@ -141,12 +141,12 @@ FakeZBuffer_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
rect.u3.x2 = rdst->right; rect.u3.x2 = rdst->right;
rect.u4.y2 = rdst->bottom; rect.u4.y2 = rdst->bottom;
} }
This->ddraw_owner->d3d->current_device->clear(This->ddraw_owner->d3d->current_device, This->ddraw_owner->current_device->clear(This->ddraw_owner->current_device,
(rdst == NULL ? 0 : 1), &rect, (rdst == NULL ? 0 : 1), &rect,
D3DCLEAR_ZBUFFER, D3DCLEAR_ZBUFFER,
0x00000000, 0x00000000,
((double) lpbltfx->u5.dwFillDepth) / 4294967295.0, ((double) lpbltfx->u5.dwFillDepth) / 4294967295.0,
0x00000000); 0x00000000);
return DD_OK; return DD_OK;
} }
} }

View File

@ -189,7 +189,7 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
IDirect3DDeviceImpl *d3ddevimpl; IDirect3DDeviceImpl *d3ddevimpl;
HRESULT ret_value; HRESULT ret_value;
ret_value = d3ddevice_create(&d3ddevimpl, This->ddraw_owner->d3d, This); ret_value = d3ddevice_create(&d3ddevimpl, This->ddraw_owner, This);
if (FAILED(ret_value)) return ret_value; if (FAILED(ret_value)) return ret_value;
*ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice); *ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice);
@ -207,12 +207,12 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
/* In case the texture surface was created before the D3D creation */ /* In case the texture surface was created before the D3D creation */
if (This->tex_private == NULL) { if (This->tex_private == NULL) {
if (This->ddraw_owner->d3d == NULL) { if (This->ddraw_owner->d3d_private == NULL) {
ERR("Texture created with no D3D object yet.. Not supported !\n"); ERR("Texture created with no D3D object yet.. Not supported !\n");
return E_NOINTERFACE; return E_NOINTERFACE;
} }
ret_value = This->ddraw_owner->d3d->create_texture(This->ddraw_owner->d3d, This, FALSE, This->mip_main); ret_value = This->ddraw_owner->d3d_create_texture(This->ddraw_owner, This, FALSE, This->mip_main);
if (FAILED(ret_value)) return ret_value; if (FAILED(ret_value)) return ret_value;
} }
if (IsEqualGUID( &IID_IDirect3DTexture, riid )) { if (IsEqualGUID( &IID_IDirect3DTexture, riid )) {

View File

@ -773,7 +773,7 @@ HRESULT upload_surface_to_tex_memory_init(IDirectDrawSurfaceImpl *surf_ptr, GLui
(src_pf->u3.dwGBitMask == 0x0000FF00) && (src_pf->u3.dwGBitMask == 0x0000FF00) &&
(src_pf->u4.dwBBitMask == 0x000000FF) && (src_pf->u4.dwBBitMask == 0x000000FF) &&
(src_pf->u5.dwRGBAlphaBitMask == 0x00000000)) { (src_pf->u5.dwRGBAlphaBitMask == 0x00000000)) {
if (need_alpha_ck) { if (need_alpha_ck == TRUE) {
convert_type = CONVERT_RGB32_888; convert_type = CONVERT_RGB32_888;
current_format = GL_RGBA; current_format = GL_RGBA;
internal_format = GL_RGBA; internal_format = GL_RGBA;
@ -889,7 +889,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(WORD)); current_tex_width * current_tex_height * sizeof(WORD));
dst = (WORD *) *temp_buffer; dst = (WORD *) *temp_buffer;
@ -909,7 +909,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(WORD)); current_tex_width * current_tex_height * sizeof(WORD));
dst = (WORD *) *temp_buffer; dst = (WORD *) *temp_buffer;
@ -929,7 +929,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(WORD)); current_tex_width * current_tex_height * sizeof(WORD));
dst = (WORD *) *temp_buffer; dst = (WORD *) *temp_buffer;
@ -968,7 +968,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(WORD)); current_tex_width * current_tex_height * sizeof(WORD));
dst = (WORD *) *temp_buffer; dst = (WORD *) *temp_buffer;
@ -988,7 +988,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; WORD *src = (WORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(WORD)); current_tex_width * current_tex_height * sizeof(WORD));
dst = (WORD *) *temp_buffer; dst = (WORD *) *temp_buffer;
@ -1017,7 +1017,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
BYTE *src = (BYTE *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)); BYTE *src = (BYTE *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top));
DWORD *dst; DWORD *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(DWORD)); current_tex_width * current_tex_height * sizeof(DWORD));
dst = (DWORD *) *temp_buffer; dst = (DWORD *) *temp_buffer;
@ -1038,7 +1038,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(DWORD)); current_tex_width * current_tex_height * sizeof(DWORD));
dst = (DWORD *) *temp_buffer; dst = (DWORD *) *temp_buffer;
@ -1057,7 +1057,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(DWORD)); current_tex_width * current_tex_height * sizeof(DWORD));
dst = (DWORD *) *temp_buffer; dst = (DWORD *) *temp_buffer;
@ -1077,7 +1077,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
DWORD i; DWORD i;
DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst; DWORD *src = (DWORD *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top)), *dst;
if (*temp_buffer != NULL) if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(DWORD)); current_tex_width * current_tex_height * sizeof(DWORD));
dst = (DWORD *) *temp_buffer; dst = (DWORD *) *temp_buffer;

View File

@ -45,11 +45,11 @@ typedef enum {
SURFACE_MEMORY_DIRTY SURFACE_MEMORY_DIRTY
} SURFACE_STATE; } SURFACE_STATE;
/* This structure is used for the 'd3d_private' field of the IDirectDraw structure */
typedef struct IDirect3DGLImpl typedef struct IDirect3DGLImpl
{ {
struct IDirect3DImpl parent;
DWORD free_lights; DWORD free_lights;
void (*light_released)(IDirect3DImpl *, GLenum light_num); void (*light_released)(IDirectDrawImpl *, GLenum light_num);
} IDirect3DGLImpl; } IDirect3DGLImpl;
typedef struct IDirect3DLightGLImpl typedef struct IDirect3DLightGLImpl
@ -124,19 +124,19 @@ typedef struct {
} IDirect3DVertexBufferGLImpl; } IDirect3DVertexBufferGLImpl;
/* All non-static functions 'exported' by various sub-objects */ /* All non-static functions 'exported' by various sub-objects */
extern HRESULT direct3d_create(IDirect3DImpl **obj, IDirectDrawImpl *ddraw); extern HRESULT direct3d_create(IDirectDrawImpl *This);
extern HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main_surf); extern HRESULT d3dtexture_create(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main_surf);
extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirect3DImpl *d3d, GLenum light_num); extern HRESULT d3dlight_create(IDirect3DLightImpl **obj, IDirectDrawImpl *d3d, GLenum light_num);
extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirect3DImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc); extern HRESULT d3dexecutebuffer_create(IDirect3DExecuteBufferImpl **obj, IDirectDrawImpl *d3d, IDirect3DDeviceImpl *d3ddev, LPD3DEXECUTEBUFFERDESC lpDesc);
extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirect3DImpl *d3d); extern HRESULT d3dmaterial_create(IDirect3DMaterialImpl **obj, IDirectDrawImpl *d3d);
extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirect3DImpl *d3d); extern HRESULT d3dviewport_create(IDirect3DViewportImpl **obj, IDirectDrawImpl *d3d);
extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirect3DImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags); extern HRESULT d3dvertexbuffer_create(IDirect3DVertexBufferImpl **obj, IDirectDrawImpl *d3d, LPD3DVERTEXBUFFERDESC lpD3DVertBufDesc, DWORD dwFlags);
extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surface); extern HRESULT d3ddevice_create(IDirect3DDeviceImpl **obj, IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *surface);
/* Used for Direct3D to request the device to enumerate itself */ /* Used for Direct3D to request the device to enumerate itself */
extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD version) ; extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD version) ;
extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ; extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice); extern HRESULT d3ddevice_find(IDirectDrawImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice);
/* Used to upload the texture */ /* Used to upload the texture */
extern HRESULT gltex_upload_texture(IDirectDrawSurfaceImpl *This) ; extern HRESULT gltex_upload_texture(IDirectDrawSurfaceImpl *This) ;