d3d9: Implement d3d9_GetAdapterModeCountEx().

This commit is contained in:
Henri Verbeet 2012-06-29 07:37:57 +02:00 committed by Alexandre Julliard
parent 256d433164
commit 8d4e3d0d58
5 changed files with 37 additions and 10 deletions

View File

@ -157,7 +157,8 @@ static UINT WINAPI d3d8_GetAdapterModeCount(IDirect3D8 *iface, UINT adapter)
TRACE("iface %p, adapter %u.\n", iface, adapter); TRACE("iface %p, adapter %u.\n", iface, adapter);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -164,7 +164,8 @@ static UINT WINAPI d3d9_GetAdapterModeCount(IDirect3D9Ex *iface, UINT adapter, D
return 0; return 0;
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
return ret; return ret;
@ -477,9 +478,20 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U
static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface, static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface,
UINT adapter, const D3DDISPLAYMODEFILTER *filter) 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, static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface,

View File

@ -146,7 +146,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
wined3d_format = wined3dformat_from_dxgi_format(format); wined3d_format = wined3dformat_from_dxgi_format(format);
EnterCriticalSection(&dxgi_cs); 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) if (!desc)
{ {

View File

@ -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 */ /* 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, 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_adapter *adapter;
const struct wined3d_format *format; 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; UINT format_bits;
DEVMODEW mode; 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) if (adapter_idx >= wined3d->adapter_count)
return 0; 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)) 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) if (format_id == WINED3DFMT_UNKNOWN)
{ {
/* This is for d3d8, do not enumerate P8 here. */ /* 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. */ /* 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) if (!mode_count)
{ {
TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format)); TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format));

View File

@ -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); struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
HRESULT __cdecl wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx,
DWORD flags, struct wined3d_adapter_identifier *identifier); DWORD flags, struct wined3d_adapter_identifier *identifier);
UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT adapter_idx,
UINT adapter_idx, enum wined3d_format_id format_id); 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); 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, HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, WINED3DCAPS *caps); enum wined3d_device_type device_type, WINED3DCAPS *caps);