wined3d: Pass swap interval to swapchain ops.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e664c29351
commit
6d45ce4e5a
|
@ -526,9 +526,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);
|
||||
wined3d_swapchain_set_swap_interval(swapchain, op->swap_interval);
|
||||
|
||||
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
|
||||
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->swap_interval, op->flags);
|
||||
|
||||
wined3d_resource_release(&swapchain->front_buffer->resource);
|
||||
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
|
||||
|
|
|
@ -157,9 +157,9 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
|
|||
{
|
||||
RECT s, d;
|
||||
|
||||
TRACE("swapchain %p, src_rect %s, dst_rect %s, dst_window_override %p, flags %#x.\n",
|
||||
TRACE("swapchain %p, src_rect %s, dst_rect %s, dst_window_override %p, swap_interval %u, flags %#x.\n",
|
||||
swapchain, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
|
||||
dst_window_override, flags);
|
||||
dst_window_override, swap_interval, flags);
|
||||
|
||||
if (flags)
|
||||
FIXME("Ignoring flags %#x.\n", flags);
|
||||
|
@ -348,6 +348,27 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
|
|||
wined3d_texture_invalidate_location(texture, 0, WINED3D_LOCATION_DRAWABLE);
|
||||
}
|
||||
|
||||
static void swapchain_gl_set_swap_interval(struct wined3d_swapchain *swapchain,
|
||||
struct wined3d_context *context, unsigned int swap_interval)
|
||||
{
|
||||
const struct wined3d_gl_info *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;
|
||||
|
||||
if (!gl_info->supported[WGL_EXT_SWAP_CONTROL])
|
||||
return;
|
||||
|
||||
if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
|
||||
{
|
||||
ERR("Failed to set swap interval %u for context %p, last error %#x.\n",
|
||||
swap_interval, context, GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, struct wined3d_context *context)
|
||||
{
|
||||
|
@ -396,7 +417,7 @@ static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, str
|
|||
}
|
||||
|
||||
static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
||||
const RECT *src_rect, const RECT *dst_rect, DWORD flags)
|
||||
const RECT *src_rect, const RECT *dst_rect, unsigned int swap_interval, DWORD flags)
|
||||
{
|
||||
struct wined3d_texture *back_buffer = swapchain->back_buffers[0];
|
||||
const struct wined3d_fb_state *fb = &swapchain->device->cs->fb;
|
||||
|
@ -416,6 +437,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
|
|||
|
||||
gl_info = context->gl_info;
|
||||
|
||||
swapchain_gl_set_swap_interval(swapchain, context, swap_interval);
|
||||
|
||||
if ((logo_texture = swapchain->device->logo_texture))
|
||||
{
|
||||
RECT rect = {0, 0, logo_texture->resource.width, logo_texture->resource.height};
|
||||
|
@ -597,7 +620,7 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
|
|||
}
|
||||
|
||||
static void swapchain_gdi_present(struct wined3d_swapchain *swapchain,
|
||||
const RECT *src_rect, const RECT *dst_rect, DWORD flags)
|
||||
const RECT *src_rect, const RECT *dst_rect, unsigned int swap_interval, DWORD flags)
|
||||
{
|
||||
struct wined3d_dc_info *front, *back;
|
||||
HBITMAP bitmap;
|
||||
|
@ -689,31 +712,6 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s
|
|||
*quality = 0;
|
||||
}
|
||||
|
||||
void wined3d_swapchain_set_swap_interval(struct wined3d_swapchain *swapchain,
|
||||
unsigned int swap_interval)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context *context;
|
||||
|
||||
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)))
|
||||
ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x.\n",
|
||||
swap_interval, context, GetLastError());
|
||||
}
|
||||
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
static void wined3d_swapchain_cs_init(void *object)
|
||||
{
|
||||
struct wined3d_swapchain *swapchain = object;
|
||||
|
|
|
@ -4011,7 +4011,7 @@ static inline struct wined3d_unordered_access_view_gl *wined3d_unordered_access_
|
|||
struct wined3d_swapchain_ops
|
||||
{
|
||||
void (*swapchain_present)(struct wined3d_swapchain *swapchain,
|
||||
const RECT *src_rect, const RECT *dst_rect, DWORD flags);
|
||||
const RECT *src_rect, const RECT *dst_rect, unsigned int swap_interval, DWORD flags);
|
||||
void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain);
|
||||
};
|
||||
|
||||
|
@ -4049,8 +4049,6 @@ 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;
|
||||
|
|
Loading…
Reference in New Issue