wined3d: Get rid of the WINED3DPRESENT_PARAMETERS typedef.

This commit is contained in:
Henri Verbeet 2011-12-02 08:15:52 +01:00 committed by Alexandre Julliard
parent a51b03f16e
commit 94c9b0b4fc
19 changed files with 506 additions and 499 deletions

View File

@ -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))
{

View File

@ -561,30 +561,30 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
D3DPRESENT_PARAMETERS *pPresentationParameters)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
WINED3DPRESENT_PARAMETERS localParameters;
struct wined3d_swapchain_desc swapchain_desc;
HRESULT hr;
TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
wined3d_mutex_lock();
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = wined3dformat_from_d3dformat(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 = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
localParameters.AutoRestoreDisplayMode = TRUE;
swapchain_desc.backbuffer_width = pPresentationParameters->BackBufferWidth;
swapchain_desc.backbuffer_height = pPresentationParameters->BackBufferHeight;
swapchain_desc.backbuffer_format = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat);
swapchain_desc.backbuffer_count = pPresentationParameters->BackBufferCount;
swapchain_desc.multisample_type = pPresentationParameters->MultiSampleType;
swapchain_desc.multisample_quality = 0; /* d3d9 only */
swapchain_desc.swap_effect = pPresentationParameters->SwapEffect;
swapchain_desc.device_window = pPresentationParameters->hDeviceWindow;
swapchain_desc.windowed = pPresentationParameters->Windowed;
swapchain_desc.enable_auto_depth_stencil = pPresentationParameters->EnableAutoDepthStencil;
swapchain_desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
swapchain_desc.flags = pPresentationParameters->Flags;
swapchain_desc.refresh_rate = pPresentationParameters->FullScreen_RefreshRateInHz;
swapchain_desc.swap_interval = pPresentationParameters->FullScreen_PresentationInterval;
swapchain_desc.auto_restore_display_mode = TRUE;
hr = wined3d_device_reset(This->wined3d_device, &localParameters, reset_enum_callback);
hr = wined3d_device_reset(This->wined3d_device, &swapchain_desc, reset_enum_callback);
if (SUCCEEDED(hr))
{
hr = wined3d_device_set_render_state(This->wined3d_device, WINED3DRS_POINTSIZE_MIN, 0);
@ -2946,29 +2946,29 @@ 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)
{
IDirect3DDevice8Impl *device = device_from_device_parent(device_parent);
D3DPRESENT_PARAMETERS local_parameters;
IDirect3DSwapChain8 *d3d_swapchain;
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);
/* Copy the presentation parameters */
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
local_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
local_parameters.BackBufferFormat = d3dformat_from_wined3dformat(present_parameters->BackBufferFormat);
local_parameters.BackBufferCount = present_parameters->BackBufferCount;
local_parameters.MultiSampleType = present_parameters->MultiSampleType;
local_parameters.SwapEffect = present_parameters->SwapEffect;
local_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
local_parameters.Windowed = present_parameters->Windowed;
local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
local_parameters.AutoDepthStencilFormat = d3dformat_from_wined3dformat(present_parameters->AutoDepthStencilFormat);
local_parameters.Flags = present_parameters->Flags;
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
local_parameters.BackBufferWidth = desc->backbuffer_width;
local_parameters.BackBufferHeight = desc->backbuffer_height;
local_parameters.BackBufferFormat = d3dformat_from_wined3dformat(desc->backbuffer_format);
local_parameters.BackBufferCount = desc->backbuffer_count;
local_parameters.MultiSampleType = desc->multisample_type;
local_parameters.SwapEffect = desc->swap_effect;
local_parameters.hDeviceWindow = desc->device_window;
local_parameters.Windowed = desc->windowed;
local_parameters.EnableAutoDepthStencil = desc->enable_auto_depth_stencil;
local_parameters.AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc->auto_depth_stencil_format);
local_parameters.Flags = desc->flags;
local_parameters.FullScreen_RefreshRateInHz = desc->refresh_rate;
local_parameters.FullScreen_PresentationInterval = desc->swap_interval;
hr = IDirect3DDevice8_CreateAdditionalSwapChain(&device->IDirect3DDevice8_iface,
&local_parameters, &d3d_swapchain);
@ -2984,19 +2984,19 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
IDirect3DSwapChain8_Release(d3d_swapchain);
/* Copy back the presentation parameters */
present_parameters->BackBufferWidth = local_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = local_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = wined3dformat_from_d3dformat(local_parameters.BackBufferFormat);
present_parameters->BackBufferCount = local_parameters.BackBufferCount;
present_parameters->MultiSampleType = local_parameters.MultiSampleType;
present_parameters->SwapEffect = local_parameters.SwapEffect;
present_parameters->hDeviceWindow = local_parameters.hDeviceWindow;
present_parameters->Windowed = local_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = wined3dformat_from_d3dformat(local_parameters.AutoDepthStencilFormat);
present_parameters->Flags = local_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz;
present_parameters->PresentationInterval = local_parameters.FullScreen_PresentationInterval;
desc->backbuffer_width = local_parameters.BackBufferWidth;
desc->backbuffer_height = local_parameters.BackBufferHeight;
desc->backbuffer_format = wined3dformat_from_d3dformat(local_parameters.BackBufferFormat);
desc->backbuffer_count = local_parameters.BackBufferCount;
desc->multisample_type = local_parameters.MultiSampleType;
desc->swap_effect = local_parameters.SwapEffect;
desc->device_window = local_parameters.hDeviceWindow;
desc->windowed = local_parameters.Windowed;
desc->enable_auto_depth_stencil = local_parameters.EnableAutoDepthStencil;
desc->auto_depth_stencil_format = wined3dformat_from_d3dformat(local_parameters.AutoDepthStencilFormat);
desc->flags = local_parameters.Flags;
desc->refresh_rate = local_parameters.FullScreen_RefreshRateInHz;
desc->swap_interval = local_parameters.FullScreen_PresentationInterval;
return hr;
}
@ -3032,7 +3032,7 @@ static void setup_fpu(void)
HRESULT device_init(IDirect3DDevice8Impl *device, IDirect3D8Impl *parent, struct wined3d *wined3d, UINT adapter,
D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters)
{
WINED3DPRESENT_PARAMETERS wined3d_parameters;
struct wined3d_swapchain_desc swapchain_desc;
HRESULT hr;
device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl;
@ -3085,23 +3085,23 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IDirect3D8Impl *parent, struct
if (flags & D3DCREATE_MULTITHREADED)
wined3d_device_set_multithreaded(device->wined3d_device);
wined3d_parameters.BackBufferWidth = parameters->BackBufferWidth;
wined3d_parameters.BackBufferHeight = parameters->BackBufferHeight;
wined3d_parameters.BackBufferFormat = wined3dformat_from_d3dformat(parameters->BackBufferFormat);
wined3d_parameters.BackBufferCount = parameters->BackBufferCount;
wined3d_parameters.MultiSampleType = parameters->MultiSampleType;
wined3d_parameters.MultiSampleQuality = 0; /* d3d9 only */
wined3d_parameters.SwapEffect = parameters->SwapEffect;
wined3d_parameters.hDeviceWindow = parameters->hDeviceWindow;
wined3d_parameters.Windowed = parameters->Windowed;
wined3d_parameters.EnableAutoDepthStencil = parameters->EnableAutoDepthStencil;
wined3d_parameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(parameters->AutoDepthStencilFormat);
wined3d_parameters.Flags = parameters->Flags;
wined3d_parameters.FullScreen_RefreshRateInHz = parameters->FullScreen_RefreshRateInHz;
wined3d_parameters.PresentationInterval = parameters->FullScreen_PresentationInterval;
wined3d_parameters.AutoRestoreDisplayMode = TRUE;
swapchain_desc.backbuffer_width = parameters->BackBufferWidth;
swapchain_desc.backbuffer_height = parameters->BackBufferHeight;
swapchain_desc.backbuffer_format = wined3dformat_from_d3dformat(parameters->BackBufferFormat);
swapchain_desc.backbuffer_count = parameters->BackBufferCount;
swapchain_desc.multisample_type = parameters->MultiSampleType;
swapchain_desc.multisample_quality = 0; /* d3d9 only */
swapchain_desc.swap_effect = parameters->SwapEffect;
swapchain_desc.device_window = parameters->hDeviceWindow;
swapchain_desc.windowed = parameters->Windowed;
swapchain_desc.enable_auto_depth_stencil = parameters->EnableAutoDepthStencil;
swapchain_desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(parameters->AutoDepthStencilFormat);
swapchain_desc.flags = parameters->Flags;
swapchain_desc.refresh_rate = parameters->FullScreen_RefreshRateInHz;
swapchain_desc.swap_interval = parameters->FullScreen_PresentationInterval;
swapchain_desc.auto_restore_display_mode = TRUE;
hr = wined3d_device_init_3d(device->wined3d_device, &wined3d_parameters);
hr = wined3d_device_init_3d(device->wined3d_device, &swapchain_desc);
if (FAILED(hr))
{
WARN("Failed to initialize 3D, hr %#x.\n", hr);
@ -3120,19 +3120,19 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IDirect3D8Impl *parent, struct
goto err;
}
parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
parameters->BackBufferHeight = wined3d_parameters.BackBufferHeight;
parameters->BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters.BackBufferFormat);
parameters->BackBufferCount = wined3d_parameters.BackBufferCount;
parameters->MultiSampleType = wined3d_parameters.MultiSampleType;
parameters->SwapEffect = wined3d_parameters.SwapEffect;
parameters->hDeviceWindow = wined3d_parameters.hDeviceWindow;
parameters->Windowed = wined3d_parameters.Windowed;
parameters->EnableAutoDepthStencil = wined3d_parameters.EnableAutoDepthStencil;
parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(wined3d_parameters.AutoDepthStencilFormat);
parameters->Flags = wined3d_parameters.Flags;
parameters->FullScreen_RefreshRateInHz = wined3d_parameters.FullScreen_RefreshRateInHz;
parameters->FullScreen_PresentationInterval = wined3d_parameters.PresentationInterval;
parameters->BackBufferWidth = swapchain_desc.backbuffer_width;
parameters->BackBufferHeight = swapchain_desc.backbuffer_height;
parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc.backbuffer_format);
parameters->BackBufferCount = swapchain_desc.backbuffer_count;
parameters->MultiSampleType = swapchain_desc.multisample_type;
parameters->SwapEffect = swapchain_desc.swap_effect;
parameters->hDeviceWindow = swapchain_desc.device_window;
parameters->Windowed = swapchain_desc.windowed;
parameters->EnableAutoDepthStencil = swapchain_desc.enable_auto_depth_stencil;
parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(swapchain_desc.auto_depth_stencil_format);
parameters->Flags = swapchain_desc.flags;
parameters->FullScreen_RefreshRateInHz = swapchain_desc.refresh_rate;
parameters->FullScreen_PresentationInterval = swapchain_desc.swap_interval;
device->declArraySize = 16;
device->decls = HeapAlloc(GetProcessHeap(), 0, device->declArraySize * sizeof(*device->decls));

