Commit 94c9b0b4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the WINED3DPRESENT_PARAMETERS typedef.

parent a51b03f1
......@@ -1513,13 +1513,13 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
{
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
IWineDXGIDevice *wine_device;
HRESULT hr;
TRACE("device_parent %p, present_parameters %p, swapchain %p\n", device_parent, present_parameters, swapchain);
TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
(void **)&wine_device);
......@@ -1529,7 +1529,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
return E_FAIL;
}
hr = IWineDXGIDevice_create_swapchain(wine_device, present_parameters, swapchain);
hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
IWineDXGIDevice_Release(wine_device);
if (FAILED(hr))
{
......
......@@ -151,47 +151,47 @@ static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops =
HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device,
D3DPRESENT_PARAMETERS *present_parameters)
{
WINED3DPRESENT_PARAMETERS wined3d_parameters;
struct wined3d_swapchain_desc desc;
HRESULT hr;
swapchain->ref = 1;
swapchain->IDirect3DSwapChain8_iface.lpVtbl = &Direct3DSwapChain8_Vtbl;
wined3d_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
wined3d_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
wined3d_parameters.BackBufferFormat = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
wined3d_parameters.BackBufferCount = max(1, present_parameters->BackBufferCount);
wined3d_parameters.MultiSampleType = present_parameters->MultiSampleType;
wined3d_parameters.MultiSampleQuality = 0; /* d3d9 only */
wined3d_parameters.SwapEffect = present_parameters->SwapEffect;
wined3d_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
wined3d_parameters.Windowed = present_parameters->Windowed;
wined3d_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
wined3d_parameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
wined3d_parameters.Flags = present_parameters->Flags;
wined3d_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
wined3d_parameters.PresentationInterval = present_parameters->FullScreen_PresentationInterval;
wined3d_parameters.AutoRestoreDisplayMode = TRUE;
desc.backbuffer_width = present_parameters->BackBufferWidth;
desc.backbuffer_height = present_parameters->BackBufferHeight;
desc.backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
desc.backbuffer_count = max(1, present_parameters->BackBufferCount);
desc.multisample_type = present_parameters->MultiSampleType;
desc.multisample_quality = 0; /* d3d9 only */
desc.swap_effect = present_parameters->SwapEffect;
desc.device_window = present_parameters->hDeviceWindow;
desc.windowed = present_parameters->Windowed;
desc.enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
desc.flags = present_parameters->Flags;
desc.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
desc.swap_interval = present_parameters->FullScreen_PresentationInterval;
desc.auto_restore_display_mode = TRUE;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, &wined3d_parameters,
hr = wined3d_swapchain_create(device->wined3d_device, &desc,
SURFACE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = wined3d_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters.BackBufferFormat);
present_parameters->BackBufferCount = wined3d_parameters.BackBufferCount;
present_parameters->MultiSampleType = wined3d_parameters.MultiSampleType;
present_parameters->SwapEffect = wined3d_parameters.SwapEffect;
present_parameters->hDeviceWindow = wined3d_parameters.hDeviceWindow;
present_parameters->Windowed = wined3d_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = wined3d_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(wined3d_parameters.AutoDepthStencilFormat);
present_parameters->Flags = wined3d_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = wined3d_parameters.FullScreen_RefreshRateInHz;
present_parameters->FullScreen_PresentationInterval = wined3d_parameters.PresentationInterval;
present_parameters->BackBufferWidth = desc.backbuffer_width;
present_parameters->BackBufferHeight = desc.backbuffer_height;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(desc.backbuffer_format);
present_parameters->BackBufferCount = desc.backbuffer_count;
present_parameters->MultiSampleType = desc.multisample_type;
present_parameters->SwapEffect = desc.swap_effect;
present_parameters->hDeviceWindow = desc.device_window;
present_parameters->Windowed = desc.windowed;
present_parameters->EnableAutoDepthStencil = desc.enable_auto_depth_stencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc.auto_depth_stencil_format);
present_parameters->Flags = desc.flags;
present_parameters->FullScreen_RefreshRateInHz = desc.refresh_rate;
present_parameters->FullScreen_PresentationInterval = desc.swap_interval;
if (FAILED(hr))
{
......
......@@ -181,31 +181,33 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDevice(IDirect3DSwapChain9 *ifa
return D3D_OK;
}
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWAPCHAIN9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(IDirect3DSwapChain9 *iface,
D3DPRESENT_PARAMETERS *pPresentationParameters)
{
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
WINED3DPRESENT_PARAMETERS winePresentParameters;
struct wined3d_swapchain_desc desc;
HRESULT hr;
TRACE("iface %p, parameters %p.\n", iface, pPresentationParameters);
wined3d_mutex_lock();
hr = wined3d_swapchain_get_present_parameters(This->wined3d_swapchain, &winePresentParameters);
hr = wined3d_swapchain_get_desc(This->wined3d_swapchain, &desc);
wined3d_mutex_unlock();
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = winePresentParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = d3dformat_from_wined3dformat(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->AutoDepthStencilFormat = d3dformat_from_wined3dformat(winePresentParameters.AutoDepthStencilFormat);
pPresentationParameters->Flags = winePresentParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = winePresentParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = winePresentParameters.PresentationInterval;
pPresentationParameters->BackBufferWidth = desc.backbuffer_width;
pPresentationParameters->BackBufferHeight = desc.backbuffer_height;
pPresentationParameters->BackBufferFormat = d3dformat_from_wined3dformat(desc.backbuffer_format);
pPresentationParameters->BackBufferCount = desc.backbuffer_count;
pPresentationParameters->MultiSampleType = desc.multisample_type;
pPresentationParameters->MultiSampleQuality = desc.multisample_quality;
pPresentationParameters->SwapEffect = desc.swap_effect;
pPresentationParameters->hDeviceWindow = desc.device_window;
pPresentationParameters->Windowed = desc.windowed;
pPresentationParameters->EnableAutoDepthStencil = desc.enable_auto_depth_stencil;
pPresentationParameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc.auto_depth_stencil_format);
pPresentationParameters->Flags = desc.flags;
pPresentationParameters->FullScreen_RefreshRateInHz = desc.refresh_rate;
pPresentationParameters->PresentationInterval = desc.swap_interval;
return hr;
}
......@@ -238,48 +240,48 @@ static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops =
HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device,
D3DPRESENT_PARAMETERS *present_parameters)
{
WINED3DPRESENT_PARAMETERS wined3d_parameters;
struct wined3d_swapchain_desc desc;
HRESULT hr;
swapchain->ref = 1;
swapchain->lpVtbl = &Direct3DSwapChain9_Vtbl;
wined3d_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
wined3d_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
wined3d_parameters.BackBufferFormat = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
wined3d_parameters.BackBufferCount = max(1, present_parameters->BackBufferCount);
wined3d_parameters.MultiSampleType = present_parameters->MultiSampleType;
wined3d_parameters.MultiSampleQuality = present_parameters->MultiSampleQuality;
wined3d_parameters.SwapEffect = present_parameters->SwapEffect;
wined3d_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
wined3d_parameters.Windowed = present_parameters->Windowed;
wined3d_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
wined3d_parameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
wined3d_parameters.Flags = present_parameters->Flags;
wined3d_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
wined3d_parameters.PresentationInterval = present_parameters->PresentationInterval;
wined3d_parameters.AutoRestoreDisplayMode = TRUE;
desc.backbuffer_width = present_parameters->BackBufferWidth;
desc.backbuffer_height = present_parameters->BackBufferHeight;
desc.backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
desc.backbuffer_count = max(1, present_parameters->BackBufferCount);
desc.multisample_type = present_parameters->MultiSampleType;
desc.multisample_quality = present_parameters->MultiSampleQuality;
desc.swap_effect = present_parameters->SwapEffect;
desc.device_window = present_parameters->hDeviceWindow;
desc.windowed = present_parameters->Windowed;
desc.enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
desc.flags = present_parameters->Flags;
desc.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
desc.swap_interval = present_parameters->PresentationInterval;
desc.auto_restore_display_mode = TRUE;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, &wined3d_parameters,
hr = wined3d_swapchain_create(device->wined3d_device, &desc,
SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = wined3d_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters.BackBufferFormat);
present_parameters->BackBufferCount = wined3d_parameters.BackBufferCount;
present_parameters->MultiSampleType = wined3d_parameters.MultiSampleType;
present_parameters->MultiSampleQuality = wined3d_parameters.MultiSampleQuality;
present_parameters->SwapEffect = wined3d_parameters.SwapEffect;
present_parameters->hDeviceWindow = wined3d_parameters.hDeviceWindow;
present_parameters->Windowed = wined3d_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = wined3d_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(wined3d_parameters.AutoDepthStencilFormat);
present_parameters->Flags = wined3d_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = wined3d_parameters.FullScreen_RefreshRateInHz;
present_parameters->PresentationInterval = wined3d_parameters.PresentationInterval;
present_parameters->BackBufferWidth = desc.backbuffer_width;
present_parameters->BackBufferHeight = desc.backbuffer_height;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(desc.backbuffer_format);
present_parameters->BackBufferCount = desc.backbuffer_count;
present_parameters->MultiSampleType = desc.multisample_type;
present_parameters->MultiSampleQuality = desc.multisample_quality;
present_parameters->SwapEffect = desc.swap_effect;
present_parameters->hDeviceWindow = desc.device_window;
present_parameters->Windowed = desc.windowed;
present_parameters->EnableAutoDepthStencil = desc.enable_auto_depth_stencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc.auto_depth_stencil_format);
present_parameters->Flags = desc.flags;
present_parameters->FullScreen_RefreshRateInHz = desc.refresh_rate;
present_parameters->PresentationInterval = desc.swap_interval;
if (FAILED(hr))
{
......
......@@ -617,9 +617,9 @@ static HRESULT ddraw_set_focus_window(IDirectDrawImpl *ddraw, HWND window)
}
static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
WINED3DPRESENT_PARAMETERS *presentation_parameters)
struct wined3d_swapchain_desc *swapchain_desc)
{
HWND window = presentation_parameters->hDeviceWindow;
HWND window = swapchain_desc->device_window;
HRESULT hr;
TRACE("ddraw %p.\n", ddraw);
......@@ -638,7 +638,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
ShowWindow(window, SW_HIDE); /* Just to be sure */
WARN("No window for the Direct3DDevice, created hidden window %p.\n", window);
presentation_parameters->hDeviceWindow = window;
swapchain_desc->device_window = window;
}
else
{
......@@ -649,7 +649,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
/* Set this NOW, otherwise creating the depth stencil surface will cause a
* recursive loop until ram or emulated video memory is full. */
ddraw->d3d_initialized = TRUE;
hr = wined3d_device_init_3d(ddraw->wined3d_device, presentation_parameters);
hr = wined3d_device_init_3d(ddraw->wined3d_device, swapchain_desc);
if (FAILED(hr))
{
ddraw->d3d_initialized = FALSE;
......@@ -673,7 +673,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw,
static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL windowed)
{
WINED3DPRESENT_PARAMETERS presentation_parameters;
struct wined3d_swapchain_desc swapchain_desc;
struct wined3d_display_mode mode;
HRESULT hr = WINED3D_OK;
......@@ -688,18 +688,18 @@ static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, HWND window, BOOL
return hr;
}
memset(&presentation_parameters, 0, sizeof(presentation_parameters));
presentation_parameters.BackBufferWidth = mode.width;
presentation_parameters.BackBufferHeight = mode.height;
presentation_parameters.BackBufferFormat = mode.format_id;
presentation_parameters.SwapEffect = WINED3DSWAPEFFECT_COPY;
presentation_parameters.hDeviceWindow = window;
presentation_parameters.Windowed = windowed;
memset(&swapchain_desc, 0, sizeof(swapchain_desc));
swapchain_desc.backbuffer_width = mode.width;
swapchain_desc.backbuffer_height = mode.height;
swapchain_desc.backbuffer_format = mode.format_id;
swapchain_desc.swap_effect = WINED3DSWAPEFFECT_COPY;
swapchain_desc.device_window = window;
swapchain_desc.windowed = windowed;
if (DefaultSurfaceType == SURFACE_OPENGL)
hr = ddraw_attach_d3d_device(ddraw, &presentation_parameters);
hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc);
else
hr = wined3d_device_init_gdi(ddraw->wined3d_device, &presentation_parameters);
hr = wined3d_device_init_gdi(ddraw->wined3d_device, &swapchain_desc);
if (FAILED(hr))
{
......@@ -2919,21 +2919,21 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
if ((desc2.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && (ddraw->cooperative_level & DDSCL_EXCLUSIVE))
{
WINED3DPRESENT_PARAMETERS presentation_parameters;
struct wined3d_swapchain_desc swapchain_desc;
hr = wined3d_swapchain_get_present_parameters(ddraw->wined3d_swapchain, &presentation_parameters);
hr = wined3d_swapchain_get_desc(ddraw->wined3d_swapchain, &swapchain_desc);
if (FAILED(hr))
{
ERR("Failed to get present parameters.\n");
return hr;
}
presentation_parameters.BackBufferWidth = mode.width;
presentation_parameters.BackBufferHeight = mode.height;
presentation_parameters.BackBufferFormat = mode.format_id;
swapchain_desc.backbuffer_width = mode.width;
swapchain_desc.backbuffer_height = mode.height;
swapchain_desc.backbuffer_format = mode.format_id;
hr = wined3d_device_reset(ddraw->wined3d_device,
&presentation_parameters, ddraw_reset_enum_callback);
&swapchain_desc, ddraw_reset_enum_callback);
if (FAILED(hr))
{
ERR("Failed to reset device.\n");
......@@ -5433,12 +5433,12 @@ static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *d
}
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
{
struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent);
HRESULT hr;
TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain);
TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent, desc, swapchain);
if (ddraw->wined3d_swapchain)
{
......@@ -5446,7 +5446,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
return E_FAIL;
}
hr = wined3d_swapchain_create(ddraw->wined3d_device, present_parameters,
hr = wined3d_swapchain_create(ddraw->wined3d_device, desc,
DefaultSurfaceType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
if (FAILED(hr))
WARN("Failed to create swapchain, hr %#x.\n", hr);
......
......@@ -290,14 +290,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
}
static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **wined3d_swapchain)
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **wined3d_swapchain)
{
struct dxgi_device *This = impl_from_IWineDXGIDevice(iface);
struct dxgi_swapchain *object;
HRESULT hr;
TRACE("iface %p, present_parameters %p, wined3d_swapchain %p.\n",
iface, present_parameters, wined3d_swapchain);
TRACE("iface %p, desc %p, wined3d_swapchain %p.\n",
iface, desc, wined3d_swapchain);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
......@@ -306,7 +306,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *i
return E_OUTOFMEMORY;
}
hr = dxgi_swapchain_init(object, This, present_parameters);
hr = dxgi_swapchain_init(object, This, desc);
if (FAILED(hr))
{
WARN("Failed to initialize swapchain, hr %#x.\n", hr);
......
......@@ -130,7 +130,7 @@ struct dxgi_swapchain
};
HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters) DECLSPEC_HIDDEN;
struct wined3d_swapchain_desc *desc) DECLSPEC_HIDDEN;
/* IDXGISurface */
struct dxgi_surface
......
......@@ -161,13 +161,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IWineDXGIFact
return E_NOTIMPL;
}
/* TODO: The DXGI swapchain desc is a bit nicer than WINED3DPRESENT_PARAMETERS,
* change wined3d to use a structure more similar to DXGI. */
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *iface,
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
{
WINED3DPRESENT_PARAMETERS present_parameters;
struct wined3d_swapchain *wined3d_swapchain;
struct wined3d_swapchain_desc wined3d_desc;
struct wined3d_device *wined3d_device;
IWineDXGIDevice *dxgi_device;
UINT count;
......@@ -200,31 +198,30 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
FIXME("Ignoring SwapEffect and Flags\n");
present_parameters.BackBufferWidth = desc->BufferDesc.Width;
present_parameters.BackBufferHeight = desc->BufferDesc.Height;
present_parameters.BackBufferFormat = wined3dformat_from_dxgi_format(desc->BufferDesc.Format);
present_parameters.BackBufferCount = desc->BufferCount;
wined3d_desc.backbuffer_width = desc->BufferDesc.Width;
wined3d_desc.backbuffer_height = desc->BufferDesc.Height;
wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(desc->BufferDesc.Format);
wined3d_desc.backbuffer_count = desc->BufferCount;
if (desc->SampleDesc.Count > 1)
{
present_parameters.MultiSampleType = desc->SampleDesc.Count;
present_parameters.MultiSampleQuality = desc->SampleDesc.Quality;
wined3d_desc.multisample_type = desc->SampleDesc.Count;
wined3d_desc.multisample_quality = desc->SampleDesc.Quality;
}
else
{
present_parameters.MultiSampleType = WINED3DMULTISAMPLE_NONE;
present_parameters.MultiSampleQuality = 0;
wined3d_desc.multisample_type = WINED3DMULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0;
}
present_parameters.SwapEffect = WINED3DSWAPEFFECT_DISCARD;
present_parameters.hDeviceWindow = desc->OutputWindow;
present_parameters.Windowed = desc->Windowed;
present_parameters.EnableAutoDepthStencil = FALSE;
present_parameters.AutoDepthStencilFormat = 0;
present_parameters.Flags = 0; /* WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL? */
present_parameters.FullScreen_RefreshRateInHz =
desc->BufferDesc.RefreshRate.Numerator / desc->BufferDesc.RefreshRate.Denominator;
present_parameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT;
hr = wined3d_device_init_3d(wined3d_device, &present_parameters);
wined3d_desc.swap_effect = WINED3DSWAPEFFECT_DISCARD;
wined3d_desc.device_window = desc->OutputWindow;
wined3d_desc.windowed = desc->Windowed;
wined3d_desc.enable_auto_depth_stencil = FALSE;
wined3d_desc.auto_depth_stencil_format = 0;
wined3d_desc.flags = 0; /* WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL? */
wined3d_desc.refresh_rate = desc->BufferDesc.RefreshRate.Numerator / desc->BufferDesc.RefreshRate.Denominator;
wined3d_desc.swap_interval = WINED3DPRESENT_INTERVAL_DEFAULT;
hr = wined3d_device_init_3d(wined3d_device, &wined3d_desc);
if (FAILED(hr))
{
WARN("Failed to initialize 3D, returning %#x\n", hr);
......
......@@ -272,14 +272,14 @@ static const struct wined3d_parent_ops dxgi_swapchain_wined3d_parent_ops =
};
HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters)
struct wined3d_swapchain_desc *desc)
{
HRESULT hr;
swapchain->IDXGISwapChain_iface.lpVtbl = &dxgi_swapchain_vtbl;
swapchain->refcount = 1;
hr = wined3d_swapchain_create(device->wined3d_device, present_parameters,
hr = wined3d_swapchain_create(device->wined3d_device, desc,
SURFACE_OPENGL, swapchain, &dxgi_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
if (FAILED(hr))
......
......@@ -1441,7 +1441,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
switch (swapchain->presentParms.PresentationInterval)
switch (swapchain->desc.swap_interval)
{
case WINED3DPRESENT_INTERVAL_IMMEDIATE:
swap_interval = 0;
......@@ -1460,7 +1460,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
swap_interval = 4;
break;
default:
FIXME("Unknown presentation interval %08x\n", swapchain->presentParms.PresentationInterval);
FIXME("Unknown swap interval %#x.\n", swapchain->desc.swap_interval);
swap_interval = 1;
}
......
......@@ -1307,8 +1307,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
/* Set the default viewport */
state->viewport.x = 0;
state->viewport.y = 0;
state->viewport.width = swapchain->presentParms.BackBufferWidth;
state->viewport.height = swapchain->presentParms.BackBufferHeight;
state->viewport.width = swapchain->desc.backbuffer_width;
state->viewport.height = swapchain->desc.backbuffer_height;
state->viewport.min_z = 0.0f;
state->viewport.max_z = 1.0f;
......
......@@ -1694,15 +1694,15 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
&& dst_surface == dst_swapchain->front_buffer
&& src_surface == dst_swapchain->back_buffers[0])
{
WINED3DSWAPEFFECT swap_effect = dst_swapchain->presentParms.SwapEffect;
WINED3DSWAPEFFECT swap_effect = dst_swapchain->desc.swap_effect;
TRACE("Using present for backbuffer -> frontbuffer blit.\n");
/* Set the swap effect to COPY, we don't want the backbuffer
* to become undefined. */
dst_swapchain->presentParms.SwapEffect = WINED3DSWAPEFFECT_COPY;
dst_swapchain->desc.swap_effect = WINED3DSWAPEFFECT_COPY;
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0);
dst_swapchain->presentParms.SwapEffect = swap_effect;
dst_swapchain->desc.swap_effect = swap_effect;
return WINED3D_OK;
}
......@@ -5639,8 +5639,8 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
* buffer, so the onscreen depth/stencil buffer is potentially smaller
* than the offscreen surface. Don't overwrite the offscreen surface
* with undefined data. */
w = min(w, context->swapchain->presentParms.BackBufferWidth);
h = min(h, context->swapchain->presentParms.BackBufferHeight);
w = min(w, context->swapchain->desc.backbuffer_width);
h = min(h, context->swapchain->desc.backbuffer_height);
TRACE("Copying onscreen depth buffer to depth texture.\n");
......
......@@ -239,7 +239,7 @@
@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr)
@ cdecl wined3d_swapchain_get_gamma_ramp(ptr ptr)
@ cdecl wined3d_swapchain_get_parent(ptr)
@ cdecl wined3d_swapchain_get_present_parameters(ptr ptr)
@ cdecl wined3d_swapchain_get_desc(ptr ptr)
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long)
......
......@@ -2442,7 +2442,7 @@ struct wined3d_swapchain
struct wined3d_surface **back_buffers;
struct wined3d_surface *front_buffer;
WINED3DPRESENT_PARAMETERS presentParms;
struct wined3d_swapchain_desc desc;
DWORD orig_width, orig_height;
enum wined3d_format_id orig_fmt;
struct wined3d_gamma_ramp orig_gamma;
......
......@@ -1638,24 +1638,24 @@ struct wined3d_adapter_identifier
SIZE_T video_memory;
};
typedef struct _WINED3DPRESENT_PARAMETERS
{
UINT BackBufferWidth;
UINT BackBufferHeight;
enum wined3d_format_id BackBufferFormat;
UINT BackBufferCount;
WINED3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
WINED3DSWAPEFFECT SwapEffect;
HWND hDeviceWindow;
BOOL Windowed;
BOOL EnableAutoDepthStencil;
enum wined3d_format_id AutoDepthStencilFormat;
DWORD Flags;
UINT FullScreen_RefreshRateInHz;
UINT PresentationInterval;
BOOL AutoRestoreDisplayMode;
} WINED3DPRESENT_PARAMETERS;
struct wined3d_swapchain_desc
{
UINT backbuffer_width;
UINT backbuffer_height;
enum wined3d_format_id backbuffer_format;
UINT backbuffer_count;
WINED3DMULTISAMPLE_TYPE multisample_type;
DWORD multisample_quality;
WINED3DSWAPEFFECT swap_effect;
HWND device_window;
BOOL windowed;
BOOL enable_auto_depth_stencil;
enum wined3d_format_id auto_depth_stencil_format;
DWORD flags;
UINT refresh_rate;
UINT swap_interval;
BOOL auto_restore_display_mode;
};
struct wined3d_resource_desc
{
......@@ -2041,7 +2041,7 @@ struct wined3d_device_parent_ops
UINT width, UINT height, UINT depth, enum wined3d_format_id format_id, WINED3DPOOL pool, DWORD usage,
struct wined3d_volume **volume);
HRESULT (__cdecl *create_swapchain)(struct wined3d_device_parent *device_parent,
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain);
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain);
};
typedef HRESULT (CDECL *wined3d_device_reset_cb)(struct wined3d_resource *resource);
......@@ -2213,8 +2213,8 @@ HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *devi
UINT start_register, int *constants, UINT vector4i_count);
HRESULT __cdecl wined3d_device_get_wined3d(const struct wined3d_device *device, struct wined3d **wined3d);
ULONG __cdecl wined3d_device_incref(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters);
HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters);
HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);
HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);
HRESULT __cdecl wined3d_device_multiply_transform(struct wined3d_device *device,
WINED3DTRANSFORMSTATETYPE state, const struct wined3d_matrix *matrix);
HRESULT __cdecl wined3d_device_present(const struct wined3d_device *device, const RECT *src_rect,
......@@ -2224,7 +2224,7 @@ HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device,
const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf);
void __cdecl wined3d_device_release_focus_window(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device,
const WINED3DPRESENT_PARAMETERS *present_parameters, wined3d_device_reset_cb callback);
const struct wined3d_swapchain_desc *swapchain_desc, wined3d_device_reset_cb callback);
void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window);
HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index);
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane);
......@@ -2395,7 +2395,7 @@ HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *s
DWORD flags, struct wined3d_surface *ref);
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type, void *parent,
struct wined3d_swapchain_desc *desc, WINED3DSURFTYPE surface_type, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
......@@ -2408,8 +2408,8 @@ HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swa
HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
struct wined3d_gamma_ramp *ramp);
void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain,
WINED3DPRESENT_PARAMETERS *present_parameters);
HRESULT __cdecl wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain,
struct wined3d_swapchain_desc *desc);
HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
WINED3DRASTER_STATUS *raster_status);
ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain);
......
......@@ -54,7 +54,7 @@ interface IWineDXGIDevice : IDXGIDevice
[out] void **surface
);
HRESULT create_swapchain(
[in] struct _WINED3DPRESENT_PARAMETERS *present_parameters,
[in] struct wined3d_swapchain_desc *desc,
[out] struct wined3d_swapchain **wined3d_swapchain
);
}
......
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