diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 2510d58c454..3fbc096b254 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -170,7 +170,7 @@ struct d3d8_swapchain }; HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, - struct d3d8_swapchain **swapchain) DECLSPEC_HIDDEN; + unsigned int swap_interval, struct d3d8_swapchain **swapchain) DECLSPEC_HIDDEN; struct d3d8_surface { diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 6dc58cb43b2..26c21169346 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -208,29 +208,8 @@ static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effe } } -static DWORD d3dpresentationinterval_from_wined3dswapinterval(enum wined3d_swap_interval interval) -{ - switch (interval) - { - case WINED3D_SWAP_INTERVAL_IMMEDIATE: - return D3DPRESENT_INTERVAL_IMMEDIATE; - case WINED3D_SWAP_INTERVAL_ONE: - return D3DPRESENT_INTERVAL_ONE; - case WINED3D_SWAP_INTERVAL_TWO: - return D3DPRESENT_INTERVAL_TWO; - case WINED3D_SWAP_INTERVAL_THREE: - return D3DPRESENT_INTERVAL_THREE; - case WINED3D_SWAP_INTERVAL_FOUR: - return D3DPRESENT_INTERVAL_FOUR; - default: - ERR("Invalid swap interval %#x.\n", interval); - case WINED3D_SWAP_INTERVAL_DEFAULT: - return D3DPRESENT_INTERVAL_DEFAULT; - } -} - static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, - const struct wined3d_swapchain_desc *swapchain_desc) + const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) { present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width; present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height; @@ -245,8 +224,7 @@ static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS = d3dformat_from_wined3dformat(swapchain_desc->auto_depth_stencil_format); present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK; present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate; - present_parameters->FullScreen_PresentationInterval - = d3dpresentationinterval_from_wined3dswapinterval(swapchain_desc->swap_interval); + present_parameters->FullScreen_PresentationInterval = presentation_interval; } static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect) @@ -267,7 +245,7 @@ static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFE } } -static enum wined3d_swap_interval wined3dswapinterval_from_d3dpresentationinterval(DWORD interval) +static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval) { switch (interval) { @@ -335,8 +313,6 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->flags = (present_parameters->Flags & D3DPRESENTFLAGS_MASK) | WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH; swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz; - swapchain_desc->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(present_parameters->FullScreen_PresentationInterval); swapchain_desc->auto_restore_display_mode = TRUE; if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK) @@ -805,7 +781,8 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_swapchain_desc desc; struct d3d8_swapchain *object; - UINT i, count; + unsigned int swap_interval; + unsigned int i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", @@ -837,9 +814,11 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters)) return D3DERR_INVALIDCALL; - if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object))) + swap_interval = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval); + if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, swap_interval, &object))) *swapchain = &object->IDirect3DSwapChain8_iface; - present_parameters_from_wined3d_swapchain_desc(present_parameters, &desc); + present_parameters_from_wined3d_swapchain_desc(present_parameters, + &desc, present_parameters->FullScreen_PresentationInterval); return hr; } @@ -914,7 +893,7 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, { present_parameters->BackBufferCount = swapchain_desc.backbuffer_count; device->implicit_swapchain->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(present_parameters->FullScreen_PresentationInterval); + = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); @@ -3345,7 +3324,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent TRACE("device_parent %p, desc %p, swapchain %p.\n", device_parent, desc, swapchain); - if (FAILED(hr = d3d8_swapchain_create(device, desc, &d3d_swapchain))) + if (FAILED(hr = d3d8_swapchain_create(device, desc, WINED3D_SWAP_INTERVAL_DEFAULT, &d3d_swapchain))) { WARN("Failed to create swapchain, hr %#x.\n", hr); *swapchain = NULL; @@ -3466,7 +3445,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); wined3d_mutex_unlock(); - present_parameters_from_wined3d_swapchain_desc(parameters, &swapchain_desc); + present_parameters_from_wined3d_swapchain_desc(parameters, + &swapchain_desc, parameters->FullScreen_PresentationInterval); device->declArraySize = 16; if (!(device->decls = heap_alloc(device->declArraySize * sizeof(*device->decls)))) @@ -3479,7 +3459,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, 0); device->implicit_swapchain = wined3d_swapchain_get_parent(wined3d_swapchain); device->implicit_swapchain->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(parameters->FullScreen_PresentationInterval); + = wined3dswapinterval_from_d3d(parameters->FullScreen_PresentationInterval); device->d3d_parent = &parent->IDirect3D8_iface; IDirect3D8_AddRef(device->d3d_parent); diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c index b9350084a50..39e3b238739 100644 --- a/dlls/d3d8/swapchain.c +++ b/dlls/d3d8/swapchain.c @@ -167,13 +167,13 @@ static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops = }; static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_device *device, - struct wined3d_swapchain_desc *desc) + struct wined3d_swapchain_desc *desc, unsigned int swap_interval) { HRESULT hr; swapchain->refcount = 1; swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl; - swapchain->swap_interval = desc->swap_interval; + swapchain->swap_interval = swap_interval; wined3d_mutex_lock(); hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, @@ -193,7 +193,7 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi } HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapchain_desc *desc, - struct d3d8_swapchain **swapchain) + unsigned int swap_interval, struct d3d8_swapchain **swapchain) { struct d3d8_swapchain *object; HRESULT hr; @@ -201,7 +201,7 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY; - if (FAILED(hr = swapchain_init(object, device, desc))) + if (FAILED(hr = swapchain_init(object, device, desc, swap_interval))) { WARN("Failed to initialize swapchain, hr %#x.\n", hr); heap_free(object); diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 4d783eb9a1a..38fe06cab1b 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -57,7 +57,7 @@ BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN; enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN; unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN; void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, - const struct wined3d_swapchain_desc *swapchain_desc) DECLSPEC_HIDDEN; + const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN; void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN; struct d3d9 @@ -155,7 +155,7 @@ struct d3d9_swapchain }; HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapchain_desc *desc, - struct d3d9_swapchain **swapchain) DECLSPEC_HIDDEN; + unsigned int swap_interval, struct d3d9_swapchain **swapchain) DECLSPEC_HIDDEN; struct d3d9_surface { diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 7c84257c220..2265c1dca29 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -230,29 +230,8 @@ static D3DSWAPEFFECT d3dswapeffect_from_wined3dswapeffect(enum wined3d_swap_effe } } -static DWORD d3dpresentationinterval_from_wined3dswapinterval(enum wined3d_swap_interval interval) -{ - switch (interval) - { - case WINED3D_SWAP_INTERVAL_IMMEDIATE: - return D3DPRESENT_INTERVAL_IMMEDIATE; - case WINED3D_SWAP_INTERVAL_ONE: - return D3DPRESENT_INTERVAL_ONE; - case WINED3D_SWAP_INTERVAL_TWO: - return D3DPRESENT_INTERVAL_TWO; - case WINED3D_SWAP_INTERVAL_THREE: - return D3DPRESENT_INTERVAL_THREE; - case WINED3D_SWAP_INTERVAL_FOUR: - return D3DPRESENT_INTERVAL_FOUR; - default: - ERR("Invalid swap interval %#x.\n", interval); - case WINED3D_SWAP_INTERVAL_DEFAULT: - return D3DPRESENT_INTERVAL_DEFAULT; - } -} - void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters, - const struct wined3d_swapchain_desc *swapchain_desc) + const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) { present_parameters->BackBufferWidth = swapchain_desc->backbuffer_width; present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height; @@ -268,8 +247,7 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese = d3dformat_from_wined3dformat(swapchain_desc->auto_depth_stencil_format); present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK; present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate; - present_parameters->PresentationInterval - = d3dpresentationinterval_from_wined3dswapinterval(swapchain_desc->swap_interval); + present_parameters->PresentationInterval = presentation_interval; } static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFECT effect) @@ -292,7 +270,7 @@ static enum wined3d_swap_effect wined3dswapeffect_from_d3dswapeffect(D3DSWAPEFFE } } -static enum wined3d_swap_interval wined3dswapinterval_from_d3dpresentationinterval(DWORD interval) +static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval) { switch (interval) { @@ -361,8 +339,6 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->flags = (present_parameters->Flags & D3DPRESENTFLAGS_MASK) | WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH; swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz; - swapchain_desc->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(present_parameters->PresentationInterval); swapchain_desc->auto_restore_display_mode = TRUE; if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK) @@ -800,7 +776,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_swapchain_desc desc; struct d3d9_swapchain *object; - UINT i, count; + unsigned int swap_interval; + unsigned int i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", @@ -833,9 +810,11 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID if (!wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters, device->d3d_parent->extended)) return D3DERR_INVALIDCALL; - if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, &object))) + swap_interval = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval); + if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, swap_interval, &object))) *swapchain = (IDirect3DSwapChain9 *)&object->IDirect3DSwapChain9Ex_iface; - present_parameters_from_wined3d_swapchain_desc(present_parameters, &desc); + present_parameters_from_wined3d_swapchain_desc(present_parameters, + &desc, present_parameters->PresentationInterval); return hr; } @@ -992,7 +971,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device, else { device->implicit_swapchains[0]->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(present_parameters->PresentationInterval); + = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval); wined3d_swapchain_get_desc(device->implicit_swapchains[0]->wined3d_swapchain, &swapchain_desc); present_parameters->BackBufferWidth = swapchain_desc.backbuffer_width; present_parameters->BackBufferHeight = swapchain_desc.backbuffer_height; @@ -4191,8 +4170,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain); - hr = d3d9_swapchain_create(device, desc, &d3d_swapchain); - if (FAILED(hr)) + if (FAILED(hr = d3d9_swapchain_create(device, desc, WINED3D_SWAP_INTERVAL_DEFAULT, &d3d_swapchain))) { WARN("Failed to create swapchain, hr %#x.\n", hr); *swapchain = NULL; @@ -4337,12 +4315,13 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine for (i = 0; i < device->implicit_swapchain_count; ++i) { device->implicit_swapchains[i]->swap_interval - = wined3dswapinterval_from_d3dpresentationinterval(parameters[i].PresentationInterval); + = wined3dswapinterval_from_d3d(parameters[i].PresentationInterval); } for (i = 0; i < count; ++i) { - present_parameters_from_wined3d_swapchain_desc(¶meters[i], &swapchain_desc[i]); + present_parameters_from_wined3d_swapchain_desc(¶meters[i], + &swapchain_desc[i], parameters[i].PresentationInterval); } wined3d_mutex_unlock(); diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index 6a182d4012d..d303f3f9564 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -25,6 +25,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); +static DWORD d3dpresentationinterval_from_wined3dswapinterval(enum wined3d_swap_interval interval) +{ + switch (interval) + { + case WINED3D_SWAP_INTERVAL_IMMEDIATE: + return D3DPRESENT_INTERVAL_IMMEDIATE; + case WINED3D_SWAP_INTERVAL_ONE: + return D3DPRESENT_INTERVAL_ONE; + case WINED3D_SWAP_INTERVAL_TWO: + return D3DPRESENT_INTERVAL_TWO; + case WINED3D_SWAP_INTERVAL_THREE: + return D3DPRESENT_INTERVAL_THREE; + case WINED3D_SWAP_INTERVAL_FOUR: + return D3DPRESENT_INTERVAL_FOUR; + default: + ERR("Invalid swap interval %#x.\n", interval); + case WINED3D_SWAP_INTERVAL_DEFAULT: + return D3DPRESENT_INTERVAL_DEFAULT; + } +} + static inline struct d3d9_swapchain *impl_from_IDirect3DSwapChain9Ex(IDirect3DSwapChain9Ex *iface) { return CONTAINING_RECORD(iface, struct d3d9_swapchain, IDirect3DSwapChain9Ex_iface); @@ -251,13 +272,15 @@ static HRESULT WINAPI d3d9_swapchain_GetPresentParameters(IDirect3DSwapChain9Ex { struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface); struct wined3d_swapchain_desc desc; + DWORD presentation_interval; TRACE("iface %p, parameters %p.\n", iface, parameters); wined3d_mutex_lock(); wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &desc); + presentation_interval = d3dpresentationinterval_from_wined3dswapinterval(swapchain->swap_interval); wined3d_mutex_unlock(); - present_parameters_from_wined3d_swapchain_desc(parameters, &desc); + present_parameters_from_wined3d_swapchain_desc(parameters, &desc, presentation_interval); return D3D_OK; } @@ -344,13 +367,13 @@ static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops = }; static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_device *device, - struct wined3d_swapchain_desc *desc) + struct wined3d_swapchain_desc *desc, unsigned int swap_interval) { HRESULT hr; swapchain->refcount = 1; swapchain->IDirect3DSwapChain9Ex_iface.lpVtbl = &d3d9_swapchain_vtbl; - swapchain->swap_interval = desc->swap_interval; + swapchain->swap_interval = swap_interval; wined3d_mutex_lock(); hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, @@ -370,7 +393,7 @@ static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_devi } HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapchain_desc *desc, - struct d3d9_swapchain **swapchain) + unsigned int swap_interval, struct d3d9_swapchain **swapchain) { struct d3d9_swapchain *object; HRESULT hr; @@ -378,7 +401,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY; - if (FAILED(hr = swapchain_init(object, device, desc))) + if (FAILED(hr = swapchain_init(object, device, desc, swap_interval))) { WARN("Failed to initialize swapchain, hr %#x.\n", hr); heap_free(object); diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index bbef76867a3..698680418f4 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -333,7 +333,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IWineDXGIFa wined3d_desc.auto_depth_stencil_format = 0; wined3d_desc.flags = wined3d_swapchain_flags_from_dxgi(swapchain_desc->Flags); wined3d_desc.refresh_rate = fullscreen_desc ? dxgi_rational_to_uint(&fullscreen_desc->RefreshRate) : 0; - wined3d_desc.swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT; wined3d_desc.auto_restore_display_mode = TRUE; hr = IWineDXGIDevice_create_swapchain(dxgi_device, &wined3d_desc, FALSE, &wined3d_swapchain); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 015b4c537ff..24fd72c449f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -454,11 +454,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) swapchain = op->swapchain; wined3d_swapchain_set_window(swapchain, op->dst_window_override); - if (swapchain->desc.swap_interval != op->swap_interval) - { - swapchain->desc.swap_interval = op->swap_interval; - swapchain_update_swap_interval(swapchain); - } + if (swapchain->swap_interval != op->swap_interval) + wined3d_swapchain_set_swap_interval(swapchain, op->swap_interval); swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d2728d8dd3a..7f211f23fec 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4787,7 +4787,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, TRACE("auto_depth_stencil_format %s\n", debug_d3dformat(swapchain_desc->auto_depth_stencil_format)); 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); TRACE("auto_restore_display_mode %#x\n", swapchain_desc->auto_restore_display_mode); if (swapchain_desc->backbuffer_usage != WINED3DUSAGE_RENDERTARGET) @@ -4804,7 +4803,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, swapchain->desc.auto_depth_stencil_format = swapchain_desc->auto_depth_stencil_format; swapchain->desc.flags = swapchain_desc->flags; swapchain->desc.refresh_rate = swapchain_desc->refresh_rate; - swapchain->desc.swap_interval = swapchain_desc->swap_interval; swapchain->desc.auto_restore_display_mode = swapchain_desc->auto_restore_display_mode; if (swapchain_desc->device_window @@ -4971,7 +4969,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { if (reset_state) hr = wined3d_device_create_primary_opengl_context(device); - swapchain_update_swap_interval(swapchain); } /* All done. There is no need to reload resources or shaders, this will happen automatically on the diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b9f2f630076..b94b07ba6e4 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3685,8 +3685,8 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ /* Set the swap effect to COPY, we don't want the backbuffer to become * undefined. */ dst_swapchain->desc.swap_effect = WINED3D_SWAP_EFFECT_COPY; - wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, - dst_swapchain->desc.swap_interval, 0); + wined3d_swapchain_present(dst_swapchain, NULL, NULL, + dst_swapchain->win_handle, dst_swapchain->swap_interval, 0); dst_swapchain->desc.swap_effect = swap_effect; return WINED3D_OK; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 6bbba4d8f53..464a6c0b0ff 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -673,17 +673,17 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s *quality = 0; } -static void wined3d_swapchain_update_swap_interval_cs(void *object) +void wined3d_swapchain_set_swap_interval(struct wined3d_swapchain *swapchain, + unsigned int swap_interval) { - struct wined3d_swapchain *swapchain = object; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - int swap_interval; context = context_acquire(swapchain->device, swapchain->front_buffer, 0); gl_info = context->gl_info; - swap_interval = swapchain->desc.swap_interval > 4 ? 1 : swapchain->desc.swap_interval; + swap_interval = swap_interval <= 4 ? swap_interval : 1; + swapchain->swap_interval = swap_interval; if (gl_info->supported[WGL_EXT_SWAP_CONTROL]) { @@ -736,7 +736,7 @@ static void wined3d_swapchain_cs_init(void *object) context_release(swapchain->context[0]); - wined3d_swapchain_update_swap_interval_cs(swapchain); + wined3d_swapchain_set_swap_interval(swapchain, WINED3D_SWAP_INTERVAL_DEFAULT); } static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device, @@ -1107,11 +1107,6 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) } } -void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) -{ - wined3d_cs_init_object(swapchain->device->cs, wined3d_swapchain_update_swap_interval_cs, swapchain); -} - void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) { struct wined3d_device *device = swapchain->device; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 259ba85de42..574ef46cea1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3783,6 +3783,7 @@ struct wined3d_swapchain const struct wined3d_format *ds_format; struct wined3d_palette *palette; RECT front_buffer_update; + unsigned int swap_interval; LONG prev_time, frames; /* Performance tracking */ @@ -3797,11 +3798,12 @@ struct wined3d_swapchain }; void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; +void wined3d_swapchain_set_swap_interval(struct wined3d_swapchain *swapchain, + unsigned int swap_interval) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; /***************************************************************************** * Utility function prototypes diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 28afb013f42..4e390cc960a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1713,10 +1713,10 @@ struct wined3d_adapter_identifier struct wined3d_swapchain_desc { - UINT backbuffer_width; - UINT backbuffer_height; + unsigned int backbuffer_width; + unsigned int backbuffer_height; enum wined3d_format_id backbuffer_format; - UINT backbuffer_count; + unsigned int backbuffer_count; DWORD backbuffer_usage; enum wined3d_multisample_type multisample_type; DWORD multisample_quality; @@ -1726,8 +1726,7 @@ struct wined3d_swapchain_desc BOOL enable_auto_depth_stencil; enum wined3d_format_id auto_depth_stencil_format; DWORD flags; - UINT refresh_rate; - enum wined3d_swap_interval swap_interval; + unsigned int refresh_rate; BOOL auto_restore_display_mode; };