[PATCH 1/8] wined3d: Implement updating swap interval through wined3d_swapchain_present().
Henri Verbeet
hverbeet at gmail.com
Wed Feb 28 09:26:18 CST 2018
On 28 February 2018 at 12:12, Józef Kucia <jkucia at codeweavers.com> wrote:
> @@ -105,7 +105,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
>
> wined3d_mutex_lock();
> hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
> - src_rect, dst_rect, dst_window_override, 0);
> + src_rect, dst_rect, dst_window_override, 0, 0);
...
> @@ -453,6 +454,12 @@ 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 (op->swap_interval && swapchain->desc.swap_interval != op->swap_interval)
> + {
> + swapchain->desc.swap_interval = op->swap_interval;
> + swapchain_update_swap_interval(swapchain);
> + }
> +
> swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
It seems undesirable to have two conflicting mechanism to set the swap
interval. Is there any reason to avoid using the DXGI mechanism for
d3d9 and before as well?
> @@ -528,11 +528,34 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_Present1(IDXGISwapChain1 *iface,
> UINT sync_interval, UINT flags, const DXGI_PRESENT_PARAMETERS *present_parameters)
> {
> struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain1(iface);
> + DWORD swap_interval;
> HRESULT hr;
>
> TRACE("iface %p, sync_interval %u, flags %#x, present_parameters %p.\n",
> iface, sync_interval, flags, present_parameters);
>
> + switch (sync_interval)
> + {
> + case 0:
> + swap_interval = WINED3DPRESENT_INTERVAL_IMMEDIATE;
> + break;
> + case 1:
> + swap_interval = WINED3DPRESENT_INTERVAL_ONE;
> + break;
> + case 2:
> + swap_interval = WINED3DPRESENT_INTERVAL_TWO;
> + break;
> + case 3:
> + swap_interval = WINED3DPRESENT_INTERVAL_THREE;
> + break;
> + case 4:
> + swap_interval = WINED3DPRESENT_INTERVAL_FOUR;
> + break;
> + default:
> + WARN("Invalid sync interval %u.\n", sync_interval);
> + return DXGI_ERROR_INVALID_CALL;
> + }
I think it would be better to just pass the DXGI interval to wined3d.
Not in the least because we convert it back again in
wined3d_swapchain_update_swap_interval_cs().
> @@ -94,6 +94,7 @@ struct wined3d_cs_present
> struct wined3d_swapchain *swapchain;
> RECT src_rect;
> RECT dst_rect;
> + DWORD swap_interval;
> DWORD flags;
> };
unsigned int, probably.
More information about the wine-devel
mailing list