Stefan Dösinger : wined3d: Split device creation and opengl initialization.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 13 05:17:19 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: d2510847b0751a8e4a97645c6bd31a97f890fb5d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=d2510847b0751a8e4a97645c6bd31a97f890fb5d

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Apr 12 21:08:57 2006 +0200

wined3d: Split device creation and opengl initialization.

---

 dlls/d3d8/device.c               |    3 +++
 dlls/d3d8/directx.c              |   18 ++++++++++++++----
 dlls/d3d9/device.c               |    3 +++
 dlls/d3d9/directx.c              |   15 ++++++++++++---
 dlls/wined3d/device.c            |   12 ++++++++++++
 include/wine/wined3d_interface.h |    2 ++
 6 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 2590498..1d4ce68 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -69,6 +69,9 @@ ULONG WINAPI IDirect3DDevice8Impl_Releas
 
     if (ref == 0) {
         TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
+        /* Activate this when it's implemented in wined3d(d3d7 merge)
+        IWineD3DDevice_Uninit3D(This->WineD3DDevice);
+        */
         IWineD3DDevice_Release(This->WineD3DDevice);
         HeapFree(GetProcessHeap(), 0, This);
     }
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index 3668afa..a0f56c8 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -324,13 +324,23 @@ HRESULT  WINAPI  IDirect3D8Impl_CreateDe
     localParameters.PresentationInterval           = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */
 
     hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateAdditionalSwapChain);
- 
-    if (hr == D3D_OK) {
-        TRACE("(%p) : Created Device %p\n", This, object);
-    } else {
+
+    if (hr != D3D_OK) {
+        HeapFree(GetProcessHeap(), 0, object);
+        *ppReturnedDeviceInterface = NULL;
+        return hr;
+    }
+
+    TRACE("(%p) : Created Device %p\n", This, object);
+
+    /* Activate this when it's implemented in wined3d(d3d7 merge)
+    hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
+    if (hr != D3D_OK) {
+        FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
         HeapFree(GetProcessHeap(), 0, object);
         *ppReturnedDeviceInterface = NULL;
     }
+    */
 
     return hr;
 }
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index cd1a5cd..7aa1337 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -57,6 +57,9 @@ ULONG WINAPI IDirect3DDevice9Impl_Releas
     TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
 
     if (ref == 0) {
+      /* Activate this when it's implemented in WineD3D(d3d7 merge)
+      IWineD3DDevice_Uninit3D(This->WineD3DDevice);
+      */
       IWineD3DDevice_Release(This->WineD3DDevice);
       HeapFree(GetProcessHeap(), 0, This);
     }
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index d948637..fda6bc5 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -309,13 +309,22 @@ HRESULT  WINAPI  IDirect3D9Impl_CreateDe
 
     hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateAdditionalSwapChain);
 
-    if (hr == D3D_OK) {
+    if (hr != D3D_OK) {
+        HeapFree(GetProcessHeap(), 0, object);
+        *ppReturnedDeviceInterface = NULL;
+        return hr;
+    }
+
+    TRACE("(%p) : Created Device %p\n", This, object);
 
-        TRACE("(%p) : Created Device %p\n", This, object);
-    } else {
+    /* Activate this when it's implemented in wined3d(d3d7 merge)
+    hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
+    if (hr != D3D_OK) {
+        FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
         HeapFree(GetProcessHeap(), 0, object);
         *ppReturnedDeviceInterface = NULL;
     }
+    */
     return hr;
 }
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3626b88..a7362e7 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1668,6 +1668,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
     return hr;
 }
 
+HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain) {
+    FIXME("This call is a d3d7 merge stub. It will be implemented later\n");
+    return WINED3DERR_INVALIDCALL;
+}
+
+HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface) {
+    FIXME("This call is a d3d7 merge stub. It will be implemented later\n");
+    return WINED3DERR_INVALIDCALL;
+}
+
 HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, IWineD3D **ppD3D) {
    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
    *ppD3D= This->wineD3D;
@@ -6792,6 +6802,8 @@ const IWineD3DDeviceVtbl IWineD3DDevice_
     IWineD3DDeviceImpl_CreateVertexShader,
     IWineD3DDeviceImpl_CreatePixelShader,
     /*** Odd functions **/
+    IWineD3DDeviceImpl_Init3D,
+    IWineD3DDeviceImpl_Uninit3D,
     IWineD3DDeviceImpl_EvictManagedResources,
     IWineD3DDeviceImpl_GetAvailableTextureMem,
     IWineD3DDeviceImpl_GetBackBuffer,
diff --git a/include/wine/wined3d_interface.h b/include/wine/wined3d_interface.h
index 2037fc8..429a0c6 100644
--- a/include/wine/wined3d_interface.h
+++ b/include/wine/wined3d_interface.h
@@ -362,6 +362,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD
     STDMETHOD(CreateVertexDeclaration)(THIS_ CONST VOID* pDeclaration, struct IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent) PURE;
     STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD *pDeclaration, CONST DWORD* pFunction, struct IWineD3DVertexShader** ppShader, IUnknown *pParent) PURE;
     STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction, struct IWineD3DPixelShader** ppShader, IUnknown *pParent) PURE;
+    STDMETHOD(Init3D)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
+    STDMETHOD(Uninit3D)(THIS);
     STDMETHOD(EvictManagedResources)(THIS) PURE;
     STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
     STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain, UINT BackBuffer, WINED3DBACKBUFFER_TYPE, struct IWineD3DSurface** ppBackBuffer) PURE;




More information about the wine-cvs mailing list