Commit 8d4e3d0d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Implement d3d9_GetAdapterModeCountEx().

parent 256d4331
......@@ -157,7 +157,8 @@ static UINT WINAPI d3d8_GetAdapterModeCount(IDirect3D8 *iface, UINT adapter)
TRACE("iface %p, adapter %u.\n", iface, adapter);
wined3d_mutex_lock();
hr = wined3d_get_adapter_mode_count(d3d8->wined3d, adapter, 0);
hr = wined3d_get_adapter_mode_count(d3d8->wined3d, adapter,
WINED3DFMT_UNKNOWN, WINED3D_SCANLINE_ORDERING_UNKNOWN);
wined3d_mutex_unlock();
return hr;
......
......@@ -164,7 +164,8 @@ static UINT WINAPI d3d9_GetAdapterModeCount(IDirect3D9Ex *iface, UINT adapter, D
return 0;
wined3d_mutex_lock();
ret = wined3d_get_adapter_mode_count(d3d9->wined3d, adapter, wined3dformat_from_d3dformat(format));
ret = wined3d_get_adapter_mode_count(d3d9->wined3d, adapter,
wined3dformat_from_d3dformat(format), WINED3D_SCANLINE_ORDERING_UNKNOWN);
wined3d_mutex_unlock();
return ret;
......@@ -477,9 +478,20 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U
static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface,
UINT adapter, const D3DDISPLAYMODEFILTER *filter)
{
FIXME("iface %p, adapter %u, filter %p stub!\n", iface, adapter, filter);
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
UINT ret;
TRACE("iface %p, adapter %u, filter %p.\n", iface, adapter, filter);
if (filter->Format != D3DFMT_X8R8G8B8 && filter->Format != D3DFMT_R5G6B5)
return 0;
return 0;
wined3d_mutex_lock();
ret = wined3d_get_adapter_mode_count(d3d9->wined3d, adapter,
wined3dformat_from_d3dformat(filter->Format), filter->ScanLineOrdering);
wined3d_mutex_unlock();
return ret;
}
static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface,
......
......@@ -146,7 +146,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
wined3d_format = wined3dformat_from_dxgi_format(format);
EnterCriticalSection(&dxgi_cs);
max_count = wined3d_get_adapter_mode_count(wined3d, This->adapter->ordinal, wined3d_format);
max_count = wined3d_get_adapter_mode_count(wined3d, This->adapter->ordinal,
wined3d_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
if (!desc)
{
......
......@@ -2892,7 +2892,7 @@ HMONITOR CDECL wined3d_get_adapter_monitor(const struct wined3d *wined3d, UINT a
/* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id)
enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering)
{
const struct wined3d_adapter *adapter;
const struct wined3d_format *format;
......@@ -2901,7 +2901,8 @@ UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT ad
UINT format_bits;
DEVMODEW mode;
TRACE("wined3d %p, adapter_idx %u, format %s.\n", wined3d, adapter_idx, debug_d3dformat(format_id));
TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x.\n",
wined3d, adapter_idx, debug_d3dformat(format_id), scanline_ordering);
if (adapter_idx >= wined3d->adapter_count)
return 0;
......@@ -2915,6 +2916,17 @@ UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT ad
while (EnumDisplaySettingsExW(adapter->DeviceName, j++, &mode, 0))
{
if (mode.dmFields & DM_DISPLAYFLAGS)
{
if (scanline_ordering == WINED3D_SCANLINE_ORDERING_PROGRESSIVE
&& (mode.u2.dmDisplayFlags & DM_INTERLACED))
continue;
if (scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED
&& !(mode.u2.dmDisplayFlags & DM_INTERLACED))
continue;
}
if (format_id == WINED3DFMT_UNKNOWN)
{
/* This is for d3d8, do not enumerate P8 here. */
......@@ -4406,7 +4418,8 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
}
/* If the requested display format is not available, don't continue. */
mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx, display_format);
mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx,
display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
if (!mode_count)
{
TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format));
......
......@@ -2043,8 +2043,8 @@ HRESULT __cdecl wined3d_get_adapter_display_mode(const struct wined3d *wined3d,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
HRESULT __cdecl wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx,
DWORD flags, struct wined3d_adapter_identifier *identifier);
UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d,
UINT adapter_idx, enum wined3d_format_id format_id);
UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering);
HMONITOR __cdecl wined3d_get_adapter_monitor(const struct wined3d *wined3d, UINT adapter_idx);
HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, WINED3DCAPS *caps);
......
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