Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d9/device.c | 23 ++++++++++++++++++----- dlls/d3d9/tests/d3d9ex.c | 10 +++------- 2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 2134257543..967a472a06 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3762,21 +3762,34 @@ 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); + UINT latency;
- *max_latency = 2; + TRACE("iface %p, max_latency %p.\n", iface, max_latency);
- return E_NOTIMPL; + wined3d_mutex_lock(); + latency = wined3d_device_get_max_frame_latency(device->wined3d_device); + wined3d_mutex_unlock(); + + *max_latency = latency; + + return S_OK; }
static HRESULT WINAPI d3d9_device_CheckDeviceState(IDirect3DDevice9Ex *iface, HWND dst_window) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 7c36e6ee64..d210b8baed 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -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);