DDraw / WineD3D: Pass the multithreaded flag to wined3d
Stefan Dösinger
stefandoesinger at gmx.at
Sat Aug 19 17:01:56 CDT 2006
Unlike d3d8 and d3d9 the DDSCL_MULTITHREADED flag is set after the object is
created, so we need a function to pass this flag to wined3d. At the moment
this is a stub, but later this function will initialize the critical section
for the device.
CreateDevice calls this function if the D3DCREATE_MULTITHREADED flag is set by
d3d8 / d3d9.
-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Stefan Dösinger <stefan at codeweavers.com>
Date: Sat Aug 19 22:48:35 2006 +0200
Subject: [PATCH] DDraw / WineD3D: Allow passing DDSCL_MULTITHREADED to wined3d
---
dlls/ddraw/ddraw.c | 2 ++
dlls/wined3d/device.c | 13 +++++++++++++
dlls/wined3d/directx.c | 4 ++++
include/wine/wined3d_interface.h | 2 ++
4 files changed, 21 insertions(+), 0 deletions(-)
876995238e054bbc43f3a4c8924042d4878a57df
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 96d3f2d..ac9952c 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -649,6 +649,8 @@ IDirectDrawImpl_SetCooperativeLevel(IDir
ERR("Setting DDSCL_MULTITHREADED, but surfaces exist already\n");
}
+ IWineD3DDevice_EnableMultithread(This->wineD3DDevice);
+
TRACE("(%p): Creating a critical section for the IDirectDrawImpl object\n", This);
InitializeCriticalSection(&This->crit);
This->hasCrit = TRUE;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index beeb530..ffbaa01 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -7690,6 +7690,18 @@ static void WINAPI IWineD3DDeviceImpl_Ge
return;
}
+static void WINAPI IWineD3DDeviceImpl_EnableMultithread(IWineD3DDevice *iface) {
+ IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
+
+ /* In DDraw the multithreded flag is set after creation via SetCooperativeLevel
+ * (DDSCL_MULTITHREADED), so wineD3D needs to offer a way to switch this after
+ * creation.
+ */
+ FIXME("(%p) Stub!\n", This);
+ This->createParms.BehaviorFlags |= D3DCREATE_MULTITHREADED;
+ /* Create a critical section */
+ return;
+}
/** ********************************************************
* Notification functions
@@ -7994,6 +8006,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_
IWineD3DDeviceImpl_StretchRect,
IWineD3DDeviceImpl_GetRenderTargetData,
IWineD3DDeviceImpl_GetFrontBufferData,
+ IWineD3DDeviceImpl_EnableMultithread,
/*** Internal use IWineD3DDevice methods ***/
IWineD3DDeviceImpl_SetupTextureStates,
/*** object tracking ***/
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index b99e03b..ad060c5 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2300,6 +2300,10 @@ static HRESULT WINAPI IWineD3DImpl_Crea
object->ddraw_format = pixelformat_for_depth(GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES));
DeleteDC(hDC);
+ if(BehaviourFlags & D3DCREATE_MULTITHREADED) {
+ IWineD3DDevice_EnableMultithread((IWineD3DDevice *) object);
+ }
+
return WINED3D_OK;
create_device_error:
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index 01cc8ef..4955160 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -490,6 +490,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD
STDMETHOD(StretchRect)(THIS_ struct IWineD3DSurface* pSourceSurface, CONST RECT* pSourceRect, struct IWineD3DSurface* pDestinationSurface, CONST RECT* pDestRect, WINED3DTEXTUREFILTERTYPE Filter) PURE;
STDMETHOD(GetRenderTargetData)(THIS_ struct IWineD3DSurface* pRenderTarget, struct IWineD3DSurface* pSurface) PURE;
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,struct IWineD3DSurface* pSurface) PURE;
+ STDMETHOD_(void,EnableMultithread)(THIS);
/*** Internal use IWineD3Device methods ***/
STDMETHOD_(void, SetupTextureStates)(THIS_ DWORD Stage, DWORD texture_idx, DWORD Flags);
/*** object tracking ***/
@@ -630,6 +631,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD
#define IWineD3DDevice_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e)
#define IWineD3DDevice_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
#define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
+#define IWineD3DDevice_EnableMultithread(p) (p)->lpVtbl->EnableMultithread(p)
#define IWineD3DDevice_SetupTextureStates(p,a,b,c) (p)->lpVtbl->SetupTextureStates(p,a,b,c)
#define IWineD3DDevice_ResourceReleased(p,a) (p)->lpVtbl->ResourceReleased(p,a)
#endif
--
1.2.4
More information about the wine-patches
mailing list