d3d9: Implement setting the maximum frame latency.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8e24cb6a32
commit
8376010b95
|
@ -3762,21 +3762,31 @@ static HRESULT WINAPI d3d9_device_CheckResourceResidency(IDirect3DDevice9Ex *ifa
|
||||||
|
|
||||||
static HRESULT WINAPI d3d9_device_SetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT max_latency)
|
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);
|
TRACE("iface %p, max_latency %u.\n", iface, max_latency);
|
||||||
|
|
||||||
if (max_latency)
|
if (max_latency > 30)
|
||||||
FIXME("Ignoring max_latency %u.\n", max_latency);
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
wined3d_mutex_lock();
|
||||||
|
wined3d_device_set_max_frame_latency(device->wined3d_device, max_latency);
|
||||||
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3d9_device_GetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT *max_latency)
|
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)
|
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);
|
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
|
||||||
todo_wine {
|
|
||||||
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
||||||
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
|
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
|
||||||
}
|
|
||||||
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 1);
|
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 1);
|
||||||
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
|
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
|
||||||
todo_wine {
|
|
||||||
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
||||||
ok(latency == 1, "Unexpected max frame latency %u.\n", latency);
|
ok(latency == 1, "Unexpected max frame latency %u.\n", latency);
|
||||||
}
|
|
||||||
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 0);
|
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 0);
|
||||||
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
|
hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency);
|
||||||
todo_wine {
|
|
||||||
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr);
|
||||||
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
|
ok(latency == 3, "Unexpected default max frame latency %u.\n", latency);
|
||||||
}
|
|
||||||
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 30);
|
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 30);
|
||||||
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 31);
|
hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 31);
|
||||||
todo_wine
|
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
refcount = IDirect3DDevice9Ex_Release(device);
|
refcount = IDirect3DDevice9Ex_Release(device);
|
||||||
|
|
Loading…
Reference in New Issue