View File

@ -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))
{

View File

@ -549,7 +549,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
D3DPRESENT_PARAMETERS *pPresentationParameters)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
WINED3DPRESENT_PARAMETERS localParameters;
struct wined3d_swapchain_desc swapchain_desc;
HRESULT hr;
TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
@ -564,23 +564,23 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
*/
wined3d_mutex_lock();
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = wined3dformat_from_d3dformat(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 = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
localParameters.AutoRestoreDisplayMode = TRUE;
swapchain_desc.backbuffer_width = pPresentationParameters->BackBufferWidth;
swapchain_desc.backbuffer_height = pPresentationParameters->BackBufferHeight;
swapchain_desc.backbuffer_format = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat);
swapchain_desc.backbuffer_count = pPresentationParameters->BackBufferCount;
swapchain_desc.multisample_type = pPresentationParameters->MultiSampleType;
swapchain_desc.multisample_quality = pPresentationParameters->MultiSampleQuality;
swapchain_desc.swap_effect = pPresentationParameters->SwapEffect;
swapchain_desc.device_window = pPresentationParameters->hDeviceWindow;
swapchain_desc.windowed = pPresentationParameters->Windowed;
swapchain_desc.enable_auto_depth_stencil = pPresentationParameters->EnableAutoDepthStencil;
swapchain_desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
swapchain_desc.flags = pPresentationParameters->Flags;
swapchain_desc.refresh_rate = pPresentationParameters->FullScreen_RefreshRateInHz;
swapchain_desc.swap_interval = pPresentationParameters->PresentationInterval;
swapchain_desc.auto_restore_display_mode = TRUE;
hr = wined3d_device_reset(This->wined3d_device, &localParameters, reset_enum_callback);
hr = wined3d_device_reset(This->wined3d_device, &swapchain_desc, reset_enum_callback);
if (FAILED(hr))
This->notreset = TRUE;
else
@ -3243,30 +3243,30 @@ 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 IDirect3DDevice9Impl *device = device_from_device_parent(device_parent);
D3DPRESENT_PARAMETERS local_parameters;
IDirect3DSwapChain9 *d3d_swapchain;
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);
/* Copy the presentation parameters */
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
local_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
local_parameters.BackBufferFormat = d3dformat_from_wined3dformat(present_parameters->BackBufferFormat);
local_parameters.BackBufferCount = present_parameters->BackBufferCount;
local_parameters.MultiSampleType = present_parameters->MultiSampleType;
local_parameters.MultiSampleQuality = present_parameters->MultiSampleQuality;
local_parameters.SwapEffect = present_parameters->SwapEffect;
local_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
local_parameters.Windowed = present_parameters->Windowed;
local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
local_parameters.AutoDepthStencilFormat = d3dformat_from_wined3dformat(present_parameters->AutoDepthStencilFormat);
local_parameters.Flags = present_parameters->Flags;
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
local_parameters.PresentationInterval = present_parameters->PresentationInterval;
local_parameters.BackBufferWidth = desc->backbuffer_width;
local_parameters.BackBufferHeight = desc->backbuffer_height;
local_parameters.BackBufferFormat = d3dformat_from_wined3dformat(desc->backbuffer_format);
local_parameters.BackBufferCount = desc->backbuffer_count;
local_parameters.MultiSampleType = desc->multisample_type;
local_parameters.MultiSampleQuality = desc->multisample_quality;
local_parameters.SwapEffect = desc->swap_effect;
local_parameters.hDeviceWindow = desc->device_window;
local_parameters.Windowed = desc->windowed;
local_parameters.EnableAutoDepthStencil = desc->enable_auto_depth_stencil;
local_parameters.AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc->auto_depth_stencil_format);
local_parameters.Flags = desc->flags;
local_parameters.FullScreen_RefreshRateInHz = desc->refresh_rate;
local_parameters.PresentationInterval = desc->swap_interval;
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&device->IDirect3DDevice9Ex_iface,
&local_parameters, &d3d_swapchain);
@ -3282,20 +3282,20 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain);
/* Copy back the presentation parameters */
present_parameters->BackBufferWidth = local_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = local_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = wined3dformat_from_d3dformat(local_parameters.BackBufferFormat);
present_parameters->BackBufferCount = local_parameters.BackBufferCount;
present_parameters->MultiSampleType = local_parameters.MultiSampleType;
present_parameters->MultiSampleQuality = local_parameters.MultiSampleQuality;
present_parameters->SwapEffect = local_parameters.SwapEffect;
present_parameters->hDeviceWindow = local_parameters.hDeviceWindow;
present_parameters->Windowed = local_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = wined3dformat_from_d3dformat(local_parameters.AutoDepthStencilFormat);
present_parameters->Flags = local_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz;
present_parameters->PresentationInterval = local_parameters.PresentationInterval;
desc->backbuffer_width = local_parameters.BackBufferWidth;
desc->backbuffer_height = local_parameters.BackBufferHeight;
desc->backbuffer_format = wined3dformat_from_d3dformat(local_parameters.BackBufferFormat);
desc->backbuffer_count = local_parameters.BackBufferCount;
desc->multisample_type = local_parameters.MultiSampleType;
desc->multisample_quality = local_parameters.MultiSampleQuality;
desc->swap_effect = local_parameters.SwapEffect;
desc->device_window = local_parameters.hDeviceWindow;
desc->windowed = local_parameters.Windowed;
desc->enable_auto_depth_stencil = local_parameters.EnableAutoDepthStencil;
desc->auto_depth_stencil_format = wined3dformat_from_d3dformat(local_parameters.AutoDepthStencilFormat);
desc->flags = local_parameters.Flags;
desc->refresh_rate = local_parameters.FullScreen_RefreshRateInHz;
desc->swap_interval = local_parameters.PresentationInterval;
return hr;
}
@ -3328,10 +3328,11 @@ static void setup_fpu(void)
#endif
}
HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type,
HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode)
HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct wined3d *wined3d,
UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags,
D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode)
{
WINED3DPRESENT_PARAMETERS *wined3d_parameters;
struct wined3d_swapchain_desc *swapchain_desc;
UINT i, count = 1;
HRESULT hr;
@ -3388,8 +3389,8 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
}
}
wined3d_parameters = HeapAlloc(GetProcessHeap(), 0, sizeof(*wined3d_parameters) * count);
if (!wined3d_parameters)
swapchain_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain_desc) * count);
if (!swapchain_desc)
{
ERR("Failed to allocate wined3d parameters.\n");
wined3d_device_decref(device->wined3d_device);
@ -3399,30 +3400,30 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
for (i = 0; i < count; ++i)
{
wined3d_parameters[i].BackBufferWidth = parameters[i].BackBufferWidth;
wined3d_parameters[i].BackBufferHeight = parameters[i].BackBufferHeight;
wined3d_parameters[i].BackBufferFormat = wined3dformat_from_d3dformat(parameters[i].BackBufferFormat);
wined3d_parameters[i].BackBufferCount = parameters[i].BackBufferCount;
wined3d_parameters[i].MultiSampleType = parameters[i].MultiSampleType;
wined3d_parameters[i].MultiSampleQuality = parameters[i].MultiSampleQuality;
wined3d_parameters[i].SwapEffect = parameters[i].SwapEffect;
wined3d_parameters[i].hDeviceWindow = parameters[i].hDeviceWindow;
wined3d_parameters[i].Windowed = parameters[i].Windowed;
wined3d_parameters[i].EnableAutoDepthStencil = parameters[i].EnableAutoDepthStencil;
wined3d_parameters[i].AutoDepthStencilFormat =
swapchain_desc[i].backbuffer_width = parameters[i].BackBufferWidth;
swapchain_desc[i].backbuffer_height = parameters[i].BackBufferHeight;
swapchain_desc[i].backbuffer_format = wined3dformat_from_d3dformat(parameters[i].BackBufferFormat);
swapchain_desc[i].backbuffer_count = parameters[i].BackBufferCount;
swapchain_desc[i].multisample_type = parameters[i].MultiSampleType;
swapchain_desc[i].multisample_quality = parameters[i].MultiSampleQuality;
swapchain_desc[i].swap_effect = parameters[i].SwapEffect;
swapchain_desc[i].device_window = parameters[i].hDeviceWindow;
swapchain_desc[i].windowed = parameters[i].Windowed;
swapchain_desc[i].enable_auto_depth_stencil = parameters[i].EnableAutoDepthStencil;
swapchain_desc[i].auto_depth_stencil_format =
wined3dformat_from_d3dformat(parameters[i].AutoDepthStencilFormat);
wined3d_parameters[i].Flags = parameters[i].Flags;
wined3d_parameters[i].FullScreen_RefreshRateInHz = parameters[i].FullScreen_RefreshRateInHz;
wined3d_parameters[i].PresentationInterval = parameters[i].PresentationInterval;
wined3d_parameters[i].AutoRestoreDisplayMode = TRUE;
swapchain_desc[i].flags = parameters[i].Flags;
swapchain_desc[i].refresh_rate = parameters[i].FullScreen_RefreshRateInHz;
swapchain_desc[i].swap_interval = parameters[i].PresentationInterval;
swapchain_desc[i].auto_restore_display_mode = TRUE;
}
hr = wined3d_device_init_3d(device->wined3d_device, wined3d_parameters);
hr = wined3d_device_init_3d(device->wined3d_device, swapchain_desc);
if (FAILED(hr))
{
WARN("Failed to initialize 3D, hr %#x.\n", hr);
wined3d_device_release_focus_window(device->wined3d_device);
HeapFree(GetProcessHeap(), 0, wined3d_parameters);
HeapFree(GetProcessHeap(), 0, swapchain_desc);
wined3d_device_decref(device->wined3d_device);
wined3d_mutex_unlock();
return hr;
@ -3432,23 +3433,23 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IDirect3D9Impl *parent, struct
for (i = 0; i < count; ++i)
{
parameters[i].BackBufferWidth = wined3d_parameters[i].BackBufferWidth;
parameters[i].BackBufferHeight = wined3d_parameters[i].BackBufferHeight;
parameters[i].BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters[i].BackBufferFormat);
parameters[i].BackBufferCount = wined3d_parameters[i].BackBufferCount;
parameters[i].MultiSampleType = wined3d_parameters[i].MultiSampleType;
parameters[i].MultiSampleQuality = wined3d_parameters[i].MultiSampleQuality;
parameters[i].SwapEffect = wined3d_parameters[i].SwapEffect;
parameters[i].hDeviceWindow = wined3d_parameters[i].hDeviceWindow;
parameters[i].Windowed = wined3d_parameters[i].Windowed;
parameters[i].EnableAutoDepthStencil = wined3d_parameters[i].EnableAutoDepthStencil;
parameters[i].BackBufferWidth = swapchain_desc[i].backbuffer_width;
parameters[i].BackBufferHeight = swapchain_desc[i].backbuffer_height;
parameters[i].BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc[i].backbuffer_format);
parameters[i].BackBufferCount = swapchain_desc[i].backbuffer_count;
parameters[i].MultiSampleType = swapchain_desc[i].multisample_type;
parameters[i].MultiSampleQuality = swapchain_desc[i].multisample_quality;
parameters[i].SwapEffect = swapchain_desc[i].swap_effect;
parameters[i].hDeviceWindow = swapchain_desc[i].device_window;
parameters[i].Windowed = swapchain_desc[i].windowed;
parameters[i].EnableAutoDepthStencil = swapchain_desc[i].enable_auto_depth_stencil;
parameters[i].AutoDepthStencilFormat =
d3dformat_from_wined3dformat(wined3d_parameters[i].AutoDepthStencilFormat);
parameters[i].Flags = wined3d_parameters[i].Flags;
parameters[i].FullScreen_RefreshRateInHz = wined3d_parameters[i].FullScreen_RefreshRateInHz;
parameters[i].PresentationInterval = wined3d_parameters[i].PresentationInterval;
d3dformat_from_wined3dformat(swapchain_desc[i].auto_depth_stencil_format);
parameters[i].Flags = swapchain_desc[i].flags;
parameters[i].FullScreen_RefreshRateInHz = swapchain_desc[i].refresh_rate;
parameters[i].PresentationInterval = swapchain_desc[i].swap_interval;
}
HeapFree(GetProcessHeap(), 0, wined3d_parameters);
HeapFree(GetProcessHeap(), 0, swapchain_desc);
/* Initialize the converted declaration array. This creates a valid pointer
* and when adding decls HeapReAlloc() can be used without further checking. */

