wined3d: Split device creation and opengl initialization.

This commit is contained in:
Stefan Dösinger 2006-04-12 21:08:57 +02:00 committed by Alexandre Julliard
parent 59189ba75b
commit d2510847b0
6 changed files with 46 additions and 7 deletions

View File

@ -69,6 +69,9 @@ ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
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);
}

View File

@ -324,13 +324,23 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3
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;
}

View File

@ -57,6 +57,9 @@ ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
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);
}

View File

@ -309,13 +309,22 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
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);
} else {
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;
}

View File

@ -1668,6 +1668,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, CONST
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_Vtbl =
IWineD3DDeviceImpl_CreateVertexShader,
IWineD3DDeviceImpl_CreatePixelShader,
/*** Odd functions **/
IWineD3DDeviceImpl_Init3D,
IWineD3DDeviceImpl_Uninit3D,
IWineD3DDeviceImpl_EvictManagedResources,
IWineD3DDeviceImpl_GetAvailableTextureMem,
IWineD3DDeviceImpl_GetBackBuffer,

View File

@ -362,6 +362,8 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
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;