=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi: Implement dxgi_output_FindClosestMatchingMode().
Alexandre Julliard
julliard at winehq.org
Fri Aug 26 10:18:11 CDT 2016
Module: wine
Branch: master
Commit: 8d89d0ec1ee7f50aeee348edb30c6b228f522d27
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8d89d0ec1ee7f50aeee348edb30c6b228f522d27
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Aug 25 12:22:52 2016 +0200
dxgi: Implement dxgi_output_FindClosestMatchingMode().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dxgi/output.c | 37 +++++++++++++++++++++++++++++++++++--
dlls/dxgi/tests/device.c | 2 +-
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c
index 6d7ca20..0cf8084 100644
--- a/dlls/dxgi/output.c
+++ b/dlls/dxgi/output.c
@@ -228,9 +228,42 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput *iface,
const DXGI_MODE_DESC *mode, DXGI_MODE_DESC *closest_match, IUnknown *device)
{
- FIXME("iface %p, mode %p, closest_match %p, device %p stub!\n", iface, mode, closest_match, device);
+ struct dxgi_output *output = impl_from_IDXGIOutput(iface);
+ struct wined3d_display_mode wined3d_mode;
+ struct dxgi_adapter *adapter;
+ struct wined3d *wined3d;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, mode %p, closest_match %p, device %p.\n", iface, mode, closest_match, device);
+
+ if ((!mode->Width && mode->Height) || (mode->Width && !mode->Height))
+ return DXGI_ERROR_INVALID_CALL;
+
+ if (mode->Format == DXGI_FORMAT_UNKNOWN && !device)
+ return DXGI_ERROR_INVALID_CALL;
+
+ TRACE("Mode: %s.\n", debug_dxgi_mode(mode));
+ if (mode->Format == DXGI_FORMAT_UNKNOWN)
+ {
+ FIXME("Matching formats to device not implemented.\n");
+ return E_NOTIMPL;
+ }
+
+ adapter = output->adapter;
+ wined3d = adapter->factory->wined3d;
+
+ wined3d_mutex_lock();
+ wined3d_display_mode_from_dxgi(&wined3d_mode, mode);
+ hr = wined3d_find_closest_matching_adapter_mode(wined3d, adapter->ordinal, &wined3d_mode);
+ wined3d_mutex_unlock();
+
+ if (SUCCEEDED(hr))
+ {
+ dxgi_mode_from_wined3d(closest_match, &wined3d_mode);
+ TRACE("Returning %s.\n", debug_dxgi_mode(closest_match));
+ }
+
+ return hr;
}
static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput *iface)
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 23624eb..8ec65e2 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -225,7 +225,7 @@ static void compute_expected_swapchain_fullscreen_state_after_fullscreen_change_
mode_desc.Width = new_width;
mode_desc.Height = new_height;
hr = IDXGIOutput_FindClosestMatchingMode(target, &mode_desc, &mode_desc, NULL);
- todo_wine ok_(__FILE__, line)(SUCCEEDED(hr), "FindClosestMatchingMode failed, hr %#x.\n", hr);
+ ok_(__FILE__, line)(SUCCEEDED(hr), "FindClosestMatchingMode failed, hr %#x.\n", hr);
new_width = mode_desc.Width;
new_height = mode_desc.Height;
}
More information about the wine-cvs
mailing list