dxgi: Allow setting maximum frame latency parameter.

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:
Nikolay Sivov 2018-05-15 11:25:59 +03:00 committed by Alexandre Julliard
parent 8a70b70f42
commit 8b57e7dcb9
2 changed files with 29 additions and 14 deletions

View File

@ -258,22 +258,34 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_GetGPUThreadPriority(IWineDXGIDevic
static HRESULT STDMETHODCALLTYPE dxgi_device_SetMaximumFrameLatency(IWineDXGIDevice *iface, UINT max_latency) static HRESULT STDMETHODCALLTYPE dxgi_device_SetMaximumFrameLatency(IWineDXGIDevice *iface, UINT max_latency)
{ {
FIXME("iface %p, max_latency %u stub!\n", iface, max_latency); struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
TRACE("iface %p, max_latency %u.\n", iface, max_latency);
if (max_latency > DXGI_FRAME_LATENCY_MAX) if (max_latency > DXGI_FRAME_LATENCY_MAX)
return DXGI_ERROR_INVALID_CALL; return DXGI_ERROR_INVALID_CALL;
return E_NOTIMPL; wined3d_mutex_lock();
wined3d_device_set_max_frame_latency(device->wined3d_device, max_latency);
wined3d_mutex_unlock();
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE dxgi_device_GetMaximumFrameLatency(IWineDXGIDevice *iface, UINT *max_latency) static HRESULT STDMETHODCALLTYPE dxgi_device_GetMaximumFrameLatency(IWineDXGIDevice *iface, UINT *max_latency)
{ {
FIXME("iface %p, max_latency %p stub!\n", iface, max_latency); struct dxgi_device *device = impl_from_IWineDXGIDevice(iface);
if (max_latency) TRACE("iface %p, max_latency %p.\n", iface, max_latency);
*max_latency = DXGI_FRAME_LATENCY_DEFAULT;
return E_NOTIMPL; if (!max_latency)
return DXGI_ERROR_INVALID_CALL;
wined3d_mutex_lock();
*max_latency = wined3d_device_get_max_frame_latency(device->wined3d_device);
wined3d_mutex_unlock();
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE dxgi_device_OfferResources(IWineDXGIDevice *iface, UINT resource_count, static HRESULT STDMETHODCALLTYPE dxgi_device_OfferResources(IWineDXGIDevice *iface, UINT resource_count,

View File

@ -3426,26 +3426,29 @@ static void test_maximum_frame_latency(void)
if (SUCCEEDED(IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice1, (void **)&device1))) if (SUCCEEDED(IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice1, (void **)&device1)))
{ {
hr = IDXGIDevice1_GetMaximumFrameLatency(device1, NULL);
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency); hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(max_latency == DEFAULT_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency); ok(max_latency == DEFAULT_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY); hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency); hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency); ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY + 1); hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY + 1);
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency); hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency); ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
hr = IDXGIDevice1_SetMaximumFrameLatency(device1, 0); hr = IDXGIDevice1_SetMaximumFrameLatency(device1, 0);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency); hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
/* 0 does not reset to the default frame latency on all Windows versions. */ /* 0 does not reset to the default frame latency on all Windows versions. */
ok(max_latency == DEFAULT_FRAME_LATENCY || broken(!max_latency), ok(max_latency == DEFAULT_FRAME_LATENCY || broken(!max_latency),
"Got unexpected maximum frame latency %u.\n", max_latency); "Got unexpected maximum frame latency %u.\n", max_latency);