View File

@ -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))
{

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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;
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, &present_parameters);
hr = wined3d_device_init_3d(wined3d_device, &wined3d_desc);
if (FAILED(hr))
{
WARN("Failed to initialize 3D, returning %#x\n", hr);

View File

@ -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))

View File

@ -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;
}

View File

@ -1197,7 +1197,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
}
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters)
struct wined3d_swapchain_desc *swapchain_desc)
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@ -1207,7 +1207,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
DWORD state;
unsigned int i;
TRACE("device %p, present_parameters %p.\n", device, present_parameters);
TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
if (device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
@ -1250,7 +1250,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n");
hr = device->device_parent->ops->create_swapchain(device->device_parent,
present_parameters, &swapchain);
swapchain_desc, &swapchain);
if (FAILED(hr))
{
WARN("Failed to create implicit swapchain\n");
@ -1345,7 +1345,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Clear the screen */
wined3d_device_clear(device, 0, NULL, WINED3DCLEAR_TARGET
| (present_parameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0),
| (swapchain_desc->enable_auto_depth_stencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0),
&black, 1.0f, 0);
device->d3d_initialized = TRUE;
@ -1376,17 +1376,17 @@ err_out:
}
HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters)
struct wined3d_swapchain_desc *swapchain_desc)
{
struct wined3d_swapchain *swapchain = NULL;
HRESULT hr;
TRACE("device %p, present_parameters %p.\n", device, present_parameters);
TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
/* Setup the implicit swapchain */
TRACE("Creating implicit swapchain\n");
hr = device->device_parent->ops->create_swapchain(device->device_parent,
present_parameters, &swapchain);
swapchain_desc, &swapchain);
if (FAILED(hr))
{
WARN("Failed to create implicit swapchain\n");
@ -4950,7 +4950,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st
if (prev)
{
if (device->swapchains[0]->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
if (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| prev->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(prev, SFLAG_DS_DISCARDED,
@ -5217,7 +5217,7 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
const WINED3DPRESENT_PARAMETERS *pPresentationParameters)
const struct wined3d_swapchain_desc *swapchain_desc)
{
struct wined3d_device *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@ -5231,28 +5231,32 @@ static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
surface->resource.allocatedMemory = NULL;
surface->flags &= ~SFLAG_DIBSECTION;
}
surface->resource.width = pPresentationParameters->BackBufferWidth;
surface->resource.height = pPresentationParameters->BackBufferHeight;
surface->resource.width = swapchain_desc->backbuffer_width;
surface->resource.height = swapchain_desc->backbuffer_height;
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE]
|| gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
{
surface->pow2Width = pPresentationParameters->BackBufferWidth;
surface->pow2Height = pPresentationParameters->BackBufferHeight;
} else {
surface->pow2Width = swapchain_desc->backbuffer_width;
surface->pow2Height = swapchain_desc->backbuffer_height;
}
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 < swapchain_desc->backbuffer_width)
surface->pow2Width <<= 1;
while (surface->pow2Height < swapchain_desc->backbuffer_height)
surface->pow2Height <<= 1;
}
if (!(surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL))
surface->resource.format = wined3d_get_format(gl_info, pPresentationParameters->BackBufferFormat);
surface->resource.multisample_type = pPresentationParameters->MultiSampleType;
surface->resource.multisample_quality = pPresentationParameters->MultiSampleQuality;
surface->resource.format = wined3d_get_format(gl_info, swapchain_desc->backbuffer_format);
surface->resource.multisample_type = swapchain_desc->multisample_type;
surface->resource.multisample_quality = swapchain_desc->multisample_quality;
surface->resource.resource_ops->resource_unload(&surface->resource);
if (surface->pow2Width != pPresentationParameters->BackBufferWidth
|| surface->pow2Height != pPresentationParameters->BackBufferHeight)
if (surface->pow2Width != swapchain_desc->backbuffer_width
|| surface->pow2Height != swapchain_desc->backbuffer_height)
{
surface->flags |= SFLAG_NONPOW2;
}
@ -5274,16 +5278,20 @@ static HRESULT updateSurfaceDesc(struct wined3d_surface *surface,
return WINED3D_OK;
}
static BOOL is_display_mode_supported(const struct wined3d_device *device, const WINED3DPRESENT_PARAMETERS *pp)
static BOOL is_display_mode_supported(const struct wined3d_device *device,
const struct wined3d_swapchain_desc *swapchain_desc)
{
struct wined3d_display_mode m;
UINT i, count;
HRESULT hr;
/* All Windowed modes are supported, as is leaving the current mode */
if(pp->Windowed) return TRUE;
if(!pp->BackBufferWidth) return TRUE;
if(!pp->BackBufferHeight) return TRUE;
if (swapchain_desc->windowed)
return TRUE;
if (!swapchain_desc->backbuffer_width)
return TRUE;
if (!swapchain_desc->backbuffer_height)
return TRUE;
count = wined3d_get_adapter_mode_count(device->wined3d, device->adapter->ordinal, WINED3DFMT_UNKNOWN);
for (i = 0; i < count; ++i)
@ -5292,7 +5300,7 @@ static BOOL is_display_mode_supported(const struct wined3d_device *device, const
hr = wined3d_enum_adapter_modes(device->wined3d, device->adapter->ordinal, WINED3DFMT_UNKNOWN, i, &m);
if (FAILED(hr))
ERR("Failed to enumerate adapter mode.\n");
if (m.width == pp->BackBufferWidth && m.height == pp->BackBufferHeight)
if (m.width == swapchain_desc->backbuffer_width && m.height == swapchain_desc->backbuffer_height)
/* Mode found, it is supported. */
return TRUE;
}
@ -5418,7 +5426,7 @@ err:
/* Do not call while under the GL lock. */
HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
const WINED3DPRESENT_PARAMETERS *present_parameters,
const struct wined3d_swapchain_desc *swapchain_desc,
wined3d_device_reset_cb callback)
{
struct wined3d_resource *resource, *cursor;
@ -5429,7 +5437,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
unsigned int i;
HRESULT hr;
TRACE("device %p, present_parameters %p.\n", device, present_parameters);
TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
wined3d_device_set_index_buffer(device, NULL, WINED3DFMT_UNKNOWN);
for (i = 0; i < MAX_STREAMS; ++i)
@ -5460,12 +5468,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
return hr;
}
if (!is_display_mode_supported(device, present_parameters))
if (!is_display_mode_supported(device, swapchain_desc))
{
WARN("Rejecting Reset() call because the requested display mode is not supported\n");
WARN("Requested mode: %d, %d.\n",
present_parameters->BackBufferWidth,
present_parameters->BackBufferHeight);
WARN("Rejecting reset() call because the requested display mode is not supported.\n");
WARN("Requested mode: %ux%u.\n",
swapchain_desc->backbuffer_width,
swapchain_desc->backbuffer_height);
wined3d_swapchain_decref(swapchain);
return WINED3DERR_INVALIDCALL;
}
@ -5478,47 +5486,47 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
* 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", present_parameters->BackBufferWidth);
TRACE("BackBufferHeight = %d\n", present_parameters->BackBufferHeight);
TRACE("BackBufferFormat = %s\n", debug_d3dformat(present_parameters->BackBufferFormat));
TRACE("BackBufferCount = %d\n", present_parameters->BackBufferCount);
TRACE("MultiSampleType = %d\n", present_parameters->MultiSampleType);
TRACE("MultiSampleQuality = %d\n", present_parameters->MultiSampleQuality);
TRACE("SwapEffect = %d\n", present_parameters->SwapEffect);
TRACE("hDeviceWindow = %p\n", present_parameters->hDeviceWindow);
TRACE("Windowed = %s\n", present_parameters->Windowed ? "true" : "false");
TRACE("EnableAutoDepthStencil = %s\n", present_parameters->EnableAutoDepthStencil ? "true" : "false");
TRACE("Flags = %08x\n", present_parameters->Flags);
TRACE("FullScreen_RefreshRateInHz = %d\n", present_parameters->FullScreen_RefreshRateInHz);
TRACE("PresentationInterval = %d\n", present_parameters->PresentationInterval);
TRACE("backbuffer_width %u\n", swapchain_desc->backbuffer_width);
TRACE("backbuffer_height %u\n", swapchain_desc->backbuffer_height);
TRACE("backbuffer_format %s\n", debug_d3dformat(swapchain_desc->backbuffer_format));
TRACE("backbuffer_count %u\n", swapchain_desc->backbuffer_count);
TRACE("multisample_type %#x\n", swapchain_desc->multisample_type);
TRACE("multisample_quality %u\n", swapchain_desc->multisample_quality);
TRACE("swap_effect %#x\n", swapchain_desc->swap_effect);
TRACE("device_window %p\n", swapchain_desc->device_window);
TRACE("windowed %#x\n", swapchain_desc->windowed);
TRACE("enable_auto_depth_stencil %#x\n", swapchain_desc->enable_auto_depth_stencil);
TRACE("flags %#x\n", swapchain_desc->flags);
TRACE("refresh_rate %u\n", swapchain_desc->refresh_rate);
TRACE("swap_interval %u\n", swapchain_desc->swap_interval);
/* No special treatment of these parameters. Just store them */
swapchain->presentParms.SwapEffect = present_parameters->SwapEffect;
swapchain->presentParms.Flags = present_parameters->Flags;
swapchain->presentParms.PresentationInterval = present_parameters->PresentationInterval;
swapchain->presentParms.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
swapchain->desc.swap_effect = swapchain_desc->swap_effect;
swapchain->desc.flags = swapchain_desc->flags;
swapchain->desc.swap_interval = swapchain_desc->swap_interval;
swapchain->desc.refresh_rate = swapchain_desc->refresh_rate;
/* What to do about these? */
if (present_parameters->BackBufferCount
&& present_parameters->BackBufferCount != swapchain->presentParms.BackBufferCount)
if (swapchain_desc->backbuffer_count
&& swapchain_desc->backbuffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n");
if (present_parameters->hDeviceWindow
&& present_parameters->hDeviceWindow != swapchain->presentParms.hDeviceWindow)
if (swapchain_desc->device_window
&& swapchain_desc->device_window != swapchain->desc.device_window)
FIXME("Cannot change the device window yet.\n");
if (present_parameters->EnableAutoDepthStencil && !device->auto_depth_stencil)
if (swapchain_desc->enable_auto_depth_stencil && !device->auto_depth_stencil)
{
HRESULT hrc;
TRACE("Creating the depth stencil buffer\n");
hrc = device->device_parent->ops->create_depth_stencil(device->device_parent,
present_parameters->BackBufferWidth,
present_parameters->BackBufferHeight,
present_parameters->AutoDepthStencilFormat,
present_parameters->MultiSampleType,
present_parameters->MultiSampleQuality,
swapchain_desc->backbuffer_width,
swapchain_desc->backbuffer_height,
swapchain_desc->auto_depth_stencil_format,
swapchain_desc->multisample_type,
swapchain_desc->multisample_quality,
FALSE,
&device->auto_depth_stencil);
if (FAILED(hrc))
@ -5536,7 +5544,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
/* Reset the depth stencil */
if (present_parameters->EnableAutoDepthStencil)
if (swapchain_desc->enable_auto_depth_stencil)
wined3d_device_set_depth_stencil(device, device->auto_depth_stencil);
else
wined3d_device_set_depth_stencil(device, NULL);
@ -5545,46 +5553,46 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_stateblock_decref(device->updateStateBlock);
wined3d_stateblock_decref(device->stateBlock);
if (present_parameters->Windowed)
if (swapchain_desc->windowed)
{
mode.width = swapchain->orig_width;
mode.height = swapchain->orig_height;
mode.refresh_rate = 0;
mode.format_id = swapchain->presentParms.BackBufferFormat;
mode.format_id = swapchain->desc.backbuffer_format;
}
else
{
mode.width = present_parameters->BackBufferWidth;
mode.height = present_parameters->BackBufferHeight;
mode.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
mode.format_id = present_parameters->BackBufferFormat;
mode.width = swapchain_desc->backbuffer_width;
mode.height = swapchain_desc->backbuffer_height;
mode.refresh_rate = swapchain_desc->refresh_rate;
mode.format_id = swapchain_desc->backbuffer_format;
}
/* Should Width == 800 && Height == 0 set 800x600? */
if (present_parameters->BackBufferWidth && present_parameters->BackBufferHeight
&& (present_parameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth
|| present_parameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight))
if (swapchain_desc->backbuffer_width && swapchain_desc->backbuffer_height
&& (swapchain_desc->backbuffer_width != swapchain->desc.backbuffer_width
|| swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height))
{
if (!present_parameters->Windowed)
if (!swapchain_desc->windowed)
DisplayModeChanged = TRUE;
swapchain->presentParms.BackBufferWidth = present_parameters->BackBufferWidth;
swapchain->presentParms.BackBufferHeight = present_parameters->BackBufferHeight;
swapchain->desc.backbuffer_width = swapchain_desc->backbuffer_width;
swapchain->desc.backbuffer_height = swapchain_desc->backbuffer_height;
update_desc = TRUE;
}
if (present_parameters->BackBufferFormat != WINED3DFMT_UNKNOWN
&& present_parameters->BackBufferFormat != swapchain->presentParms.BackBufferFormat)
if (swapchain_desc->backbuffer_format != WINED3DFMT_UNKNOWN
&& swapchain_desc->backbuffer_format != swapchain->desc.backbuffer_format)
{
swapchain->presentParms.BackBufferFormat = present_parameters->BackBufferFormat;
swapchain->desc.backbuffer_format = swapchain_desc->backbuffer_format;
update_desc = TRUE;
}
if (present_parameters->MultiSampleType != swapchain->presentParms.MultiSampleType
|| present_parameters->MultiSampleQuality != swapchain->presentParms.MultiSampleQuality)
if (swapchain_desc->multisample_type != swapchain->desc.multisample_type
|| swapchain_desc->multisample_quality != swapchain->desc.multisample_quality)
{
swapchain->presentParms.MultiSampleType = present_parameters->MultiSampleType;
swapchain->presentParms.MultiSampleQuality = present_parameters->MultiSampleQuality;
swapchain->desc.multisample_type = swapchain_desc->multisample_type;
swapchain->desc.multisample_quality = swapchain_desc->multisample_quality;
update_desc = TRUE;
}
@ -5592,16 +5600,16 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
UINT i;
hr = updateSurfaceDesc(swapchain->front_buffer, &swapchain->presentParms);
hr = updateSurfaceDesc(swapchain->front_buffer, &swapchain->desc);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);
return hr;
}
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
hr = updateSurfaceDesc(swapchain->back_buffers[i], &swapchain->presentParms);
hr = updateSurfaceDesc(swapchain->back_buffers[i], &swapchain->desc);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);
@ -5610,7 +5618,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
if (device->auto_depth_stencil)
{
hr = updateSurfaceDesc(device->auto_depth_stencil, &swapchain->presentParms);
hr = updateSurfaceDesc(device->auto_depth_stencil, &swapchain->desc);
if (FAILED(hr))
{
wined3d_swapchain_decref(swapchain);
@ -5621,18 +5629,18 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
delete_opengl_contexts(device, swapchain);
if (!present_parameters->Windowed != !swapchain->presentParms.Windowed
if (!swapchain_desc->windowed != !swapchain->desc.windowed
|| DisplayModeChanged)
{
wined3d_device_set_display_mode(device, 0, &mode);
if (!present_parameters->Windowed)
if (!swapchain_desc->windowed)
{
if (swapchain->presentParms.Windowed)
if (swapchain->desc.windowed)
{
HWND focus_window = device->create_parms.focus_window;
if (!focus_window)
focus_window = present_parameters->hDeviceWindow;
focus_window = swapchain_desc->device_window;
if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
@ -5642,26 +5650,27 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
/* switch from windowed to fs */
wined3d_device_setup_fullscreen_window(device, swapchain->device_window,
present_parameters->BackBufferWidth,
present_parameters->BackBufferHeight);
swapchain_desc->backbuffer_width,
swapchain_desc->backbuffer_height);
}
else
{
/* Fullscreen -> fullscreen mode change */
MoveWindow(swapchain->device_window, 0, 0,
present_parameters->BackBufferWidth, present_parameters->BackBufferHeight,
swapchain_desc->backbuffer_width,
swapchain_desc->backbuffer_height,
TRUE);
}
}
else if (!swapchain->presentParms.Windowed)
else if (!swapchain->desc.windowed)
{
/* Fullscreen -> windowed switch */
wined3d_device_restore_fullscreen_window(device, swapchain->device_window);
wined3d_device_release_focus_window(device);
}
swapchain->presentParms.Windowed = present_parameters->Windowed;
swapchain->desc.windowed = swapchain_desc->windowed;
}
else if (!present_parameters->Windowed)
else if (!swapchain_desc->windowed)
{
DWORD style = device->style;
DWORD exStyle = device->exStyle;
@ -5672,8 +5681,8 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
device->style = 0;
device->exStyle = 0;
wined3d_device_setup_fullscreen_window(device, swapchain->device_window,
present_parameters->BackBufferWidth,
present_parameters->BackBufferHeight);
swapchain_desc->backbuffer_width,
swapchain_desc->backbuffer_height);
device->style = style;
device->exStyle = exStyle;
}
@ -6008,8 +6017,8 @@ void get_drawable_size_backbuffer(const struct wined3d_context *context, UINT *w
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
* current context's drawable, which is the size of the back buffer of the swapchain
* the active context belongs to. */
*width = swapchain->presentParms.BackBufferWidth;
*height = swapchain->presentParms.BackBufferHeight;
*width = swapchain->desc.backbuffer_width;
*height = swapchain->desc.backbuffer_height;
}
LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,

View File

@ -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;

View File

@ -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");

View File

@ -48,7 +48,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
if (swapchain->back_buffers)
{
i = swapchain->presentParms.BackBufferCount;
i = swapchain->desc.backbuffer_count;
while (i--)
{
@ -72,7 +72,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
* desktop resolution. In case of d3d7 this will be a NOP because ddraw
* sets the resolution before starting up Direct3D, thus orig_width and
* orig_height will be equal to the modes in the presentation params. */
if (!swapchain->presentParms.Windowed && swapchain->presentParms.AutoRestoreDisplayMode)
if (!swapchain->desc.windowed && swapchain->desc.auto_restore_display_mode)
{
mode.width = swapchain->orig_width;
mode.height = swapchain->orig_height;
@ -163,7 +163,7 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc
SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height);
dst_rect = src_rect;
if (swapchain->presentParms.Windowed)
if (swapchain->desc.windowed)
{
MapWindowPoints(swapchain->win_handle, NULL, (POINT *)&dst_rect, 2);
FIXME("Using destination rect %s in windowed mode, this is likely wrong.\n",
@ -184,7 +184,7 @@ HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *
* NULL). We need this because this function is called from
* stateblock_init_default_state() to get the default scissorrect
* dimensions. */
if (!swapchain->back_buffers || back_buffer_idx >= swapchain->presentParms.BackBufferCount)
if (!swapchain->back_buffers || back_buffer_idx >= swapchain->desc.backbuffer_count)
{
WARN("Invalid back buffer index.\n");
/* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it
@ -243,12 +243,12 @@ struct wined3d_device * CDECL wined3d_swapchain_get_device(const struct wined3d_
return swapchain->device;
}
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)
{
TRACE("swapchain %p, present_parameters %p.\n", swapchain, present_parameters);
TRACE("swapchain %p, desc %p.\n", swapchain, desc);
*present_parameters = swapchain->presentParms;
*desc = swapchain->desc;
return WINED3D_OK;
}
@ -475,7 +475,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
/* DDBLT_KEYSRC will cause BltOverride to enable the alpha test with GL_NOTEQUAL, 0.0,
* which is exactly what we want :-)
*/
if (swapchain->presentParms.Windowed)
if (swapchain->desc.windowed)
MapWindowPoints(NULL, swapchain->win_handle, (LPPOINT)&destRect, 2);
wined3d_surface_blt(swapchain->back_buffers[0], &destRect,
&cursor, NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT);
@ -499,8 +499,8 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
{
src_rect = *src_rect_in;
if (!render_to_fbo && (src_rect.left || src_rect.top
|| src_rect.right != swapchain->presentParms.BackBufferWidth
|| src_rect.bottom != swapchain->presentParms.BackBufferHeight))
|| src_rect.right != swapchain->desc.backbuffer_width
|| src_rect.bottom != swapchain->desc.backbuffer_height))
{
render_to_fbo = TRUE;
}
@ -509,8 +509,8 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
{
src_rect.left = 0;
src_rect.top = 0;
src_rect.right = swapchain->presentParms.BackBufferWidth;
src_rect.bottom = swapchain->presentParms.BackBufferHeight;
src_rect.right = swapchain->desc.backbuffer_width;
src_rect.bottom = swapchain->desc.backbuffer_height;
}
if (dst_rect_in)
@ -519,11 +519,9 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
GetClientRect(swapchain->win_handle, &dst_rect);
if (!render_to_fbo && (dst_rect.left || dst_rect.top
|| dst_rect.right != swapchain->presentParms.BackBufferWidth
|| dst_rect.bottom != swapchain->presentParms.BackBufferHeight))
{
|| dst_rect.right != swapchain->desc.backbuffer_width
|| dst_rect.bottom != swapchain->desc.backbuffer_height))
render_to_fbo = TRUE;
}
/* Rendering to a window of different size, presenting partial rectangles,
* or rendering to a different window needs help from FBO_blit or a textured
@ -548,7 +546,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
*
* The DISCARD swap effect is ok as well since any backbuffer content is allowed after
* the swap. */
if (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP)
if (swapchain->desc.swap_effect == WINED3DSWAPEFFECT_FLIP)
FIXME("Render-to-fbo with WINED3DSWAPEFFECT_FLIP\n");
swapchain_blit(swapchain, context, &src_rect, &dst_rect);
@ -590,7 +588,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* bug shows up much more than it does on Windows, and the players see single pixels
* with wrong colors.
* (The Max Payne bug has been confirmed on Windows with the debug runtime) */
if (FALSE && swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD)
if (FALSE && swapchain->desc.swap_effect == WINED3DSWAPEFFECT_DISCARD)
{
static const struct wined3d_color cyan = {0.0f, 1.0f, 1.0f, 1.0f};
@ -634,13 +632,13 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* If the swapeffect is COPY, the content remains the same. If it is FLIP however,
* the texture / sysmem copy needs to be reloaded from the drawable
*/
if (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP)
if (swapchain->desc.swap_effect == WINED3DSWAPEFFECT_FLIP)
surface_modify_location(swapchain->back_buffers[0], swapchain->back_buffers[0]->draw_binding, TRUE);
}
if (fb->depth_stencil)
{
if (swapchain->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| fb->depth_stencil->flags & SFLAG_DISCARD)
{
surface_modify_ds_location(fb->depth_stencil, SFLAG_DS_DISCARDED,
@ -691,7 +689,7 @@ void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *r
/* Front buffer coordinates are screen coordinates. Map them to the
* destination window if not fullscreened. */
if (swapchain->presentParms.Windowed)
if (swapchain->desc.windowed)
ClientToScreen(window, &offset);
TRACE("offset %s.\n", wine_dbgstr_point(&offset));
@ -792,7 +790,7 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
return;
if (!swapchain->presentParms.BackBufferCount)
if (!swapchain->desc.backbuffer_count)
{
TRACE("Single buffered rendering.\n");
swapchain->render_to_fbo = FALSE;
@ -802,16 +800,16 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
GetClientRect(swapchain->win_handle, &client_rect);
TRACE("Backbuffer %ux%u, window %ux%u.\n",
swapchain->presentParms.BackBufferWidth,
swapchain->presentParms.BackBufferHeight,
swapchain->desc.backbuffer_width,
swapchain->desc.backbuffer_height,
client_rect.right, client_rect.bottom);
TRACE("Multisample type %#x, quality %#x.\n",
swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality);
swapchain->desc.multisample_type,
swapchain->desc.multisample_quality);
if (!wined3d_settings.always_offscreen && !swapchain->presentParms.MultiSampleType
&& swapchain->presentParms.BackBufferWidth == client_rect.right
&& swapchain->presentParms.BackBufferHeight == client_rect.bottom)
if (!wined3d_settings.always_offscreen && !swapchain->desc.multisample_type
&& swapchain->desc.backbuffer_width == client_rect.right
&& swapchain->desc.backbuffer_height == client_rect.bottom)
{
TRACE("Backbuffer dimensions match window dimensions, rendering onscreen.\n");
swapchain->render_to_fbo = FALSE;
@ -824,7 +822,7 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
/* Do not call while under the GL lock. */
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surface_type,
struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
const struct wined3d_adapter *adapter = device->adapter;
@ -836,14 +834,14 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
HRESULT hr;
UINT i;
if (present_parameters->BackBufferCount > WINED3DPRESENT_BACK_BUFFER_MAX)
if (desc->backbuffer_count > WINED3DPRESENT_BACK_BUFFER_MAX)
{
FIXME("The application requested %u back buffers, this is not supported.\n",
present_parameters->BackBufferCount);
desc->backbuffer_count);
return WINED3DERR_INVALIDCALL;
}
if (present_parameters->BackBufferCount > 1)
if (desc->backbuffer_count > 1)
{
FIXME("The application requested more than one back buffer, this is not properly supported.\n"
"Please configure the application to use double buffering (1 back buffer) if possible.\n");
@ -864,7 +862,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
return WINED3DERR_INVALIDCALL;
}
window = present_parameters->hDeviceWindow ? present_parameters->hDeviceWindow : device->create_parms.focus_window;
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
swapchain->device = device;
swapchain->parent = parent;
@ -880,37 +878,37 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
format = wined3d_get_format(&adapter->gl_info, mode.format_id);
GetClientRect(window, &client_rect);
if (present_parameters->Windowed
&& (!present_parameters->BackBufferWidth || !present_parameters->BackBufferHeight
|| present_parameters->BackBufferFormat == WINED3DFMT_UNKNOWN))
if (desc->windowed
&& (!desc->backbuffer_width || !desc->backbuffer_height
|| desc->backbuffer_format == WINED3DFMT_UNKNOWN))
{
if (!present_parameters->BackBufferWidth)
if (!desc->backbuffer_width)
{
present_parameters->BackBufferWidth = client_rect.right;
TRACE("Updating width to %u.\n", present_parameters->BackBufferWidth);
desc->backbuffer_width = client_rect.right;
TRACE("Updating width to %u.\n", desc->backbuffer_width);
}
if (!present_parameters->BackBufferHeight)
if (!desc->backbuffer_height)
{
present_parameters->BackBufferHeight = client_rect.bottom;
TRACE("Updating height to %u.\n", present_parameters->BackBufferHeight);
desc->backbuffer_height = client_rect.bottom;
TRACE("Updating height to %u.\n", desc->backbuffer_height);
}
if (present_parameters->BackBufferFormat == WINED3DFMT_UNKNOWN)
if (desc->backbuffer_format == WINED3DFMT_UNKNOWN)
{
present_parameters->BackBufferFormat = swapchain->orig_fmt;
desc->backbuffer_format = swapchain->orig_fmt;
TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->orig_fmt));
}
}
swapchain->presentParms = *present_parameters;
swapchain->desc = *desc;
swapchain_update_render_to_fbo(swapchain);
TRACE("Creating front buffer.\n");
hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
swapchain->desc.backbuffer_format, swapchain->desc.multisample_type,
swapchain->desc.multisample_quality, TRUE /* Lockable */,
&swapchain->front_buffer);
if (FAILED(hr))
{
@ -928,15 +926,15 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
* so we should really check to see if there is a fullscreen swapchain
* already. Does a single head count as full screen? */
if (!present_parameters->Windowed)
if (!desc->windowed)
{
struct wined3d_display_mode mode;
/* Change the display settings */
mode.width = present_parameters->BackBufferWidth;
mode.height = present_parameters->BackBufferHeight;
mode.format_id = present_parameters->BackBufferFormat;
mode.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
mode.width = desc->backbuffer_width;
mode.height = desc->backbuffer_height;
mode.format_id = desc->backbuffer_format;
mode.refresh_rate = desc->refresh_rate;
hr = wined3d_device_set_display_mode(device, 0, &mode);
if (FAILED(hr))
@ -997,18 +995,18 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
}
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
&& (!present_parameters->EnableAutoDepthStencil
|| swapchain->presentParms.AutoDepthStencilFormat != swapchain->ds_format->id))
&& (!desc->enable_auto_depth_stencil
|| swapchain->desc.auto_depth_stencil_format != swapchain->ds_format->id))
{
FIXME("Add OpenGL context recreation support to context_validate_onscreen_formats\n");
}
context_release(swapchain->context[0]);
}
if (swapchain->presentParms.BackBufferCount > 0)
if (swapchain->desc.backbuffer_count > 0)
{
swapchain->back_buffers = HeapAlloc(GetProcessHeap(), 0,
sizeof(*swapchain->back_buffers) * swapchain->presentParms.BackBufferCount);
sizeof(*swapchain->back_buffers) * swapchain->desc.backbuffer_count);
if (!swapchain->back_buffers)
{
ERR("Failed to allocate backbuffer array memory.\n");
@ -1016,13 +1014,13 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
goto err;
}
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
TRACE("Creating back buffer %u.\n", i);
hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */,
swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
swapchain->desc.backbuffer_format, swapchain->desc.multisample_type,
swapchain->desc.multisample_quality, TRUE /* Lockable */,
&swapchain->back_buffers[i]);
if (FAILED(hr))
{
@ -1035,15 +1033,15 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTY
}
/* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */
if (present_parameters->EnableAutoDepthStencil && surface_type == SURFACE_OPENGL)
if (desc->enable_auto_depth_stencil && surface_type == SURFACE_OPENGL)
{
TRACE("Creating depth/stencil buffer.\n");
if (!device->auto_depth_stencil)
{
hr = device->device_parent->ops->create_depth_stencil(device->device_parent,
swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight,
swapchain->presentParms.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType,
swapchain->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */,
swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
swapchain->desc.auto_depth_stencil_format, swapchain->desc.multisample_type,
swapchain->desc.multisample_quality, FALSE /* FIXME: Discard */,
&device->auto_depth_stencil);
if (FAILED(hr))
{
@ -1078,7 +1076,7 @@ err:
if (swapchain->back_buffers)
{
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
if (swapchain->back_buffers[i])
{
@ -1111,15 +1109,15 @@ err:
/* Do not call while under the GL lock. */
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type,
struct wined3d_swapchain_desc *desc, WINED3DSURFTYPE surface_type,
void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_swapchain **swapchain)
{
struct wined3d_swapchain *object;
HRESULT hr;
TRACE("device %p, present_parameters %p, swapchain %p, parent %p, surface_type %#x.\n",
device, present_parameters, swapchain, parent, surface_type);
TRACE("device %p, desc %p, swapchain %p, parent %p, surface_type %#x.\n",
device, desc, swapchain, parent, surface_type);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@ -1128,7 +1126,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
return E_OUTOFMEMORY;
}
hr = swapchain_init(object, surface_type, device, present_parameters, parent, parent_ops);
hr = swapchain_init(object, surface_type, device, desc, parent, parent_ops);
if (FAILED(hr))
{
WARN("Failed to initialize swapchain, hr %#x.\n", hr);
@ -1238,7 +1236,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
surface_update_draw_binding(swapchain->front_buffer);
for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i)
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
surface_update_draw_binding(swapchain->back_buffers[i]);
}

View File

@ -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)

View File

@ -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;

View File

@ -1638,24 +1638,24 @@ struct wined3d_adapter_identifier
SIZE_T video_memory;
};
typedef struct _WINED3DPRESENT_PARAMETERS
struct wined3d_swapchain_desc
{
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;
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);

View File

@ -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
);
}