Commit a4bc52a8 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Fix WINED3DPRESENT_PARAMETERS and use it instead of D3DPRESENT_PARAMETERS.

parent a30bc580
......@@ -241,23 +241,37 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
object->lpVtbl = &Direct3DSwapChain8_Vtbl;
/* Allocate an associated WineD3DDevice object */
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = NULL; /* d3d9 only */
localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = 0; /* d3d9 only */
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D8CB_CreateRenderTarget, D3D8CB_CreateDepthStencilSurface);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval;
if (hrc != D3D_OK) {
FIXME("(%p) call to IWineD3DDevice_CreateAdditionalSwapChain failed\n", This);
HeapFree(GetProcessHeap(), 0 , object);
......@@ -274,24 +288,42 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
WINED3DPRESENT_PARAMETERS localParameters;
DWORD dummy_dword = 0;
HRESULT hr;
TRACE("(%p) Relay pPresentationParameters(%p)\n", This, pPresentationParameters);
/* FINDME: FIXME: */
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = &dummy_dword; /* D3d9 only */
localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;
return IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = 0; /* d3d9 only */
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval;
return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
......
......@@ -238,26 +238,38 @@ static HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
D3DPRESENT_PARAMETERS localParameters;
TRACE("(%p) call back\n", device);
localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
localParameters.BackBufferCount = *(pPresentationParameters->BackBufferCount);
localParameters.MultiSampleType = *(pPresentationParameters->MultiSampleType);
/* d3d9 only */
/* localParameters.MultiSampleQuality = *(pPresentationParameters->MultiSampleQuality); */
localParameters.SwapEffect = *(pPresentationParameters->SwapEffect);
localParameters.hDeviceWindow = *(pPresentationParameters->hDeviceWindow);
localParameters.Windowed = *(pPresentationParameters->Windowed);
localParameters.EnableAutoDepthStencil = *(pPresentationParameters->EnableAutoDepthStencil);
localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
localParameters.Flags = *(pPresentationParameters->Flags);
localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
/* d3d9 only */
/* localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval); */
/*copy the presentation parameters*/
/* Copy the presentation parameters */
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.FullScreen_PresentationInterval = pPresentationParameters->PresentationInterval;
res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain);
/* Copy back the presentation parameters */
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.FullScreen_PresentationInterval;
if (SUCCEEDED(res)) {
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
IUnknown_Release(d3dSwapChain->parentDevice);
......@@ -266,25 +278,7 @@ static HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
*ppSwapChain = NULL;
}
/*Copy back the presentation parameters*/
*pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
*pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
*pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
*pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
*pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
/* d3d9 only */
/* *pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality; */
*pPresentationParameters->SwapEffect = localParameters.SwapEffect;
*pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
*pPresentationParameters->Windowed = localParameters.Windowed;
*pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
*pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
*pPresentationParameters->Flags = localParameters.Flags;
*pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
/* d3d9 only */
/* *pPresentationParameters->PresentationInterval = localParameters.PresentationInterval; */
return res;
return res;
}
ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
......@@ -358,22 +352,6 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
*ppReturnedDeviceInterface = (IDirect3DDevice8 *)object;
/* Allocate an associated WineD3DDevice object */
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
/* d3d9 only */
localParameters.MultiSampleQuality = NULL;
localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
if (hr != D3D_OK) {
......@@ -384,7 +362,37 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
TRACE("(%p) : Created Device %p\n", This, object);
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = 0; /* d3d9 only */
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval;
if (hr != D3D_OK) {
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
HeapFree(GetProcessHeap(), 0, object);
......
......@@ -176,23 +176,43 @@ static BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9 iface,
static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
WINED3DPRESENT_PARAMETERS localParameters;
HRESULT hr;
TRACE("(%p) Relay pPresentationParameters(%p)\n", This, pPresentationParameters);
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = &pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
return IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA*
......
......@@ -224,22 +224,22 @@ static HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
D3DPRESENT_PARAMETERS localParameters;
TRACE("(%p) call back\n", device);
localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
localParameters.BackBufferCount = *(pPresentationParameters->BackBufferCount);
localParameters.MultiSampleType = *(pPresentationParameters->MultiSampleType);
localParameters.MultiSampleQuality = *(pPresentationParameters->MultiSampleQuality);
localParameters.SwapEffect = *(pPresentationParameters->SwapEffect);
localParameters.hDeviceWindow = *(pPresentationParameters->hDeviceWindow);
localParameters.Windowed = *(pPresentationParameters->Windowed);
localParameters.EnableAutoDepthStencil = *(pPresentationParameters->EnableAutoDepthStencil);
localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
localParameters.Flags = *(pPresentationParameters->Flags);
localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval);
/*copy the presentation parameters*/
/* Copy the presentation parameters */
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
res = IDirect3DDevice9_CreateAdditionalSwapChain((IDirect3DDevice9 *)device, &localParameters, (IDirect3DSwapChain9 **)&d3dSwapChain);
if (SUCCEEDED(res)) {
......@@ -250,23 +250,24 @@ static HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
} else {
*ppSwapChain = NULL;
}
/*Copy back the presentation parameters*/
*pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
*pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
*pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
*pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
*pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
*pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
*pPresentationParameters->SwapEffect = localParameters.SwapEffect;
*pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
*pPresentationParameters->Windowed = localParameters.Windowed;
*pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
*pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
*pPresentationParameters->Flags = localParameters.Flags;
*pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
*pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
return res;
/* Copy back the presentation parameters */
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
return res;
}
ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
......@@ -341,21 +342,6 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapte
*ppReturnedDeviceInterface = (IDirect3DDevice9 *)object;
/* Allocate an associated WineD3DDevice object */
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = &pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
if (hr != D3D_OK) {
......@@ -366,7 +352,38 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapte
TRACE("(%p) : Created Device %p\n", This, object);
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
if (hr != D3D_OK) {
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
HeapFree(GetProcessHeap(), 0, object);
......
......@@ -128,21 +128,27 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(LPDIRECT3DSWAPCHAIN9 ifa
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWAPCHAIN9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
WINED3DPRESENT_PARAMETERS winePresentParameters;
HRESULT hr;
TRACE("(%p)->(%p): Relay\n", This, pPresentationParameters);
winePresentParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
winePresentParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
winePresentParameters.BackBufferFormat = (WINED3DFORMAT *) &pPresentationParameters->BackBufferFormat;
winePresentParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
winePresentParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
winePresentParameters.MultiSampleQuality = &pPresentationParameters->MultiSampleQuality;
winePresentParameters.SwapEffect = (WINED3DSWAPEFFECT *)&pPresentationParameters->SwapEffect;
winePresentParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
winePresentParameters.Windowed = &pPresentationParameters->Windowed;
winePresentParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
winePresentParameters.Flags = &pPresentationParameters->Flags;
winePresentParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
winePresentParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
return IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters);
hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters);
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = winePresentParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = winePresentParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = winePresentParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = winePresentParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = winePresentParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = winePresentParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = winePresentParameters.hDeviceWindow;
pPresentationParameters->Windowed = winePresentParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = winePresentParameters.EnableAutoDepthStencil;
pPresentationParameters->Flags = winePresentParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = winePresentParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = winePresentParameters.PresentationInterval;
return hr;
}
......@@ -184,23 +190,38 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
}
/* Allocate an associated WineD3DDevice object */
localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = &pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = (WINED3DSWAPEFFECT *)&pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow;
localParameters.Windowed = &pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = &pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
if (hrc != D3D_OK) {
FIXME("(%p) call to IWineD3DDevice_CreateAdditionalSwapChain failed\n", This);
HeapFree(GetProcessHeap(), 0 , object);
......
......@@ -2720,17 +2720,9 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This,
IDirectDrawSurfaceImpl *primary)
{
HRESULT hr;
UINT BackBufferCount = 0;
HWND window;
WINED3DPRESENT_PARAMETERS localParameters;
BOOL isWindowed, EnableAutoDepthStencil;
WINED3DFORMAT AutoDepthStencilFormat;
WINED3DMULTISAMPLE_TYPE MultiSampleType;
WINED3DSWAPEFFECT SwapEffect;
DWORD Flags, MultiSampleQuality;
UINT FullScreen_RefreshRateInHz, PresentationInterval;
WINED3DDISPLAYMODE Mode;
TRACE("(%p)->(%p)\n", This, primary);
......@@ -2761,47 +2753,28 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This,
TRACE("(%p) Using existing window %p for Direct3D rendering\n", This, window);
}
/* use the surface description for the device parameters, not the
* Device settings. The app might render to an offscreen surface
*/
Mode.Width = primary->surface_desc.dwWidth;
Mode.Height = primary->surface_desc.dwHeight;
Mode.Format = PixelFormat_DD2WineD3D(&primary->surface_desc.u4.ddpfPixelFormat);
if(primary->surface_desc.dwFlags & DDSD_BACKBUFFERCOUNT)
{
BackBufferCount = primary->surface_desc.dwBackBufferCount;
}
/* Store the future Render Target surface */
This->d3d_target = primary;
isWindowed = !(This->cooperative_level & DDSCL_FULLSCREEN);
EnableAutoDepthStencil = FALSE;
AutoDepthStencilFormat = WINED3DFMT_D16;
MultiSampleType = WINED3DMULTISAMPLE_NONE;
SwapEffect = WINED3DSWAPEFFECT_COPY;
Flags = 0;
MultiSampleQuality = 0;
FullScreen_RefreshRateInHz = WINED3DPRESENT_RATE_DEFAULT; /* Default rate: It's already set */
PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT;
TRACE("Passing mode %d\n", Mode.Format);
localParameters.BackBufferWidth = &Mode.Width;
localParameters.BackBufferHeight = &Mode.Height;
localParameters.BackBufferFormat = (WINED3DFORMAT *) &Mode.Format;
localParameters.BackBufferCount = (UINT *) &BackBufferCount;
localParameters.MultiSampleType = &MultiSampleType;
localParameters.MultiSampleQuality = &MultiSampleQuality;
localParameters.SwapEffect = &SwapEffect;
localParameters.hDeviceWindow = &window;
localParameters.Windowed = &isWindowed;
localParameters.EnableAutoDepthStencil = &EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = &AutoDepthStencilFormat;
localParameters.Flags = &Flags;
localParameters.FullScreen_RefreshRateInHz = &FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = &PresentationInterval;
/* Use the surface description for the device parameters, not the
* Device settings. The app might render to an offscreen surface
*/
localParameters.BackBufferWidth = primary->surface_desc.dwWidth;
localParameters.BackBufferHeight = primary->surface_desc.dwHeight;
localParameters.BackBufferFormat = PixelFormat_DD2WineD3D(&primary->surface_desc.u4.ddpfPixelFormat);
localParameters.BackBufferCount = (primary->surface_desc.dwFlags & DDSD_BACKBUFFERCOUNT) ? primary->surface_desc.dwBackBufferCount : 0;
localParameters.MultiSampleType = WINED3DMULTISAMPLE_NONE;
localParameters.MultiSampleQuality = 0;
localParameters.SwapEffect = WINED3DSWAPEFFECT_COPY;
localParameters.hDeviceWindow = window;
localParameters.Windowed = !(This->cooperative_level & DDSCL_FULLSCREEN);
localParameters.EnableAutoDepthStencil = FALSE;
localParameters.AutoDepthStencilFormat = WINED3DFMT_D16;
localParameters.Flags = 0;
localParameters.FullScreen_RefreshRateInHz = WINED3DPRESENT_RATE_DEFAULT; /* Default rate: It's already set */
localParameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT;
TRACE("Passing mode %d\n", localParameters.BackBufferFormat);
/* Set this NOW, otherwise creating the depth stencil surface will cause a
* recursive loop until ram or emulated video memory is full
......
......@@ -1247,10 +1247,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
*******************************/
/* Check the params */
if(*pPresentationParameters->BackBufferCount > WINED3DPRESENT_BACK_BUFFER_MAX) {
ERR("App requested %d back buffers, this is not supported for now\n", *pPresentationParameters->BackBufferCount);
if(pPresentationParameters->BackBufferCount > WINED3DPRESENT_BACK_BUFFER_MAX) {
ERR("App requested %d back buffers, this is not supported for now\n", pPresentationParameters->BackBufferCount);
return WINED3DERR_INVALIDCALL;
} else if (*pPresentationParameters->BackBufferCount > 1) {
} else if (pPresentationParameters->BackBufferCount > 1) {
FIXME("The app requests more than one back buffer, this can't be supported properly. Please configure the application to use double buffering(=1 back buffer) if possible\n");
}
......@@ -1261,7 +1261,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
********************/
/* Setup hwnd we are using, plus which display this equates to */
object->win_handle = *(pPresentationParameters->hDeviceWindow);
object->win_handle = pPresentationParameters->hDeviceWindow;
if (!object->win_handle) {
object->win_handle = This->createParms.hFocusWindow;
}
......@@ -1295,39 +1295,26 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
* (or the focus window, if hDeviceWindow is NULL) is taken.
**********************/
if (*(pPresentationParameters->Windowed) &&
((*(pPresentationParameters->BackBufferWidth) == 0) ||
(*(pPresentationParameters->BackBufferHeight) == 0))) {
if (pPresentationParameters->Windowed &&
((pPresentationParameters->BackBufferWidth == 0) ||
(pPresentationParameters->BackBufferHeight == 0))) {
RECT Rect;
GetClientRect(object->win_handle, &Rect);
if (*(pPresentationParameters->BackBufferWidth) == 0) {
*(pPresentationParameters->BackBufferWidth) = Rect.right;
TRACE("Updating width to %d\n", *(pPresentationParameters->BackBufferWidth));
if (pPresentationParameters->BackBufferWidth == 0) {
pPresentationParameters->BackBufferWidth = Rect.right;
TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
}
if (*(pPresentationParameters->BackBufferHeight) == 0) {
*(pPresentationParameters->BackBufferHeight) = Rect.bottom;
TRACE("Updating height to %d\n", *(pPresentationParameters->BackBufferHeight));
if (pPresentationParameters->BackBufferHeight == 0) {
pPresentationParameters->BackBufferHeight = Rect.bottom;
TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
}
}
/* Put the correct figures in the presentation parameters */
TRACE("Copying across presentation parameters\n");
object->presentParms.BackBufferWidth = *(pPresentationParameters->BackBufferWidth);
object->presentParms.BackBufferHeight = *(pPresentationParameters->BackBufferHeight);
object->presentParms.BackBufferFormat = *(pPresentationParameters->BackBufferFormat);
object->presentParms.BackBufferCount = *(pPresentationParameters->BackBufferCount);
object->presentParms.MultiSampleType = *(pPresentationParameters->MultiSampleType);
object->presentParms.MultiSampleQuality = NULL == pPresentationParameters->MultiSampleQuality ? 0 : *(pPresentationParameters->MultiSampleQuality);
object->presentParms.SwapEffect = *(pPresentationParameters->SwapEffect);
object->presentParms.hDeviceWindow = *(pPresentationParameters->hDeviceWindow);
object->presentParms.Windowed = *(pPresentationParameters->Windowed);
object->presentParms.EnableAutoDepthStencil = *(pPresentationParameters->EnableAutoDepthStencil);
object->presentParms.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat);
object->presentParms.Flags = *(pPresentationParameters->Flags);
object->presentParms.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz);
object->presentParms.PresentationInterval = *(pPresentationParameters->PresentationInterval);
object->presentParms = *pPresentationParameters;
TRACE("calling rendertarget CB\n");
hr = D3DCB_CreateRenderTarget((IUnknown *) This->parent,
......@@ -1379,7 +1366,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
* I think Windows and X have different ideas about fullscreen, does a single head count as full screen?
**************************************/
if (!*(pPresentationParameters->Windowed)) {
if (!pPresentationParameters->Windowed) {
DEVMODEW devmode;
HDC hdc;
......@@ -1395,15 +1382,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
memset(&devmode, 0, sizeof(DEVMODEW));
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
devmode.dmBitsPerPel = (bpp >= 24) ? 32 : bpp; /* Stupid XVidMode cannot change bpp */
devmode.dmPelsWidth = *(pPresentationParameters->BackBufferWidth);
devmode.dmPelsHeight = *(pPresentationParameters->BackBufferHeight);
devmode.dmPelsWidth = pPresentationParameters->BackBufferWidth;
devmode.dmPelsHeight = pPresentationParameters->BackBufferHeight;
MultiByteToWideChar(CP_ACP, 0, "Gamers CG", -1, devmode.dmDeviceName, CCHDEVICENAME);
ChangeDisplaySettingsExW(devmode.dmDeviceName, &devmode, object->win_handle, CDS_FULLSCREEN, NULL);
/* For GetDisplayMode */
This->ddraw_width = devmode.dmPelsWidth;
This->ddraw_height = devmode.dmPelsHeight;
This->ddraw_format = *(pPresentationParameters->BackBufferFormat);
This->ddraw_format = pPresentationParameters->BackBufferFormat;
IWineD3DDevice_SetFullscreen(iface, TRUE);
......@@ -1459,7 +1446,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
}
/* Under directX swapchains share the depth stencil, so only create one depth-stencil */
if (*(pPresentationParameters->EnableAutoDepthStencil) && hr == WINED3D_OK) {
if (pPresentationParameters->EnableAutoDepthStencil && hr == WINED3D_OK) {
TRACE("Creating depth stencil buffer\n");
if (This->depthStencilBuffer == NULL ) {
hr = D3DCB_CreateDepthStencil((IUnknown *) This->parent,
......@@ -1727,8 +1714,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
WINED3DVIEWPORT vp;
vp.X = 0;
vp.Y = 0;
vp.Width = *(pPresentationParameters->BackBufferWidth);
vp.Height = *(pPresentationParameters->BackBufferHeight);
vp.Width = pPresentationParameters->BackBufferWidth;
vp.Height = pPresentationParameters->BackBufferHeight;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
IWineD3DDevice_SetViewport((IWineD3DDevice *)This, &vp);
......@@ -5344,15 +5331,15 @@ void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, WINED3DPRESENT_PARAMETERS*
surface->resource.allocatedMemory = NULL;
surface->Flags &= ~SFLAG_DIBSECTION;
}
surface->currentDesc.Width = *pPresentationParameters->BackBufferWidth;
surface->currentDesc.Height = *pPresentationParameters->BackBufferHeight;
surface->currentDesc.Width = pPresentationParameters->BackBufferWidth;
surface->currentDesc.Height = pPresentationParameters->BackBufferHeight;
if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO)) {
surface->pow2Width = *pPresentationParameters->BackBufferWidth;
surface->pow2Height = *pPresentationParameters->BackBufferHeight;
surface->pow2Width = pPresentationParameters->BackBufferWidth;
surface->pow2Height = pPresentationParameters->BackBufferHeight;
} else {
surface->pow2Width = surface->pow2Height = 1;
while (surface->pow2Width < *pPresentationParameters->BackBufferWidth) surface->pow2Width <<= 1;
while (surface->pow2Height < *pPresentationParameters->BackBufferHeight) surface->pow2Height <<= 1;
while (surface->pow2Width < pPresentationParameters->BackBufferWidth) surface->pow2Width <<= 1;
while (surface->pow2Height < pPresentationParameters->BackBufferHeight) surface->pow2Height <<= 1;
}
if(surface->glDescription.textureName) {
ENTER_GL();
......@@ -5360,8 +5347,8 @@ void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, WINED3DPRESENT_PARAMETERS*
LEAVE_GL();
surface->glDescription.textureName = 0;
}
if(surface->pow2Width != *pPresentationParameters->BackBufferWidth ||
surface->pow2Height != *pPresentationParameters->BackBufferHeight) {
if(surface->pow2Width != pPresentationParameters->BackBufferWidth ||
surface->pow2Height != pPresentationParameters->BackBufferHeight) {
surface->Flags |= SFLAG_NONPOW2;
} else {
surface->Flags &= ~SFLAG_NONPOW2;
......@@ -5392,75 +5379,75 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
* TODO: Figure out what happens to explicit swapchains, or if we have more than one implicit swapchain
*/
TRACE("New params:\n");
TRACE("BackBufferWidth = %d\n", *pPresentationParameters->BackBufferWidth);
TRACE("BackBufferHeight = %d\n", *pPresentationParameters->BackBufferHeight);
TRACE("BackBufferFormat = %s\n", debug_d3dformat(*pPresentationParameters->BackBufferFormat));
TRACE("BackBufferCount = %d\n", *pPresentationParameters->BackBufferCount);
TRACE("MultiSampleType = %d\n", *pPresentationParameters->MultiSampleType);
TRACE("MultiSampleQuality = %d\n", *pPresentationParameters->MultiSampleQuality);
TRACE("SwapEffect = %d\n", *pPresentationParameters->SwapEffect);
TRACE("hDeviceWindow = %p\n", *pPresentationParameters->hDeviceWindow);
TRACE("Windowed = %s\n", *pPresentationParameters->Windowed ? "true" : "false");
TRACE("EnableAutoDepthStencil = %s\n", *pPresentationParameters->EnableAutoDepthStencil ? "true" : "false");
TRACE("Flags = %08x\n", *pPresentationParameters->Flags);
TRACE("FullScreen_RefreshRateInHz = %d\n", *pPresentationParameters->FullScreen_RefreshRateInHz);
TRACE("PresentationInterval = %d\n", *pPresentationParameters->PresentationInterval);
TRACE("BackBufferWidth = %d\n", pPresentationParameters->BackBufferWidth);
TRACE("BackBufferHeight = %d\n", pPresentationParameters->BackBufferHeight);
TRACE("BackBufferFormat = %s\n", debug_d3dformat(pPresentationParameters->BackBufferFormat));
TRACE("BackBufferCount = %d\n", pPresentationParameters->BackBufferCount);
TRACE("MultiSampleType = %d\n", pPresentationParameters->MultiSampleType);
TRACE("MultiSampleQuality = %d\n", pPresentationParameters->MultiSampleQuality);
TRACE("SwapEffect = %d\n", pPresentationParameters->SwapEffect);
TRACE("hDeviceWindow = %p\n", pPresentationParameters->hDeviceWindow);
TRACE("Windowed = %s\n", pPresentationParameters->Windowed ? "true" : "false");
TRACE("EnableAutoDepthStencil = %s\n", pPresentationParameters->EnableAutoDepthStencil ? "true" : "false");
TRACE("Flags = %08x\n", pPresentationParameters->Flags);
TRACE("FullScreen_RefreshRateInHz = %d\n", pPresentationParameters->FullScreen_RefreshRateInHz);
TRACE("PresentationInterval = %d\n", pPresentationParameters->PresentationInterval);
/* No special treatment of these parameters. Just store them */
swapchain->presentParms.SwapEffect = *pPresentationParameters->SwapEffect;
swapchain->presentParms.Flags = *pPresentationParameters->Flags;
swapchain->presentParms.PresentationInterval = *pPresentationParameters->PresentationInterval;
swapchain->presentParms.FullScreen_RefreshRateInHz = *pPresentationParameters->FullScreen_RefreshRateInHz;
swapchain->presentParms.SwapEffect = pPresentationParameters->SwapEffect;
swapchain->presentParms.Flags = pPresentationParameters->Flags;
swapchain->presentParms.PresentationInterval = pPresentationParameters->PresentationInterval;
swapchain->presentParms.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
/* What to do about these? */
if(*pPresentationParameters->BackBufferCount != 0 &&
*pPresentationParameters->BackBufferCount != swapchain->presentParms.BackBufferCount) {
if(pPresentationParameters->BackBufferCount != 0 &&
pPresentationParameters->BackBufferCount != swapchain->presentParms.BackBufferCount) {
ERR("Cannot change the back buffer count yet\n");
}
if(*pPresentationParameters->BackBufferFormat != WINED3DFMT_UNKNOWN &&
*pPresentationParameters->BackBufferFormat != swapchain->presentParms.BackBufferFormat) {
if(pPresentationParameters->BackBufferFormat != WINED3DFMT_UNKNOWN &&
pPresentationParameters->BackBufferFormat != swapchain->presentParms.BackBufferFormat) {
ERR("Cannot change the back buffer format yet\n");
}
if(*pPresentationParameters->hDeviceWindow != NULL &&
*pPresentationParameters->hDeviceWindow != swapchain->presentParms.hDeviceWindow) {
if(pPresentationParameters->hDeviceWindow != NULL &&
pPresentationParameters->hDeviceWindow != swapchain->presentParms.hDeviceWindow) {
ERR("Cannot change the device window yet\n");
}
if(*pPresentationParameters->EnableAutoDepthStencil != swapchain->presentParms.EnableAutoDepthStencil) {
if(pPresentationParameters->EnableAutoDepthStencil != swapchain->presentParms.EnableAutoDepthStencil) {
ERR("What do do about a changed auto depth stencil parameter?\n");
}
if(*pPresentationParameters->Windowed) {
if(pPresentationParameters->Windowed) {
mode.Width = swapchain->orig_width;
mode.Height = swapchain->orig_height;
mode.RefreshRate = 0;
mode.Format = swapchain->presentParms.BackBufferFormat;
} else {
mode.Width = *pPresentationParameters->BackBufferWidth;
mode.Height = *pPresentationParameters->BackBufferHeight;
mode.RefreshRate = *pPresentationParameters->FullScreen_RefreshRateInHz;
mode.Width = pPresentationParameters->BackBufferWidth;
mode.Height = pPresentationParameters->BackBufferHeight;
mode.RefreshRate = pPresentationParameters->FullScreen_RefreshRateInHz;
mode.Format = swapchain->presentParms.BackBufferFormat;
}
/* Should Width == 800 && Height == 0 set 800x600? */
if(*pPresentationParameters->BackBufferWidth != 0 && *pPresentationParameters->BackBufferHeight != 0 &&
(*pPresentationParameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth ||
*pPresentationParameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight))
if(pPresentationParameters->BackBufferWidth != 0 && pPresentationParameters->BackBufferHeight != 0 &&
(pPresentationParameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth ||
pPresentationParameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight))
{
WINED3DVIEWPORT vp;
int i;
vp.X = 0;
vp.Y = 0;
vp.Width = *pPresentationParameters->BackBufferWidth;
vp.Height = *pPresentationParameters->BackBufferHeight;
vp.Width = pPresentationParameters->BackBufferWidth;
vp.Height = pPresentationParameters->BackBufferHeight;
vp.MinZ = 0;
vp.MaxZ = 1;
if(!*pPresentationParameters->Windowed) {
if(!pPresentationParameters->Windowed) {
DisplayModeChanged = TRUE;
}
swapchain->presentParms.BackBufferWidth = *pPresentationParameters->BackBufferWidth;
swapchain->presentParms.BackBufferHeight = *pPresentationParameters->BackBufferHeight;
swapchain->presentParms.BackBufferWidth = pPresentationParameters->BackBufferWidth;
swapchain->presentParms.BackBufferHeight = pPresentationParameters->BackBufferHeight;
updateSurfaceDesc((IWineD3DSurfaceImpl *)swapchain->frontBuffer, pPresentationParameters);
for(i = 0; i < swapchain->presentParms.BackBufferCount; i++) {
......@@ -5471,22 +5458,22 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE
IWineD3DDevice_SetViewport(iface, &vp);
}
if((*pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) ||
(swapchain->presentParms.Windowed && !*pPresentationParameters->Windowed) ||
if((pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) ||
(swapchain->presentParms.Windowed && !pPresentationParameters->Windowed) ||
DisplayModeChanged) {
/* Switching to fullscreen? Change to fullscreen mode, THEN change the screen res */
if(!(*pPresentationParameters->Windowed)) {
if(!pPresentationParameters->Windowed) {
IWineD3DDevice_SetFullscreen(iface, TRUE);
}
IWineD3DDevice_SetDisplayMode(iface, 0, &mode);
/* Switching out of fullscreen mode? First set the original res, then change the window */
if(*pPresentationParameters->Windowed) {
if(pPresentationParameters->Windowed) {
IWineD3DDevice_SetFullscreen(iface, FALSE);
}
swapchain->presentParms.Windowed = *pPresentationParameters->Windowed;
swapchain->presentParms.Windowed = pPresentationParameters->Windowed;
}
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
......
......@@ -456,19 +456,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_GetDevice(IWineD3DSwapChain *iface,
static HRESULT WINAPI IWineD3DSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, WINED3DPRESENT_PARAMETERS *pPresentationParameters) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
TRACE("(%p)\n", This);
*pPresentationParameters->BackBufferWidth = This->presentParms.BackBufferWidth;
*pPresentationParameters->BackBufferHeight = This->presentParms.BackBufferHeight;
*pPresentationParameters->BackBufferFormat = This->presentParms.BackBufferFormat;
*pPresentationParameters->BackBufferCount = This->presentParms.BackBufferCount;
*pPresentationParameters->MultiSampleType = This->presentParms.MultiSampleType;
*pPresentationParameters->MultiSampleQuality = This->presentParms.MultiSampleQuality;
*pPresentationParameters->SwapEffect = This->presentParms.SwapEffect;
*pPresentationParameters->hDeviceWindow = This->presentParms.hDeviceWindow;
*pPresentationParameters->Windowed = This->presentParms.Windowed;
*pPresentationParameters->EnableAutoDepthStencil = This->presentParms.EnableAutoDepthStencil;
*pPresentationParameters->Flags = This->presentParms.Flags;
*pPresentationParameters->FullScreen_RefreshRateInHz = This->presentParms.FullScreen_RefreshRateInHz;
*pPresentationParameters->PresentationInterval = This->presentParms.PresentationInterval;
*pPresentationParameters = This->presentParms;
return WINED3D_OK;
}
......
......@@ -1316,7 +1316,7 @@ typedef struct IWineD3DSwapChainImpl
IWineD3DSurface **backBuffer;
IWineD3DSurface *frontBuffer;
BOOL wantsDepthStencilBuffer;
D3DPRESENT_PARAMETERS presentParms;
WINED3DPRESENT_PARAMETERS presentParms;
DWORD orig_width, orig_height;
WINED3DFORMAT orig_fmt;
......
......@@ -861,20 +861,20 @@ typedef struct _WINED3DADAPTER_IDENTIFIER {
} WINED3DADAPTER_IDENTIFIER;
typedef struct _WINED3DPRESENT_PARAMETERS {
UINT *BackBufferWidth;
UINT *BackBufferHeight;
WINED3DFORMAT *BackBufferFormat;
UINT *BackBufferCount;
WINED3DMULTISAMPLE_TYPE *MultiSampleType;
DWORD *MultiSampleQuality;
WINED3DSWAPEFFECT *SwapEffect;
HWND *hDeviceWindow;
BOOL *Windowed;
BOOL *EnableAutoDepthStencil;
WINED3DFORMAT *AutoDepthStencilFormat;
DWORD *Flags;
UINT *FullScreen_RefreshRateInHz;
UINT *PresentationInterval;
UINT BackBufferWidth;
UINT BackBufferHeight;
WINED3DFORMAT BackBufferFormat;
UINT BackBufferCount;
WINED3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
WINED3DSWAPEFFECT SwapEffect;
HWND hDeviceWindow;
BOOL Windowed;
BOOL EnableAutoDepthStencil;
WINED3DFORMAT AutoDepthStencilFormat;
DWORD Flags;
UINT FullScreen_RefreshRateInHz;
UINT PresentationInterval;
} WINED3DPRESENT_PARAMETERS;
typedef enum _WINED3DRESOURCETYPE {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment