Commit 6b8fb1c2 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Also update the swap interval when not recreating the context in wined3d_device_reset().

parent 425e84da
......@@ -1582,7 +1582,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
HGLRC ctx, share_ctx;
int pixel_format;
unsigned int s;
int swap_interval;
DWORD state;
HDC hdc = 0;
BOOL hdc_is_private = FALSE;
......@@ -1838,36 +1837,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
}
}
switch (swapchain->desc.swap_interval)
{
case WINED3DPRESENT_INTERVAL_IMMEDIATE:
swap_interval = 0;
break;
case WINED3DPRESENT_INTERVAL_DEFAULT:
case WINED3DPRESENT_INTERVAL_ONE:
swap_interval = 1;
break;
case WINED3DPRESENT_INTERVAL_TWO:
swap_interval = 2;
break;
case WINED3DPRESENT_INTERVAL_THREE:
swap_interval = 3;
break;
case WINED3DPRESENT_INTERVAL_FOUR:
swap_interval = 4;
break;
default:
FIXME("Unknown swap interval %#x.\n", swapchain->desc.swap_interval);
swap_interval = 1;
}
if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
{
if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n",
swap_interval, ret, GetLastError());
}
gl_info->gl_ops.gl.p_glGetIntegerv(GL_AUX_BUFFERS, &ret->aux_buffers);
TRACE("Setting up the screen\n");
......
......@@ -4899,8 +4899,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
if (reset_state && device->d3d_initialized)
hr = create_primary_opengl_context(device, swapchain);
if (device->d3d_initialized)
{
if (reset_state)
hr = create_primary_opengl_context(device, swapchain);
swapchain_update_swap_interval(swapchain);
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
* first use
......
......@@ -993,6 +993,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
FIXME("Add OpenGL context recreation support to context_validate_onscreen_formats\n");
}
context_release(swapchain->context[0]);
swapchain_update_swap_interval(swapchain);
}
if (swapchain->desc.backbuffer_count > 0)
......@@ -1221,6 +1222,48 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
}
}
void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
int swap_interval;
context = context_acquire(swapchain->device, swapchain->front_buffer->sub_resources[0].u.surface);
gl_info = context->gl_info;
switch (swapchain->desc.swap_interval)
{
case WINED3DPRESENT_INTERVAL_IMMEDIATE:
swap_interval = 0;
break;
case WINED3DPRESENT_INTERVAL_DEFAULT:
case WINED3DPRESENT_INTERVAL_ONE:
swap_interval = 1;
break;
case WINED3DPRESENT_INTERVAL_TWO:
swap_interval = 2;
break;
case WINED3DPRESENT_INTERVAL_THREE:
swap_interval = 3;
break;
case WINED3DPRESENT_INTERVAL_FOUR:
swap_interval = 4;
break;
default:
FIXME("Unhandled present interval %#x.\n", swapchain->desc.swap_interval);
swap_interval = 1;
}
if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
{
if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n",
swap_interval, context, GetLastError());
}
context_release(context);
}
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
{
struct wined3d_device *device = swapchain->device;
......
......@@ -3066,6 +3066,7 @@ struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchai
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
......
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