Commit 82ffc5b7 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Avoid superfluous wglSwapIntervalEXT() calls.

parent e9f6a94b
......@@ -453,9 +453,7 @@ 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->swap_interval != op->swap_interval)
wined3d_swapchain_set_swap_interval(swapchain, 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);
......
......@@ -679,12 +679,15 @@ void wined3d_swapchain_set_swap_interval(struct wined3d_swapchain *swapchain,
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
context = context_acquire(swapchain->device, swapchain->front_buffer, 0);
gl_info = context->gl_info;
swap_interval = swap_interval <= 4 ? swap_interval : 1;
if (swapchain->swap_interval == swap_interval)
return;
swapchain->swap_interval = swap_interval;
context = context_acquire(swapchain->device, swapchain->front_buffer, 0);
gl_info = context->gl_info;
if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
{
if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
......@@ -735,8 +738,6 @@ static void wined3d_swapchain_cs_init(void *object)
FIXME("Add OpenGL context recreation support.\n");
context_release(swapchain->context[0]);
wined3d_swapchain_set_swap_interval(swapchain, WINED3D_SWAP_INTERVAL_DEFAULT);
}
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
......@@ -747,9 +748,9 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
BOOL displaymode_set = FALSE;
DWORD texture_flags = 0;
RECT client_rect;
unsigned int i;
HWND window;
HRESULT hr;
UINT i;
if (desc->backbuffer_count > 1)
{
......@@ -775,6 +776,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
swapchain->ref = 1;
swapchain->win_handle = window;
swapchain->device_window = window;
swapchain->swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT;
if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d,
adapter->ordinal, &swapchain->original_mode, NULL)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment