wined3d/ddraw: Forward DDSCL_MULTITHREADED to wined3d.

This commit is contained in:
Stefan Dösinger 2007-03-04 17:03:03 +01:00 committed by Alexandre Julliard
parent 63da5f26c2
commit 022e884342
7 changed files with 43 additions and 7 deletions

View File

@ -377,6 +377,10 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
if(BehaviourFlags & D3DCREATE_MULTITHREADED) {
IWineD3DDevice_SetMultithreaded(object->WineD3DDevice);
}
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;

View File

@ -367,6 +367,10 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapte
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
if(BehaviourFlags & D3DCREATE_MULTITHREADED) {
IWineD3DDevice_SetMultithreaded(object->WineD3DDevice);
}
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
@ -389,6 +393,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapte
HeapFree(GetProcessHeap(), 0, object);
*ppReturnedDeviceInterface = NULL;
}
return hr;
}

View File

@ -323,7 +323,8 @@ IDirectDrawImpl_Release(IDirectDraw7 *iface)
* DDSCL_SETFOCUSWINDOW may only be used with DDSCL_NOWINDOWCHANGES
*
* Handled flags: DDSCL_NORMAL, DDSCL_FULLSCREEN, DDSCL_EXCLUSIVE,
* DDSCL_SETFOCUSWINDOW (partially)
* DDSCL_SETFOCUSWINDOW (partially),
* DDSCL_MULTITHREADED (work in progress)
*
* Unhandled flags, which should be implemented
* DDSCL_SETDEVICEWINDOW: Sets a window specially used for rendering (I don't
@ -334,8 +335,7 @@ IDirectDrawImpl_Release(IDirectDraw7 *iface)
* Unsure about these: DDSCL_FPUSETUP DDSCL_FPURESERVE
*
* These seem not really imporant for wine
* DDSCL_ALLOWREBOOT, DDSCL_NOWINDOWCHANGES, DDSCL_ALLOWMODEX,
* DDSCL_MULTITHREDED
* DDSCL_ALLOWREBOOT, DDSCL_NOWINDOWCHANGES, DDSCL_ALLOWMODEX
*
* Returns:
* DD_OK if the cooperative level was set successfully
@ -501,13 +501,19 @@ IDirectDrawImpl_SetCooperativeLevel(IDirectDraw7 *iface,
}
}
if(cooplevel & DDSCL_MULTITHREADED && !(This->cooperative_level & DDSCL_MULTITHREADED))
{
FIXME("DirectDraw is not thread safe yet\n");
/* Enable thread safety in wined3d */
IWineD3DDevice_SetMultithreaded(This->wineD3DDevice);
}
/* Unhandled flags */
if(cooplevel & DDSCL_ALLOWREBOOT)
WARN("(%p) Unhandled flag DDSCL_ALLOWREBOOT, harmless\n", This);
if(cooplevel & DDSCL_ALLOWMODEX)
WARN("(%p) Unhandled flag DDSCL_ALLOWMODEX, harmless\n", This);
if(cooplevel & DDSCL_MULTITHREADED)
FIXME("(%p) Unhandled flag DDSCL_MULTITHREADED, Uh Oh...\n", This);
if(cooplevel & DDSCL_FPUSETUP)
WARN("(%p) Unhandled flag DDSCL_FPUSETUP, harmless\n", This);
if(cooplevel & DDSCL_FPUPRESERVE)

View File

@ -1830,6 +1830,22 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL
This->ddraw_fullscreen = fullscreen;
}
/* Enables thead safety in the wined3d device and its resources. Called by DirectDraw
* from SetCooperativeLeven if DDSCL_MULTITHREADED is specified, and by d3d8/9 from
* CreateDevice if D3DCREATE_MULTITHREADED is passed.
*
* There is no way to deactivate thread safety once it is enabled
*/
static void WINAPI IWineD3DDeviceImpl_SetMultithreaded(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("No thread safety in wined3d yet\n");
/*For now just store the flag(needed in case of ddraw) */
This->createParms.BehaviorFlags |= WINED3DCREATE_MULTITHREADED;
return;
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) {
DEVMODEW devmode;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
@ -5779,6 +5795,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_Init3D,
IWineD3DDeviceImpl_Uninit3D,
IWineD3DDeviceImpl_SetFullscreen,
IWineD3DDeviceImpl_SetMultithreaded,
IWineD3DDeviceImpl_EvictManagedResources,
IWineD3DDeviceImpl_GetAvailableTextureMem,
IWineD3DDeviceImpl_GetBackBuffer,

View File

@ -299,5 +299,8 @@ typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE {
#define WINED3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF)
#define WINED3DPS_END() 0x0000FFFF
#define WINED3DVS_END() 0x0000FFFF
/* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */
#define WINED3DCREATE_MULTITHREADED 0x00000004
#endif

View File

@ -356,6 +356,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
STDMETHOD(Init3D)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
STDMETHOD(Uninit3D)(THIS, D3DCB_DESTROYSURFACEFN pFn, D3DCB_DESTROYSWAPCHAINFN pFn2);
STDMETHOD_(void, SetFullscreen)(THIS_ BOOL fullscreen);
STDMETHOD_(void, SetMultithreaded)(THIS);
STDMETHOD(EvictManagedResources)(THIS) PURE;
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain, UINT BackBuffer, WINED3DBACKBUFFER_TYPE, struct IWineD3DSurface** ppBackBuffer) PURE;
@ -492,6 +493,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
#define IWineD3DDevice_Init3D(p, a, b) (p)->lpVtbl->Init3D(p, a, b)
#define IWineD3DDevice_Uninit3D(p, a, b) (p)->lpVtbl->Uninit3D(p, a, b)
#define IWineD3DDevice_SetFullscreen(p, a) (p)->lpVtbl->SetFullscreen(p, a)
#define IWineD3DDevice_SetMultithreaded(p) (p)->lpVtbl->SetMultithreaded(p)
#define IWineD3DDevice_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
#define IWineD3DDevice_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p)
#define IWineD3DDevice_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d)

View File

@ -1569,7 +1569,6 @@ typedef enum _WINED3DSURFTYPE {
/* IWineD3D::CreateDevice behaviour flags */
#define WINED3DCREATE_FPU_PRESERVE 0x00000002
#define WINED3DCREATE_MULTITHREADED 0x00000004
#define WINED3DCREATE_PUREDEVICE 0x00000010
#define WINED3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020
#define WINED3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040