Commit 8376010b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d9: Implement setting the maximum frame latency.

parent 8e24cb6a
......@@ -3762,21 +3762,31 @@ static HRESULT WINAPI d3d9_device_CheckResourceResidency(IDirect3DDevice9Ex *ifa
static HRESULT WINAPI d3d9_device_SetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT max_latency)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
TRACE("iface %p, max_latency %u.\n", iface, max_latency);
if (max_latency)
FIXME("Ignoring max_latency %u.\n", max_latency);
if (max_latency > 30)
return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
wined3d_device_set_max_frame_latency(device->wined3d_device, max_latency);
wined3d_mutex_unlock();
return S_OK;
}
static HRESULT WINAPI d3d9_device_GetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT *max_latency)
{
FIXME("iface %p, max_latency %p stub!\n", iface, max_latency);
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
*max_latency = 2;
TRACE("iface %p, max_latency %p.\n", iface, max_latency);
return E_NOTIMPL;
wined3d_mutex_lock();
*max_latency = wined3d_device_get_max_frame_latency(device->wined3d_device);
wined3d_mutex_unlock();
return S_OK;
}
static HRESULT WINAPI d3d9_device_CheckDeviceState(IDirect3DDevice9Ex *iface, HWND dst_window)
......
......@@ -4060,31 +4060,27 @@ static void test_frame_latency(void)
}
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
todo_wine {
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
}
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 1);
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
todo_wine {
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
ok(latency == 1, "Unexpected max frame latency %u.\n", latency);
}
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 0);
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
todo_wine {
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
}
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 30);
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 31);
todo_wine
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
refcount = IDirect3DDevice9Ex_Release(device);
......
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